Skip to content
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

Open
VladimirAlexiev opened this issue Dec 4, 2024 · 2 comments
Open

Multivalued or union sh:dataType #160

VladimirAlexiev opened this issue Dec 4, 2024 · 2 comments

Comments

@VladimirAlexiev
Copy link

VladimirAlexiev commented Dec 4, 2024

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

  • sh:dateOrDateTimeStamp
  • sh:stringOrLangString (rdf:PlainLiteral means the same)
  • sh:natural, sh:nonNegativeNatural, etc

We actually have the first two in Ontotext SOML (GraphQL), which in SHACL is expanded to sh:or

@HolgerKnublauch
Copy link
Contributor

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.

@afs
Copy link

afs commented Dec 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants