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:
  1. Re: Proposal to close ISSUE-84 (from arthur.ryman@gmail.com on 2015-10-29)
  2. Re: Proposal to close ISSUE-84 (from arthur.ryman@gmail.com on 2015-10-29)
  3. Re: Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-19)
  4. Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-18)
  5. Re: Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-18)
  6. Re: Proposal to close ISSUE-84 (from pfpschneider@gmail.com on 2015-10-17)
  7. Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-17)
  8. Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-17)
  9. Re: Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-17)
  10. Re: Proposal to close ISSUE-84 (from kcoyle@kcoyle.net on 2015-10-16)
  11. Proposal to close ISSUE-84 (from holger@topquadrant.com on 2015-10-16)
  12. shapes-ISSUE-98 (Node constraints): Proposal to generalize property constraints into node constraints [SHACL Spec] (from sysbot+tracker@w3.org on 2015-10-02)
  13. Re: RDF Data Shapes WG Agenda for 1 October 2015 (from holger@topquadrant.com on 2015-10-01)
  14. Re: RDF Data Shapes WG Agenda for 1 October 2015 (from pfpschneider@gmail.com on 2015-09-30)
  15. Re: propose to make repeated-properties additive (from arthur.ryman@gmail.com on 2015-09-25)
  16. Re: propose to make repeated-properties additive (from holger@topquadrant.com on 2015-09-22)
  17. 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

Arnaud Le Hors, 6 Nov 2015, 04:27:06

Display change log ATOM feed


Chair, Staff Contact
Tracker: documentation, (configuration for this group), originally developed by Dean Jackson, is developed and maintained by the Systems Team <w3t-sys@w3.org>.
$Id: 84.html,v 1.1 2018/11/26 09:03:42 carine Exp $