w3c / data-shapes

RDF Data Shapes WG repo
87 stars 33 forks source link

Which are the value nodes when a sh:PropertyShape has target declarations? #89

Closed MiguelAraCo closed 6 years ago

MiguelAraCo commented 6 years ago

If we have the following model:

<PropertyShape>
  a sh:PropertyShape;
  sh:targetNode <TargetNode>;
  sh:path ex:property;
  sh:class ex:SomeClass.

<TargetNode>
  ex:property [ # _:b1
    a ex:SomeClass
  ].

Is both <TargetNode> and _:b1 value nodes? Should the processor produce a result because <TargetNode> doesn't have the required class?

HolgerKnublauch commented 6 years ago

See https://www.w3.org/TR/shacl/#value-nodes, the value nodes of a property shape are the nodes that can be reached by following the sh:path from the focus node. In other words, TargetNode is not a value node but a focus node.

MiguelAraCo commented 6 years ago

But focus nodes are validated against constraints too, aren't they? Or are they only validated if the shape is a sh:NodeShape?

I saw an example somewhere in the test suite which had something like this:

<NodeShape>
  sh:targetNode <TargetNode> ;
  sh:hasValue <TargetNode> .
HolgerKnublauch commented 6 years ago

Yes, if the shape is a node shape then the value nodes = the focus nodes, forming a set of 1 always.

MiguelAraCo commented 6 years ago

Ok, that makes perfect sense. Thanks!