diff --git a/shacl12-core/index.html b/shacl12-core/index.html index 80fc79a1..750ac581 100644 --- a/shacl12-core/index.html +++ b/shacl12-core/index.html @@ -2591,8 +2591,6 @@

Node Expressions

@@ -6812,238 +6810,6 @@

sh:reifierShape, sh:reificationRequired

-
-

sh:nodeByExpression

-

- sh:nodeByExpression specifies the condition that each value node conforms to the - node shapes produced by a node expression. - The evaluation of these node expressions is repeated for all value nodes of the shape - as the focus node. -

-

- Constraint Component IRI: sh:NodeByExpressionConstraintComponent -

- -
Parameters:
- - - - - - - - - -
PropertySummary and Syntax Rules
sh:nodeByExpression - The node shapes that all value nodes need to conform to. - The values of sh:nodeByExpression in a shape must be well-formed node expressions. -
-
-
TEXTUAL DEFINITION
-
-Let $expr be a value of sh:nodeByExpression. -For each value node v: perform a conformance check of -v against each output node of evalExpr(expr, -data graph, v, {}) s. A failure -MUST be produced if the conformance check of v against -s produces a failure. Otherwise, if v does -not conform to s, there is a validation result -with v as sh:value and a deep copy of -s as sh:sourceConstraint. -
-
-

The remainder of this section is informative.

-

- sh:nodeByExpression functions similarly to sh:node, but instead of referencing a fixed node shape, - a referenced node expression is used to dynamically compute the set of node shapes to which each value node must conform. -

-

- There are three key differences between sh:nodeByExpression and sh:node: -

    -
  1. - sh:nodeByExpression references a node expression instead of a fixed node shape as sh:node does. -
  2. -
  3. - sh:nodeByExpression cannot reference a node shape that is a blank node as a value like sh:node can, - as a blank node would be interpreted as a node expression. -
  4. -
  5. - Results generated by sh:nodeByExpression additionally include a value for `sh:sourceConstraint`. -
  6. - -
-

-

- Note that sh:node and sh:nodeByExpression exhibit the same behavior when given a value that is an IRI of a node shape. - In this case, sh:node directly validates against the specified node shape, whereas sh:nodeByExpression interprets the IRI - as an IRI expression that evaluates to a set containing the same node shape. -

-

- In the following example, all values of the property ex:address must fulfill the - constraints expressed by the shape ex:AddressShape. -

- -
@@ -7413,53 +7179,6 @@

sh:in

- -
-

sh:expression

-

- Based on node expressions, this section introduces a constraint component called - expression constraints. - Expression constraints can be used in any shape to declare the condition that the - node expression specified via sh:expression has true as its only output node. - The evaluation of these node expressions is repeated for all value nodes of the shape - as the focus node. -

-

- Constraint Component IRI: sh:ExpressionConstraintComponent -

- -
Parameters:
- - - - - - - - - - - -
PropertySummary and Syntax Rules
sh:expression - The node expression that must return true. - The values of sh:expression at a - shape must be well-formed node expressions. -
-
-
TEXTUAL DEFINITION
-
- Let $expr be a value of sh:expression. - For each value node v - where evalExpr(expr, data graph, v, {}) - does not return the list consisting of exactly true as its output nodes, - there is a validation result that has v as its sh:value - and a deep copy of $expr in the results graph as its sh:sourceConstraint. - If the $expr has values for sh:message in the shapes graph, - then these values become the (only) values for sh:resultMessage in the - validation result. -
-
-
@@ -7963,8 +7682,6 @@

Changes between SHACL 1.0 Core and SHACL 1.2 Core

  • Added the new constraint component sh:singleLine, see Issue 177
  • Added the new class sh:ShapeClass for implicit class targets; see Issue 212
  • Moved SPARQL-based validators from Core to an Appendix of SHACL-SPARQL; see Issue 271
  • -
  • Added the new constraint component sh:expression; see Issue 357
  • -
  • Added the new constraint component sh:nodeByExpression, see Issue 408
  • Added new List constraint components, see Issue 391 and Issue 414
  • Added the new value sh:ByTypes for sh:closed; see Issue 172
  • The values of sh:class and sh:datatype can now also be lists, indicating a union of choices; see Issue 160
  • diff --git a/shacl12-node-expr/index.html b/shacl12-node-expr/index.html index 6b462b67..3b48ad14 100644 --- a/shacl12-node-expr/index.html +++ b/shacl12-node-expr/index.html @@ -466,9 +466,11 @@

    Terminology

    property shape, SHACL property path, SPARQL property path, + data graph, shapes graph, target, validator, + validation result, node expression, node expression function, function name, @@ -477,6 +479,7 @@

    Terminology

    evaluation, evaluation failure, conform, + conformance check, failure, SHACL instance, SHACL subclass, @@ -484,6 +487,7 @@

    Terminology

    SHACL list, members, well-formed, + deep copy, as defined in the SHACL 1.2 Core specification [[!shacl12-core]]. @@ -517,6 +521,10 @@

    Document Conventions

    skos: http://www.w3.org/2004/02/skos/core# + + sparql: + http://www.w3.org/ns/sparql# + xsd: http://www.w3.org/2001/XMLSchema# @@ -2099,6 +2107,548 @@

    InstancesOf Expressions

    +
    +

    Constraint Components

    +

    + This section introduces SHACL constraint components that operate on node expressions. +

    + +
    +

    sh:expression

    +

    + Based on node expressions, this section introduces a constraint component called + expression constraints. + Expression constraints can be used in any shape to declare the condition that the + node expression specified via sh:expression has true as its only output node. + The evaluation of these node expressions is repeated for all value nodes of the shape + as the focus node. +

    +

    + Constraint Component IRI: sh:ExpressionConstraintComponent +

    + +
    Parameters:
    + + + + + + + + + + + + + +
    PropertySummary and Syntax Rules
    sh:expression + The node expression that must return true. + The values of sh:expression at a + shape must be well-formed node expressions. +
    +
    +
    TEXTUAL DEFINITION
    +
    + Let $expr be a value of sh:expression. + For each value node v + where evalExpr(expr, data graph, focusNode, {value: v}) + does not return the list consisting of exactly true as its output nodes, + there is a validation result that has v as its sh:value + and a deep copy of $expr in the results graph as its sh:sourceConstraint. +
    +
    +

    The remainder of this section is informative.

    +

    + Note that the scope in the evaluation of expression constraints contains the variable value + for the current value node while the variable focusNode is the focus node. +

    +

    + The following example uses some SPARQL-based node expressions to declare + the constraint that the values of ex:ibanNumber must start with the same two (upper-case) letters as + the values of the path ex:country/ex:code. +

    + +
    + +
    +

    sh:nodeByExpression

    +

    + sh:nodeByExpression specifies the condition that each value node conforms to the + node shapes produced by a node expression. + The evaluation of these node expressions is repeated for all value nodes of the shape + as the focus node. +

    +

    + Constraint Component IRI: sh:NodeByExpressionConstraintComponent +

    + +
    Parameters:
    + + + + + + + + + + + + + +
    PropertySummary and Syntax Rules
    sh:nodeByExpression + The node shapes that all value nodes need to conform to. + The values of sh:nodeByExpression in a shape must be well-formed node expressions. +
    +
    +
    TEXTUAL DEFINITION
    +
    + Let $expr be a value of sh:nodeByExpression. + For each value node v: perform a conformance check of + v against each output node of evalExpr(expr, + data graph, v, {}) s. A failure + MUST be produced if the conformance check of v against + s produces a failure. Otherwise, if v does + not conform to s, there is a validation result + with v as sh:value and a deep copy of + s as sh:sourceConstraint. +
    +
    +

    The remainder of this section is informative.

    +

    + sh:nodeByExpression functions similarly to sh:node, but instead of referencing a fixed node shape, + a referenced node expression is used to dynamically compute the set of node shapes to which each value node must conform. +

    +

    + There are three key differences between sh:nodeByExpression and sh:node: +

      +
    1. + sh:nodeByExpression references a node expression instead of a fixed node shape as sh:node does. +
    2. +
    3. + sh:nodeByExpression cannot reference a node shape that is a blank node as a value like sh:node can, + as a blank node would be interpreted as a node expression. +
    4. +
    5. + Results generated by sh:nodeByExpression additionally include a value for `sh:sourceConstraint`. +
    6. +
    +

    +

    + Note that sh:node and sh:nodeByExpression exhibit the same behavior when given a value that is an IRI of a node shape. + In this case, sh:node directly validates against the specified node shape, whereas sh:nodeByExpression interprets the IRI + as an IRI expression that evaluates to a set containing the same node shape. +

    +

    + The following example demonstrates how sh:nodeByExpression could be used in the context of the W3C Data Cube Vocabulary. + Building upon examples 5 and 6 from the Data Cube Vocabulary documentation, Data Structure Definition is extended with the property eg:hasShape, + which links to an associated node shape to which relevant qb:Observation instances must conform. + To validate that every qb:Observation instance conforms to the appropriate shape, sh:nodeByExpression with a Path Expression + is used to locate the shape at the property path qb:dataSet/qb:structure/eg:hasShape from each qb:Observation instance. +

    + +
    + +
    +

    Security Considerations

    TODO

    @@ -2119,7 +2669,8 @@

    Internationalization Considerations

    TODO

    -
    +
    +
    diff --git a/shacl12-test-suite/tests/core/node/manifest.ttl b/shacl12-test-suite/tests/core/node/manifest.ttl index cd60986c..330ca8a3 100644 --- a/shacl12-test-suite/tests/core/node/manifest.ttl +++ b/shacl12-test-suite/tests/core/node/manifest.ttl @@ -19,7 +19,6 @@ mf:include ; mf:include ; mf:include ; - mf:include ; mf:include ; mf:include ; mf:include ; diff --git a/shacl12-test-suite/tests/core/property/manifest.ttl b/shacl12-test-suite/tests/core/property/manifest.ttl index bac3782f..2fa08f5c 100644 --- a/shacl12-test-suite/tests/core/property/manifest.ttl +++ b/shacl12-test-suite/tests/core/property/manifest.ttl @@ -36,7 +36,6 @@ mf:include ; mf:include ; mf:include ; - mf:include ; mf:include ; mf:include ; mf:include ; diff --git a/shacl12-test-suite/tests/core/node/expression-001.ttl b/shacl12-test-suite/tests/node-expr/constraints/expression-001.ttl similarity index 89% rename from shacl12-test-suite/tests/core/node/expression-001.ttl rename to shacl12-test-suite/tests/node-expr/constraints/expression-001.ttl index c5313c90..414bfa7f 100644 --- a/shacl12-test-suite/tests/core/node/expression-001.ttl +++ b/shacl12-test-suite/tests/node-expr/constraints/expression-001.ttl @@ -16,7 +16,7 @@ ex:TestShape rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Test shape" ; - sh:expression false ; # Only using constant false here because Core doesn't define interesting node expressions + sh:expression false ; . <> rdf:type mf:Manifest ; diff --git a/shacl12-test-suite/tests/node-expr/constraints/manifest.ttl b/shacl12-test-suite/tests/node-expr/constraints/manifest.ttl new file mode 100644 index 00000000..5a5b2209 --- /dev/null +++ b/shacl12-test-suite/tests/node-expr/constraints/manifest.ttl @@ -0,0 +1,9 @@ +@prefix mf: . +@prefix rdfs: . +@prefix sht: . + +<> + a mf:Manifest ; + mf:include ; + mf:include ; + . \ No newline at end of file diff --git a/shacl12-test-suite/tests/core/property/nodeByExpression-001.ttl b/shacl12-test-suite/tests/node-expr/constraints/nodeByExpression-001.ttl similarity index 100% rename from shacl12-test-suite/tests/core/property/nodeByExpression-001.ttl rename to shacl12-test-suite/tests/node-expr/constraints/nodeByExpression-001.ttl diff --git a/shacl12-test-suite/tests/node-expr/manifest.ttl b/shacl12-test-suite/tests/node-expr/manifest.ttl new file mode 100644 index 00000000..0b60aa49 --- /dev/null +++ b/shacl12-test-suite/tests/node-expr/manifest.ttl @@ -0,0 +1,8 @@ +@prefix mf: . +@prefix rdfs: . +@prefix sht: . + +<> + a mf:Manifest ; + mf:include ; + . \ No newline at end of file