-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multivalued or union sh:dataType #160
Comments
The union datatype approach works quite well and comes out of the box in the dash namespace https://datashapes.org/dash.html#union-datatypes Adding multiple sh:datatypes would be inconsistent with how the rest of SHACL is working - no other constraint component takes multiple values of the same property. I agree however that processing this through sh:or is not elegant. The old WG had considered something like sh:datatypeIn which would take an enumeration but rejected this in order to keep the language smaller. |
A union datatype has consequences for data exchange though. The import and use of such data must now consider all possibilities or be "by value". Adding as a library, rather than changing SHACL-core is better. Then a system can publish which libraries it is using, which is a contract it can adhere to even if it is not using all features at one point in time. In other words - shapes files declare feature sets, whether by imports or a new, specific property. |
Is it possible to consider datatype hierarchy to address some of the concerns in this thread and related issues? For instance, quoting XSD 1.1:
Specifically, because of the term "derived," should a I'm unaware of history on this topic, and would welcome any pointers to prior discussion on or not on this tracker. |
One idea (not fleshed out) to improve the syntax of union constraints would be to introduce a new kind of NodeShapes for which multiple constraints are interpreted as "OR" instead of "AND". For example:
Above I am reusing sh:or - this time allowing something else than an rdf:List - but we could also introduce a new property. The value of sh:or above would be a shape with OR semantics. The same could be applied to xone. |
May I even suggest an even more simplified encoding for unions, in which one would simply repeat the sh:datatype triple: ex:SomeClass-someProperty
a sh:PropertyShape ;
sh:path ex:someProperty ;
sh:datatype xsd:string, rdf:langString ; My practice shown that unions of constraints are most of the time applied on the same constraints (e.g. an OR of sh:datatype, or an OR of sh:class, etc.). So maybe a flag on the shapes graph level or on the node shape level could say "treat values of the same constraint on a single shape as a UNION", so that the above encoding would have the same semantic as the corresponding sh:or. |
This would be a breaking change, unfortunately. And it gets worse for cases like union sh:class constraints, because the original intention MAY actually have been intersection semantics so we cannot just change that to union with the very same syntax. |
So as to not break the existing semantic I was thinking about another flag somewhere that would trigger this "interpret-multiple-values-as-unions" semantic: ex:MyShapes a owl:Ontology ;
# new flag ?
sh:multipleConstraintValuesAsUnions true .
ex:SomeClass-someProperty
a sh:PropertyShape ;
sh:path ex:someProperty ;
sh:datatype xsd:string, rdf:langString ; (this is all syntactic sugar) |
Being RDF,
means both apply, which is intersection. How a list is processed can be a decision of the SHACL spec. |
I see what you mean, because sh:datatype implicitely means "datatype is equal to". |
Some literal (attribute) props naturally admit a variety of datatypes, eg
SHACL can express this with sh:or property shapes, but it gets tedious.
Can we allow multiple values of sh:dataType?
Alternatively, we could think of some synthetic "union datatypes", eg
We actually have the first two in Ontotext SOML (GraphQL), which in SHACL is expanded to sh:or
The text was updated successfully, but these errors were encountered: