SEMICeu / DCAT-AP

This is the issue tracker for the maintenance of DCAT-AP
https://joinup.ec.europa.eu/solution/dcat-application-profile-data-portals-europe
72 stars 24 forks source link

Empty SHACL property shape causing Jena parser to fail #216

Closed jakubklimek closed 1 year ago

jakubklimek commented 2 years ago

This empty property shape causes Apache Jena SHACL parser to fail with:

org.apache.jena.shacl.parser.ShaclParseException: Missing property shape: node=<http://data.europa.eu/r5r#Identifier_Shape> sh:property _:B6cb9b429cf2f2a37369272c3463e53d6
        at org.apache.jena.shacl.parser.ShapesParser.findPropertyShapes(ShapesParser.java:406)
        at org.apache.jena.shacl.parser.ShapesParser.parseShape$(ShapesParser.java:332)
        at org.apache.jena.shacl.parser.ShapesParser.parseShapeStep(ShapesParser.java:310)
        at org.apache.jena.shacl.parser.ShapesParser.parseShape(ShapesParser.java:241)
        at org.apache.jena.shacl.parser.ShapesParser.parseShapeAcc(ShapesParser.java:226)
        at org.apache.jena.shacl.parser.ShapesParser.parseShapes(ShapesParser.java:165)
        at org.apache.jena.shacl.parser.ShapesParser.parseProcess(ShapesParser.java:101)
        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:91)
        at shacl.shacl_validate.exec(shacl_validate.java:124)
        at org.apache.jena.cmd.CmdMain.mainMethod(CmdMain.java:92)
        at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:58)
        at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:45)
        at shacl.shacl_validate.main(shacl_validate.java:60)
        at shacl.shacl.main(shacl.java:81)
bertvannuffelen commented 2 years ago

@jakubklimek I initially wondered whether this is in the first place an issue for the SHACL implementers community? As I have no such report from the ISA testbed implementation, which is using the TopBraid OS library.

After some digging in the SHACL spec, it turns out that there is a requirement to have at least a sh:path on the sh:property specified. And as _:test sh:property [] results in a blank node with nothing attached this triggers the jena error. I'll update the files.

fabiankirstein commented 1 year ago

Hi @bertvannuffelen, thanks for the fix. However, we have tested the 2.1.1.-draft version and there are still some empty sh:property fields.

https://github.com/SEMICeu/DCAT-AP/blob/2.1.1-draft/releases/2.1.1/dcat-ap_2.1.1_shacl_range.ttl#L393 https://github.com/SEMICeu/DCAT-AP/blob/2.1.1-draft/releases/2.1.1/dcat-ap_2.1.1_shacl_shapes_recommended.ttl#L92

If you comment these out, Jena will load them correctly.

bertvannuffelen commented 1 year ago

fixed now