diff --git a/shacl12-node-expr/index.html b/shacl12-node-expr/index.html index 0200737a..be9a2735 100644 --- a/shacl12-node-expr/index.html +++ b/shacl12-node-expr/index.html @@ -600,8 +600,8 @@

Getting started with Node Expressions

The following diagram illustrates how this node expression is interpreted, from a logical point of view. During validation, a SHACL processor will determine the target nodes of the shape - by evaluating the filterShape expression. - However, the filterShape expression first evaluates its input expression, which is specified via sh:nodes + by evaluating the filter shape expression. + However, the filter shape expression first evaluates its input expression, which is specified via sh:nodes and is an instancesOf expression. This will produce all instances of the given class, ex:Company. The shnex:filterShape is then applied to all of these instances, to keep only the companies @@ -669,7 +669,7 @@

Getting started with Node Expressions

sh:datatype xsd:integer ; sh:values [ shnex:count [ - shnex:path ex:employee ; + shnex:pathValues ex:employee ; ] ] . @@ -859,14 +859,14 @@

List Parameter Functions

sh:values [ ex:coalesce ( [ - # This is a path expression that is expected to return zero or one values - shnex:path ex:fullName ; + # This is a path values expression that is expected to return zero or one values + shnex:pathValues ex:fullName ; ] [ ex:concat ( - [ shnex:path ex:firstName ] # Path expression with at most one value + [ shnex:pathValues ex:firstName ] # Path values expression with at most one value " " # A constant literal expression - [ shnex:path ex:lastName ] # Path expression with at most one value + [ shnex:pathValues ex:lastName ] # Path values expression with at most one value ) ] ) @@ -1055,7 +1055,7 @@

List Expressions

sh:values [ shnex:nodes [ # This returns all transitive superclasses of the current focus node - shnex:path [ sh:zeroOrMorePath rdfs:subClassOf ] ; + shnex:pathValues [ sh:zeroOrMorePath rdfs:subClassOf ] ; ] ; # This removes any superclasses that are in the list below shnex:minus ( owl:Thing rdfs:Resource ) ; @@ -1069,12 +1069,12 @@

List Expressions

-
-

Path Expressions

+
+

Path Values Expressions

- + A blank node that is the subject of the following properties - is called a path expression with the function name shnex:PathExpression: + is called a path values expression with the function name shnex:PathValuesExpression: @@ -1083,7 +1083,7 @@

Path Expressions

- + @@ -1092,41 +1092,49 @@

Path Expressions

- +
Property
shnex:pathshnex:pathValues Must be a well-formed SHACL property path.
shnex:nodesshnex:focusNode Optional, must be a well-formed node expression. - A node expression producing the focus nodes, defaulting - to the current focus node from the evaluation context. + A node expression producing the focus node, + defaulting to the current focus node from the evaluation context.

-
-
EVALUATION OF PATH EXPRESSIONS
+
+
EVALUATION OF PATH VALUES EXPRESSIONS

- Let path be the value of shnex:path, - and nodes be the value of shnex:nodes in the path expression. - If shnex:nodes is not given, nodes is the list consistent of exactly the focus node. - Let N be the nodes produced by evalExpr(nodes, focusGraph, focusNode, scope). - The output nodes of the path expression are the list of nodes produced by concatenating - the value nodes of the path at each node in N. - TODO: Clarify if those can contain duplicates. + Let $pathValues be the value of shnex:pathValues, + and $focusNode be the value of shnex:focusNode in a path values expression. + If shnex:focusNode is not given, $focusNode is the list consisting of exactly the focus node + from the evaluation context.

+ Let N be the nodes produced by evalExpr($focusNode, focusGraph, focusNode, scope). + If N has 0 members, then the output nodes are the empty list. + If N has more than 1 member, an evaluation failure is reported. + Otherwise, the output nodes of the path values expression are the list of value nodes of the path + for the (only) member of N.

The remainder of this section is informative.

- The following example illustrates the use of a path expression to compute the value + Note that by definition, the value nodes of a property shape may be derived properties, + based on sh:values or sh:defaultValue expressions. + This means that if the provided shnex:pathValues path is an IRI, then a path values expression + may cause the evaluation of other node expressions, as a simple kind of rule chaining. +

+

+ The following example illustrates the use of a path values expression to compute the value of the property ex:topConceptCount. - The path expression returns the values of skos:hasTopConcept at each skos:ConceptScheme - and these are processed by the shnex:count to return the + The expression returns the values of skos:hasTopConcept for the current skos:ConceptScheme + and these values are processed by the shnex:count to return the number of top concepts.

-

@@ -1279,15 +1309,15 @@

If Expressions

sh:path ex:fillColor ; sh:datatype xsd:string ; sh:name "fill color" ; - sh:values [ - shnex:if [ + sh:values [ + shnex:if [ shnex:exists [ - shnex:path ex:capitalOf ; + shnex:pathValues ex:capitalOf ; ] ; ] ; shnex:then "blue" ; - shnex:else "red" ; - ] . + shnex:else "red" ; + ] .
TODO @@ -1360,16 +1390,16 @@

Distinct Expressions

a sh:PropertyShape ; sh:path ex:superClassesIncludingRoot ; sh:description "The superclasses of this, always including rdfs:Resource." ; - sh:values [ - shnex:distinct [ + sh:values [ + shnex:distinct [ shnex:union ( [ - shnex:path [ sh:zeroOrMorePath rdfs:subClassOf ] ; + shnex:pathValues [ sh:zeroOrMorePath rdfs:subClassOf ] ; ] ( rdfs:Resource ) ) - ] ; - ] . + ]
; + ] .
TODO @@ -1426,12 +1456,12 @@

Intersection Expressions

ex:DualCitizenShape a sh:NodeShape ; - sh:targetNode [ - shnex:intersection ( + sh:targetNode [ + shnex:intersection ( [ shnex:instancesOf ex:Australian ] [ shnex:instancesOf ex:German ] - ) - ] . + ) + ] .
TODO @@ -1540,11 +1570,11 @@

Minus Expressions

-

FilterShape Expressions

+

Filter Shape Expressions

A blank node that is the subject of the following properties - is called a filterShape expression with the function name shnex:FilterShapeExpression: + is called a filter shape expression with the function name shnex:FilterShapeExpression: @@ -1575,11 +1605,11 @@

FilterShape Expressions

-
EVALUATION OF FILTERSHAPE EXPRESSIONS
+
EVALUATION OF FILTER SHAPE EXPRESSIONS

Let filterShape be the value of shnex:filterShape, - and nodes be the value of shnex:nodes in a filterShape expression. - The output nodes of the filterShape expression are the output nodes of + and nodes be the value of shnex:nodes in a filter shape expression. + The output nodes of the filter shape expression are the output nodes of evalExpr(nodes, focusGraph, focusNode, scope) except those that do not conform to the shape filterShape, preserving the order in the list.

@@ -1604,7 +1634,7 @@

FilterShape Expressions

sh:class ex:Person ; sh:values [ shnex:nodes [ - shnex:path ex:child ; + shnex:pathValues ex:child ; ] ; shnex:filterShape [ sh:property [ @@ -1694,7 +1724,7 @@

Limit Expressions

sh:values [ shnex:nodes [ shnex:nodes [ - shnex:path ex:child ; + shnex:pathValues ex:child ; ] ; shnex:orderBy ex:dateOfBirth ; ] ; @@ -1781,7 +1811,7 @@

Offset Expressions

sh:values [ shnex:nodes [ shnex:nodes [ - shnex:path ex:child ; + shnex:pathValues ex:child ; ] ; shnex:orderBy ex:dateOfBirth ; ] ; @@ -1867,7 +1897,7 @@

Count Expressions

sh:name "top concept count" ; sh:values [ shnex:count [ - shnex:path skos:hasTopConcept ; + shnex:pathValues skos:hasTopConcept ; ] ; ] .
@@ -1940,7 +1970,7 @@

Min Expressions

sh:name "min start date" ; sh:values [ shnex:min [ - shnex:path ( ex:employee ex:startDate ) ; + shnex:pathValues ( ex:employee ex:startDate ) ; ] ; ] . @@ -2035,8 +2065,8 @@

Sum Expressions

Note that shnex:sum needs to be used with care and may be often misunderstood, when used with property paths. - The problem is that when a path expression is used as input to a sum expression, - the path expression will have eliminated duplicates before they can be processed by the shnex:sum. + The problem is that when a path values expression is used as input to a sum expression, + the path values expression will have eliminated duplicates before they can be processed by the shnex:sum. As a result, only the distinct values will be added up.

TODO: Find good example, or drop the feature if none makes sense

@@ -2183,7 +2213,7 @@

sh:expression

[ sparql:ucase ( [ - shnex:path ( ex:country ex:code ) + shnex:pathValues ( ex:country ex:code ) shnex:nodes [ shnex:var "focusNode" ] ] ) @@ -2292,7 +2322,7 @@

sh:nodeByExpression

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 + To validate that every qb:Observation instance conforms to the appropriate shape, sh:nodeByExpression with a path values expression is used to locate the shape at the property path qb:dataSet/qb:structure/eg:hasShape from each qb:Observation instance.

Property