I know, almost everybody stumbles there. It was bad editing by the editor :)
Unfortunately I cannot just go into that document and fix it. That's the bane of these formal specs, and why many people get work done quicker outside of such formal processes. Holger > On 28 Feb 2023, at 1:24 pm, Martynas Jusevičius <marty...@atomgraph.com> > wrote: > > Thanks Holger, that is the case :) The "sh:prefixes ex:" in the SHACL spec > was somewhat confusing without context, because it looks like a Turtle prefix > declaration. > > This works: > > :prefixes sh:declare [ > sh:prefix "skos" ; > sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ; > ] . > > <#ConceptBroaderCycleShape> sh:prefixes :prefixes ; > > > On Tue, Feb 28, 2023 at 2:16 PM Holger Knublauch <hol...@topquadrant.com > <mailto:hol...@topquadrant.com>> wrote: >> I suspect this is another instance of the common misunderstanding: the >> @prefix declarations are not mapped to any triples and are only a concept of >> the serialization. To make them visible to SHACL, you need to declare >> triples such as in >> >> Shapes Constraint Language (SHACL) >> w3.org >> >> <https://www.w3.org/TR/shacl/#sparql-prefixes>Shapes Constraint Language >> (SHACL) <https://www.w3.org/TR/shacl/#sparql-prefixes> >> w3.org <https://www.w3.org/TR/shacl/#sparql-prefixes> >> <https://www.w3.org/TR/shacl/#sparql-prefixes> >> in your case it would be skos: as subject. >> >> Holger >> >> >>> On 28 Feb 2023, at 12:56 pm, Martynas Jusevičius <marty...@atomgraph.com >>> <mailto:marty...@atomgraph.com>> wrote: >>> >>> Hi, >>> >>> Does Jena's SHACL engine support sh:prefixes? Or am I using them wrong? >>> >>> The following test shape >>> >>> @prefix skos: <http://www.w3.org/2004/02/skos/core#> . >>> @prefix sh: <http://www.w3.org/ns/shacl#> . >>> >>> <#ConceptBroaderCycleShape> >>> a sh:NodeShape ; >>> sh:targetClass skos:Concept ; >>> sh:sparql [ >>> a sh:SPARQLConstraint ; >>> sh:message "Concept is broader than itself (directly or indirectly)" >>> ; >>> sh:prefixes skos: ; >>> sh:select """ >>> SELECT * >>> { >>> $this skos:broader+ $this . >>> } >>> """ ; >>> ] . >>> >>> returns an error: >>> >>> org.apache.jena.shacl.parser.ShaclParseException: Bad query: Line 5, >>> column 23: Unresolved prefixed name: skos:broader >>> at org.apache.jena.shacl.lib.ShLib.parseQueryString(ShLib.java:262) >>> at org.apache.jena.shacl.lib.ShLib.extractSPARQLQuery(ShLib.java:270) >>> at >>> org.apache.jena.shacl.engine.SparqlConstraints.parseSparqlConstraint(SparqlConstraints.java:64) >>> at >>> org.apache.jena.shacl.parser.Constraints.lambda$static$20(Constraints.java:116) >>> at >>> org.apache.jena.shacl.parser.Constraints.parseConstraint(Constraints.java:176) >>> at >>> org.apache.jena.shacl.parser.Constraints.parseConstraints(Constraints.java:160) >>> at >>> org.apache.jena.shacl.parser.ShapesParser.parseShape$(ShapesParser.java:319) >>> at >>> org.apache.jena.shacl.parser.ShapesParser.parseShapeStep(ShapesParser.java:305) >>> at >>> org.apache.jena.shacl.parser.ShapesParser.parseShape(ShapesParser.java:236) >>> at >>> org.apache.jena.shacl.parser.ShapesParser.parseShapeAcc(ShapesParser.java:221) >>> at >>> org.apache.jena.shacl.parser.ShapesParser.parseShapes(ShapesParser.java:163) >>> at >>> org.apache.jena.shacl.parser.ShapesParser.parseProcess(ShapesParser.java:100) >>> at org.apache.jena.shacl.Shapes.parseProcess(Shapes.java:111) >>> at org.apache.jena.shacl.Shapes.parseAll(Shapes.java:106) >>> at org.apache.jena.shacl.Shapes.parse(Shapes.java:83) >>> at >>> org.apache.jena.shacl.validation.ShaclPlainValidator.parse(ShaclPlainValidator.java:38) >>> at >>> org.apache.jena.shacl.validation.ShaclPlainValidator.validate(ShaclPlainValidator.java:90) >>> at shacl.shacl_validate.exec(shacl_validate.java:124) >>> at org.apache.jena.cmd.CmdMain.mainMethod(CmdMain.java:87) >>> at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:56) >>> at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:43) >>> at shacl.shacl_validate.main(shacl_validate.java:60) >>> at shacl.shacl.main(shacl.java:81) >>> >>> >>> Martynas >>