w3c / data-shapes

RDF Data Shapes WG repo
89 stars 33 forks source link

Invalid sh:sourceShape blank node references in core/complex/personexample.ttl #102

Closed ashleysommer closed 6 years ago

ashleysommer commented 6 years ago

This is the file in question: https://github.com/w3c/data-shapes/blob/gh-pages/data-shapes-test-suite/tests/core/complex/personexample.ttl

In the set of expected results, three of the expected results reference blank node _:b61064 as the value for sh:sourceShape, but that labelled blank node does not exist in the file. Pulling out the anonymous blank node PropertyShape which has sh:path ex:ssn, into a labelled blank node fixes this first issue.

Additionally, the fourth result in the set of expected results has sh:sourceShape [] that is an empty blank node for source shape. In this case the value for sh:sourceShape should be the PropertyShape which has sh:path ex:worksFor. Pulling out that anonymous blank node PropertyShape into a labelled blank node, and changing sh:sourceShape on that expected result to be that labelled blank node fixes that issue.

pySHACL now passes that test after those two changes. I don't know how any other SHACL implementations have claimed to pass test, in its current state it is simply not possible, unless they are deliberately choosing to not match sh:sourceShape values in the expected results.

HolgerKnublauch commented 6 years ago

Yes this is better, thank you. The reason why implementations were still allowed to pass is that sh:sourceShape is an optional triple, i.e. not all implementation need to produce it and according to https://w3c.github.io/data-shapes/data-shapes-test-suite/#Validate "Alternatively, implementation may still report pass if they have manually checked that their validation reports satisfy the requirements specified by the SHACL specification."