Am 2022-03-09 13:22, schrieb Thomas Francart:
I think you could do it with jena. Load the dara into a Graph, then
get
the focus nodes for all shapes you want using VLib.focusNodes.
evaluate
each shape on its focus nodes and compile the intersection of all
focus
nodes that are valid, along with the shapes. Now evaluate the shapes
again
on these valid focus nodes and record all the triples/quads that are
pulled
from the data graph during evaluation.
But does this guarantee that all triples pulled from the data graph are
valid triples ?
For example I may have
ex:myConcept skos:prefLabel "english label"@en, "german label"@de .
And my SHACL would specify a Shape that mandates English :
ex:MyShape a sh:NodeShape ;
sh:property [
sh:property skos:prefLabel ;
sh:languageIn ("en") ;
]
In that case, does only the skos:prefLabel with an english lang be
pulled
from the graph ?
I take the hypothesis that any triple pulled from the graph are the one
for
which the predicate is indicated in sh:property, but this does not
guarantee that the triple is valid.
Wouldn't this require to know whether each individual triples has
matched
all the constraints of the shape to output it or not ?
I think you are right. You'd get a bigger set than the triples you
actually want. You can probably use the validation result to filter out
the triples that cause violations - although I am not positive it will
work in every instance. I'd try, though.