ISSUE-104: Should sh:datatype and sh:class have better support for OR?

Union ranges

Should sh:datatype and sh:class have better support for OR?

State:
CLOSED
Product:
SHACL Spec
Raised by:
Holger Knublauch
Opened on:
2015-10-23
Description:
While playing with SHACL in practice, I noticed a gap in the spec.

It is quite common to have properties that can take multiple types of values. sh:text is one example where we hard-coded the pattern rdf:langString OR xsd:string, but a similar variation is xsd:date OR xsd:dateTime. Another example is skos:member, which is skos:Concept OR skos:Collection. schema.org is full of such examples.

To express such unions, the current syntax is very verbose and not suitable for static analysis:

ex:MyShape
sh:property [
sh:predicate ex:property ;
sh:maxCount 1 ;
] ;
sh:constraint [
sh:or (
[
sh:property [
sh:predicate ex:property ;
sh:datatype xsd:string ;
]
]
[
sh:property [
sh:predicate ex:property ;
sh:datatype rdf:langString ;
]
]
)
] .

An option would be to use OWL's unionOf:

ex:MyShape
sh:property [
sh:predicate ex:property ;
sh:maxCount 1 ;
sh:datatype [
a owl:Class ;
owl:unionOf ( xsd:string rdf:langString )
]
] .

which is much better because it allows us to put everything into a single sh:property node. However, it adds a dependency on OWL, setting wrong expectations about inferencing and all kinds of other unsupported features such as further nested classes, NOT, AND etc, which are usually unnecessary.

I believe we should support this syntax:

ex:MyShape
sh:property [
sh:predicate ex:property ;
sh:maxCount 1 ;
sh:datatype ( xsd:string rdf:langString )
] .

In this proposal, the values of sh:datatype, sh:directType and sh:class may either be IRIs of classes or an rdf:List of IRIs. The SPARQL queries in the spec would need to be adjusted accordingly. We can delete sh:text instead.

I believe this covers a large number of additional use cases while keeping the complexity and implementation burden to a minimum. I believe it is of strategic importance to have a natural way to express schema.org and other common use cases with SHACL.
Related Actions Items:
No related actions
Related emails:
  1. ISSUE-104: Implemented resolution (from holger@topquadrant.com on 2016-01-10)
  2. Re: shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from arthur.ryman@gmail.com on 2015-11-11)
  3. Re: Can we freeze the Tracker for while? (from lehors@us.ibm.com on 2015-11-09)
  4. Re: Can we freeze the Tracker for while? (from kcoyle@kcoyle.net on 2015-11-09)
  5. Re: Can we freeze the Tracker for while? (from holger@topquadrant.com on 2015-11-09)
  6. Re: shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from holger@topquadrant.com on 2015-11-06)
  7. Re: shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from arthur.ryman@gmail.com on 2015-11-05)
  8. Re: shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from holger@topquadrant.com on 2015-10-30)
  9. Re: shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from holger@topquadrant.com on 2015-10-30)
  10. Re: shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from arthur.ryman@gmail.com on 2015-10-29)
  11. Re: shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from arthur.ryman@gmail.com on 2015-10-29)
  12. shapes-ISSUE-104 (Union ranges): Should sh:datatype and sh:class have better support for OR? [SHACL Spec] (from sysbot+tracker@w3.org on 2015-10-23)

Related notes:

RESOLUTION: Close ISSUE-104, as proposed, using the properties sh:classIn and sh:datatypeIn, and noting that every case should be examined to see whether it deserves to have the same feature
See http://www.w3.org/2015/12/10-shapes-minutes.html#resolution03

Arnaud Le Hors, 11 Dec 2015, 21:10:47

Display change log ATOM feed


Irene Polikoff <irene@topquadrant.com>, Ted Thibodeau <tthibodeau@openlinksw.com>, Chairs, Sandro Hawke <sandro@w3.org>, 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: index.php,v 1.325 2014-09-10 21:42:02 ted Exp $