Closed verweijs closed 4 years ago
You have only added the subClassOf statement into the shapes graph. This is good but not sufficient, because the statements also need to be available to the data graph. In a typical scenario, the data graph would import the shapes graph and thus also include the subClassOf triples. But the Playground doesn't do that. Adding schema:Child rdfs:subClassOf schema:Person into the data graph should solve it for this toy example.
Formal background is in the spec: https://www.w3.org/TR/shacl/#implicit-targetClass note the use of the term "data graph" in the textual definition.
In a typical scenario, the data graph would import the shapes graph and thus also include the subClassOf triples. But the Playground doesn't do that.
I see, but then how does the standard data graph example in the playground 'read' that a person should have another shape: address? Or is this just how SHACL is implemented in JavaScript?
Thanks again for your patience, it is much appreciated!
The address is validated because there is a sh:node constraint in
sh:property [ sh:path schema:address ; sh:node schema:AddressShape ; ]
which causes the engine to walk from the Person into the Address shape.
If this answers your questions, feel free to close the ticket. Thanks.
I am messing around in the shacl playground and added a subclass to the
Person
class in the example:Child
Now my understanding of subclasses is that the properties of the parent class are inherited. However, when I change the
schema:Person
intoschema:Child
in the data graph it does not seem like the properties are inherited correctly (it seems to ignore thesh:lessThan
constraint that is violated:Why are the properties of Person not inherited to child in this case?