You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: shacl12-core/index.html
+236-1Lines changed: 236 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2531,6 +2531,7 @@ <h2>Node Expressions</h2>
2531
2531
<ul>
2532
2532
<li>At <ahref="#property-shapes"><code>sh:values</code> and <code>sh:defaultValue</code></a> to derive the value nodes of a property shape.</li>
2533
2533
<li>At <ahref="#targetNode"><code>sh:targetNode</code></a> to dynamically compute the targets of a shape.</li>
2534
+
<li>At <ahref="#NodeByExpressionConstraintComponent"><code>sh:nodeByExpression</code></a> to validate nodes against a dynamically computed set of node shapes.</li>
2534
2535
<li>At <ahref="#ExpressionConstraintComponent"><code>sh:expression</code></a> to validate nodes against a condition.</li>
2535
2536
<li>At <ahref="#deactivated"><code>sh:deactivated</code></a> to deactivate certain shapes under specific conditions.</li>
The <a>node shapes</a> that all value nodes need to conform to.
6651
+
<spandata-syntax-rule="nodeByExpression-scope">The <a>values</a> of <code>sh:nodeByExpression</code> in a shape must be <a>well-formed</a><a>node expressions</a>.</span>
Let <code>$expr</code> be a <a>value</a> of <code>sh:nodeByExpression</code>.
6659
+
For each <a>value node</a><code>v</code>: perform a <a>conformance check</a> of
6660
+
<code>v</code> against each <a>output node</a> of <code>evalExpr(expr,
6661
+
<a>data graph</a>, v, {})</code><code>s</code>. A <a>failure</a>
6662
+
MUST be produced if the <a>conformance check</a> of <code>v</code> against
6663
+
<code>s</code> produces a <a>failure</a>. Otherwise, if <code>v</code> does
6664
+
not <a>conform</a> to <code>s</code>, there is a <a>validation result</a>
6665
+
with <code>v</code> as <code>sh:value</code> and a <a>deep copy</a> of
6666
+
<code>s</code> as <code>sh:sourceConstraint</code>.
6667
+
</div>
6668
+
</div>
6669
+
<p><em>The remainder of this section is informative.</em></p>
6670
+
<p>
6671
+
<code>sh:nodeByExpression</code> functions similarly to <code>sh:node</code>, but instead of referencing a fixed <a>node shape</a>,
6672
+
a referenced <a>node expression</a> is used to dynamically compute the set of <a>node shapes</a> to which each <a>value node</a> must conform.
6673
+
</p>
6674
+
<p>
6675
+
There are three key differences between <code>sh:nodeByExpression</code> and <ahref="#NodeConstraintComponent"><code>sh:node</code></a>:
6676
+
<ol>
6677
+
<li>
6678
+
<code>sh:nodeByExpression</code> references a <a>node expression</a> instead of a fixed <a>node shape</a> as <code>sh:node</code> does.
6679
+
</li>
6680
+
<li>
6681
+
<code>sh:nodeByExpression</code> cannot reference a <a>node shape</a> that is a <a>blank node</a> as a value like <code>sh:node</code> can,
6682
+
as a <a>blank node</a> would be interpreted as a <a>node expression</a>.
6683
+
</li>
6684
+
<li>
6685
+
<a>Results</a> generated by <code>sh:nodeByExpression</code> additionally include a value for `sh:sourceConstraint`.
6686
+
</li>
6687
+
6688
+
</ol>
6689
+
</p>
6690
+
<p>
6691
+
Note that <code>sh:node</code> and <code>sh:nodeByExpression</code> exhibit the same behavior when given a <a>value</a> that is an <a>IRI</a> of a <a>node shape</a>.
6692
+
In this case, <code>sh:node</code> directly validates against the specified <a>node shape</a>, whereas <code>sh:nodeByExpression</code> interprets the <a>IRI</a>
6693
+
as an <a>IRI expression</a> that evaluates to a set containing the same <a>node shape</a>.
6694
+
</p>
6695
+
<p>
6696
+
In the following example, all values of the property <code>ex:address</code> must fulfill the
6697
+
constraints expressed by the <a>shape</a><code>ex:AddressShape</code>.
"sh:resultMessage": "Value does not conform to shape ex:AddressShape.",
6837
+
"sh:resultPath": {
6838
+
"@id": "ex:address"
6839
+
},
6840
+
"sh:resultSeverity": {
6841
+
"@id": "sh:Violation"
6842
+
},
6843
+
"sh:sourceConstraint": {
6844
+
"@id": "ex:AddressShape"
6845
+
},
6846
+
"sh:sourceConstraintComponent": {
6847
+
"@id": "sh:NodeByExpressionConstraintComponent"
6848
+
},
6849
+
"sh:sourceShape": {
6850
+
"@id": "_:b66_b1"
6851
+
},
6852
+
"sh:value": {
6853
+
"@id": "ex:RetosAddress"
6854
+
}
6855
+
}
6622
6856
}</pre>
6623
6857
</div>
6624
6858
</div>
@@ -7525,6 +7759,7 @@ <h2>Changes between SHACL 1.0 Core and SHACL 1.2 Core</h2>
7525
7759
<li>Added the new class <ahref="#ShapeClass"><code>sh:ShapeClass</code></a> for implicit class targets; see <ahref="https://github.com/w3c/data-shapes/issues/212">Issue 212</a></li>
7526
7760
<li>Moved SPARQL-based validators from Core to an Appendix of SHACL-SPARQL; see <ahref="https://github.com/w3c/data-shapes/issues/271">Issue 271</a></li>
7527
7761
<li>Added the new constraint component <ahref="#ExpressionConstraintComponent"><code>sh:expression</code></a>; see <ahref="https://github.com/w3c/data-shapes/issues/357">Issue 357</a></li>
7762
+
<li>Added the new constraint component <ahref="#NodeByExpressionConstraintComponent"><code>sh:nodeByExpression</code></a>, see <ahref="https://github.com/w3c/data-shapes/issues/408">Issue 408</a></li>
7528
7763
<li>Added the new value <code>sh:ByTypes</code> for <ahref="#ClosedConstraintComponent"><code>sh:closed</code></a>; see <ahref="https://github.com/w3c/data-shapes/issues/172">Issue 172</a></li>
7529
7764
<li>The values of <ahref="#ClassConstraintComponent"><code>sh:class</code></a> and <ahref="#DatatypeConstraintComponent"><code>sh:datatype</code></a> can now also be lists, indicating a union of choices; see <ahref="https://github.com/w3c/data-shapes/issues/160">Issue 160</a></li>
0 commit comments