w3c / shacl

SHACL Community Group (Post-REC activitities)
27 stars 4 forks source link

Shacl validation for properties of type `rdfs:ContainerMembershipProperty` #16

Closed smokkapa closed 4 months ago

smokkapa commented 1 year ago

I am currently trying to build a constraint validation shape for an incoming object of the type rdf:Seq. In, rdf:Seq the predicate is a variable, as it can be rdf:_1, rdf:_2,...., where the numbers indicate the ordinality of the object in the list . How can I build a property shape to validate the data coming in rdf:Seq?

Appreciate any help. Thanks!

Let's say for a given incoming data

...
<incoming node> schema:colors _:blankNode1 .
_:blankNode1 rdf:type rdf:Seq .
_:blankNode1 rdf:_1 "Red" .
_:blankNode1 rdf:_2 "Blue" .
_:blankNode1 rdf:_3 "Yellow" .
...

What could the shape be? Can something like the following is possible?

...
sh: property [
   sh:path schema:colors ;
   sh:class rdf:Seq ;
   sh:property [ 
       sh:path  <rdf:_1, rdf:_2, .....rdf:_n>;
       sh:in ("Red" "Blue" "Green" ) ;
   ] ;
 ] ;
...
HolgerKnublauch commented 1 year ago

Given that there can be an infinite number of properties, you cannot use a path expression such as rdf:_1 | rdf:_2 | ...

So I guess your best bet would be SHACL-SPARQL, where you can treat the predicate as an unbound variable.

smokkapa commented 1 year ago

I see. Will try it out. Thanks!

afs commented 1 year ago

If the base system supports rdfs:member, which is the super-property of all rdf:_N, then that might provide a solution.

HolgerKnublauch commented 4 months ago

In preparation for a potential future SHACL WG I would like to close GitHub issues that were mainly just questions. Please reopen if you disagree.