What is VLib.validateShape actually returns the focusNode + Path + valueNodes that conform to each shape ? or emit them through a listener ? ( https://github.com/apache/jena/blob/5ce8c141d425655bcaa9d7567117659e502a7ff1/jena-shacl/src/main/java/org/apache/jena/shacl/validation/VLib.java#L89 ) The idea would be to use the Validator as a "filter" that emits the triples valid according to shapes, so that they can be aggregated in an output graph.
Le mer. 9 mars 2022 à 13:45, Florian Kleedorfer < florian.kleedor...@austria.fm> a écrit : > 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. > -- *Thomas Francart* -* SPARNA* Web de *données* | Architecture de l'*information* | Accès aux *connaissances* blog : blog.sparna.fr, site : sparna.fr, linkedin : fr.linkedin.com/in/thomasfrancart tel : +33 (0)6.71.11.25.97, skype : francartthomas