Fixed in 3.16.0:
"shacl parse" gives:
No sh:path on a property shape:
node=<http://example/bdsContentLocationShape> sh:property
<http://example/bdsContentLocationShape-contentLocationStatement>
when there exists at least one triple with
bds:ContentLocationShape-contentLocationStatement as subject
and
Missing property shape: node=<http://example/bdsContentLocationShape>
sh:property
<http://example/bdsContentLocationShape-contentLocationStatement>
if there are none:
(and no stacktraces)
but what you show if 3.15.0.
Test RDF::
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bds: <http://example/bds>
PREFIX bdo: <http://example/bdo>
bds:ContentLocationShape
a sh:NodeShape ;
sh:property bds:ContentLocationShape-contentLocationStatement ;
sh:targetClass bdo:ContentLocation .
#bds:ContentLocationShape-contentLocationStatement rdf:type
sh:PropertyShape .
On 16/07/2020 21:44, Chris Tomlinson wrote:
Hi,
I’ve gotten a parse exception:
org.apache.jena.shacl.parser.ShaclParseException: No sh:path on a property shape:
<http://purl.bdrc.io/ontology/shapes/core/ContentLocationShape>
at
org.apache.jena.shacl.parser.ShapesParser.findPropertyShapes(ShapesParser.java:285)
at
org.apache.jena.shacl.parser.ShapesParser.parseShape$(ShapesParser.java:214)
at
org.apache.jena.shacl.parser.ShapesParser.parseShapeStep(ShapesParser.java:196)
at
org.apache.jena.shacl.parser.ShapesParser.parseRootShape(ShapesParser.java:140)
at
org.apache.jena.shacl.parser.ShapesParser.parseShapes(ShapesParser.java:84)
at org.apache.jena.shacl.Shapes.parse(Shapes.java:55)
performing:
Shapes shapes = Shapes.parse(testGraph);
on the graph:
bds:ContentLocationShape
a sh:NodeShape ;
sh:property bds:ContentLocationShape-contentLocationStatement ;
sh:targetClass bdo:ContentLocation .
In the above graph there are no triples with
bds:ContentLocationShape-contentLocationStatement
as subject so the Shapes.parse raises an exception which seems reasonable;
however, the message should refer to the missing definition of a putative
PropertyShape reference rather than to the NodeShape that contains the
reference.
In the simple case above it’s trivial by a casual inspection what the problem
is, but when there are a large number of PropertyShape refs and all that the
message says is that the NodeShape doesn’t have an sh:path, its pretty opaque
as to what the problem is.
Maybe there’s a way to improve the exception message?
Thanks,
Chris