The implementation follows what the SHACL WG decided. And the official
design uses sh:closed only on the current shape. Many WG members were
against using class inheritance for anything (which came to a surprise
to me because I think rdfs:subClassOf is the most important relation in
the RDF world after rdf:type).
In the future we could add a variation of sh:closed that also walks up
the superclasses (e.g. into the dash namespace). This is not too
difficult to do, and anyone could add such a constraint component in
their own namespace. Its validator would be a variation of the SPARQL
query of sh:closed, probably only replace the one line with
$currentShape rdfs:subClassOf*/sh:property/sh:predicate ?predicate .
Holger
On 30/11/2016 8:20, Matt Johnson wrote:
Hello,
I am trying to understand just how possible it is to close the world
using SHACL. With the current implementation of the SHACL API, is it
possible to inherit the constraints of one's super class (via
rdfs:subClassOf) **and** to close the sub-class? The following
example defines a shape (and class) and two property constraints for
Events. Dinner is then defined as a subClassOf Event but the Dinner
shape is also defined as being closed. The intent here is to not
allow any other predicates for Dinner. The result produces a failure
for inst:dinner_1 stating that ex:startDate is not allowed because
Dinner is closed. If I change the Dinner shape such that sh:closed ==
false, the instance does indeed become conformant but also allows
other predicates. Am I attempting something that SHACL is not meant
to do? From what I can tell, subClassOf is the way of achieving
"inheritance" but perhaps I have misunderstood. Thanks for your help.
Matt
PS: I created this example using TBC 5.2.1 and have gotten similar
results when using the SHACL API directly.
ex:Event
rdf:type rdfs:Class ;
rdf:type sh:Shape ;
rdfs:label "Event" ;
sh:ignoredProperties (
rdf:type
rdfs:label
) ;
sh:property [
sh:predicate ex:endDate ;
sh:datatype xsd:date ;
sh:maxCount 1 ;
sh:name "end date" ;
] ;
sh:property [
sh:predicate ex:startDate ;
sh:datatype xsd:date ;
sh:maxCount 1 ;
sh:name "start date" ;
] ;
.
ex:Dinner
rdf:type rdfs:Class ;
rdf:type sh:Shape ;
rdfs:label "Dinner" ;
rdfs:subClassOf ex:Event ;
sh:closed "true"^^xsd:boolean ;
sh:ignoredProperties (
rdf:type
rdfs:label
) ;
sh:property [
sh:predicate ex:onMenu ;
sh:datatype xsd:string ;
sh:name "on menu" ;
] ;
.
inst:dinner_1
rdf:type ex:Dinner ;
ex:onMenu "Hamburger" ;
ex:startDate "2001-01-01"^^xsd:date ;
rdfs:label "dinner 1" ;
.
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include the TopBraid
Suite family of products and its base technologies such as
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Group "TopBraid
Suite Users", the topics of which include the TopBraid Suite family of products and
its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.