ISSUE-84: Constraint to limit IRIs of focus nodes to a given enumeration (similar to owl:oneOf)
Allowed IRIs
Constraint to limit IRIs of focus nodes to a given enumeration (similar to owl:oneOf)
- State:
- CLOSED
- Product:
- SHACL Spec
- Raised by:
- Holger Knublauch
- Opened on:
- 2015-09-02
- Description:
- I tried to model that the class sh:NodeKind consists of exactly three instances (sh:IRI, sh:Literal, sh:BlankNode), but failed to find a simple way of expressing this within the SHACL Core language. Maybe I am missing something. But I believe this is a recurring pattern in controlled vocabularies and may deserve its "built-in" construct. OWL has the equivalent built-in via owl:oneOf.
A possible syntax and template are below.
sh:NodeKind
a sh:ShapeClass ;
rdfs:subClassOf rdfs:Resource ;
rdfs:label "Node kind" ;
rdfs:comment "The class of RDF node kinds: literals, blank nodes and IRIs." ;
sh:constraint [
a sh:AllowedIRIsConstraint ;
sh:allowedIRIs ( sh:BlankNode sh:IRI sh:Literal ) ;
] ;
.
sh:AllowedIRIsConstraint
a sh:ConstraintTemplate ;
rdfs:subClassOf sh:TemplateConstraint ;
rdfs:label "Enumerated class constraint" ;
rdfs:comment "Specifies that the IRIs of the focus nodes must be one of the members of the rdf:List given as sh:allowedIRIs." ;
sh:argument [
sh:predicate sh:allowedIRIs ;
sh:valueClass rdf:List ;
rdfs:label "allowed IRIs" ;
rdfs:comment "The list of IRIs that are allowed" ;
] ;
sh:message "Node is not among the allowed IRIs" ;
sh:sparql """
SELECT ?this
WHERE {
FILTER NOT EXISTS {
GRAPH ?shapesGraph {
?allowedIRIs (rdf:rest*)/rdf:first ?this .
}
}
}
""" ;
.
An alternative would be to create an sh:inverseProperty constraint on rdf:type starting at the focus node sh:NodeKind using a sh:nodeShape scope, but this is verbose and doesn't feel intuitive.
- Related Actions Items:
- No related actions
- Related emails:
- Re: Proposal to close ISSUE-84 (from arthur.ryman@gmail.com on 2015-10-29)
- Re: Proposal to close ISSUE-84 (from arthur.ryman@gmail.com on 2015-10-29)
- Re: Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-19)
- Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-18)
- Re: Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-18)
- Re: Proposal to close ISSUE-84 (from pfpschneider@gmail.com on 2015-10-17)
- Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-17)
- Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-17)
- Re: Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-17)
- Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-16)
- Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-16)
- shapes-ISSUE-98 (Node constraints): Proposal to generalize property constraints into node constraints [SHACL Spec] (from sysbot+tracker@w3.org on 2015-10-02)
- Re: RDF Data Shapes WG Agenda for 1 October 2015 (from holger@topquadrant.com on 2015-10-01)
- Re: RDF Data Shapes WG Agenda for 1 October 2015 (from pfpschneider@gmail.com on 2015-09-30)
- Re: propose to make repeated-properties additive (from arthur.ryman@gmail.com on 2015-09-25)
- Re: propose to make repeated-properties additive (from holger@topquadrant.com on 2015-09-22)
- shapes-ISSUE-84 (Allowed IRIs): Constraint to limit IRIs of focus nodes to a given enumeration (similar to owl:oneOf) [SHACL Spec] (from sysbot+tracker@w3.org on 2015-09-02)
Related notes:
RESOLUTION: Close ISSUE-84, node constraints are now addressed with sh:in
See http://www.w3.org/2015/11/05-shapes-minutes.html#resolution03
Display change log