w3c / shacl

SHACL Community Group (Post-REC activitities)
32 stars 5 forks source link

[SHACL-AF]: Multiple values of constant term expression #18

Closed tpluscode closed 1 year ago

tpluscode commented 1 year ago

The current spec says:

constant term expression [...] produces the list of length 1 with $expr as its only member.

I think it should be supported to have the "constant" consist of multiple values. Analogous to sh:hasValue with multiple objects.

[
  sh:path schema:name ;
  sh:values "Apple"@en, "Apfel"@de, "Jabłko"@pl ;
] .

The result would be [ schema:name "Apple"@en, "Apfel"@de, "Jabłko"@pl ]

tpluscode commented 1 year ago

Ooh, curious. I double checked the published CG Note and it does in fact phrase it differently, as I would expect

constant term expression [...] produces the set { $expr }.

Why was tis changed?

HolgerKnublauch commented 1 year ago

In https://w3c.github.io/shacl/shacl-af/#node-expressions-constant it still reads

For the constant term expression $expr, Eval($expr, $this) produces the list of length 1 with $expr as its only member.

and I believe this makes sense. Each node expression is one node. Only if it's a blank node, the node expression is assumed to have further values and the engine needs to walk into the properties of that blank node.

In your example, you basically have three sh:values rules, and I believe it is reasonable to assume that the total inferred values of the properties are the union of each sh:values rule. So I believe it will work just fine, without changes to how constant expressions work.

tpluscode commented 1 year ago

Ok, I see how it makes sense to treat each node as an individual node. I somehow assumed that the full set would be the expression. Thanks for explaining