-
Notifications
You must be signed in to change notification settings - Fork 38
Description
The focus of SHACL so far has been on validating nodes so that when we know that a node is targeted by a shape we can confirm that it conforms to all the conditions laid out in the shape. This is similar to how OWL uses rdf:type
and rdfs:subClassOf
: If we know that someone is an instance of ex:AdultPerson
we can restrict ex:age
to >= 18
.
However, the same validation could also be applied on untargeted nodes. This is similar to the "sufficient" conditions expressed using owl:equivalentClass
, where OWL can express "if we know that some ex:Person
is >= 18
years old, then we classify them as ex:AdultPerson
".
In SHACL this would be useful not only to cover the same use cases (as an "inference") but also for user interfaces. For example, if we know that some Person
also conforms to an ex:AdultPersonShape
, the form could show additional input fields for properties that are only available to adults.
The following suggests to introduce some property sh:mayTargetClass
(or other syntax) to indicate that instances of Person
should be classified against AdultPersonShape
.
ex:Person
a sh:ShapeClass ;
rdfs:subClassOf owl:Thing ;
sh:property [
sh:path ex:age ;
sh:datatype xsd:integer ;
] .
ex:AdultPersonShape
a sh:NodeShape ;
sh:mayTargetClass ex:Person ;
sh:property [
sh:path ex:age ;
sh:minInclusive 18 ;
sh:minCount 1 ;
] ;
sh:property [
sh:path ex:votedFor ;
sh:class ex:Party ;
] .
The key is that unlike targets, this means that only SOME of the Persons
need to conform to the shape, but we want to indicate which nodes are candidates.
If a Person
fulfills all constraints of AdultPersonShape
, an engine could also "infer" a triple such as
ex:Bob sh:shape ex:AdultPersonShape
similar to how an OWL reasoner would infer extra rdf:type
triples. In fact if the AdultPersonShape
was also a class, it could infer an extra rdf:type
triple just like OWL would.
There are many syntactic variations of this idea, above is just a first draft to start the discussion and capture the use case.