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 @@
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 @@
-
+
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
:
Property
@@ -1083,7 +1083,7 @@ Path Expressions
-
+ shnex:path
shnex:pathValues
Must be a well-formed SHACL property path.
@@ -1092,41 +1092,49 @@ Path Expressions
-
+ shnex:nodes
shnex: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.
- 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.
-
-TODO: Add second example that uses shnex:nodes
A blank node that is the subject of the following properties
- is called a filterShape expression with the function name
Let
Note that TODO: Find good example, or drop the feature if none makes senseshnex:FilterShapeExpression
:
+ is called a filter shape expression with the function name shnex:FilterShapeExpression
:
Property
@@ -1575,11 +1605,11 @@ FilterShape Expressions
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.
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 ;
] ;
] .
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
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.
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.
sh:nodeByExpression
a sh:NodeShape ;
sh:targetClass qb:Observation ;
sh:nodeByExpression [
- shnex:path (qb:dataSet qb:structure eg:hasShape) ;
+ shnex:pathValues (qb:dataSet qb:structure eg:hasShape) ;
] .
sh:nodeByExpression
"@id": "qb:Observation"
},
"sh:nodeByExpression": {
- "shnex:path": {
+ "shnex:pathValues": {
"@list": [
{
"@id": "qb:dataSet"
diff --git a/shacl12-vocabularies/shnex.ttl b/shacl12-vocabularies/shnex.ttl
index b5e7736e..b46e83e0 100644
--- a/shacl12-vocabularies/shnex.ttl
+++ b/shacl12-vocabularies/shnex.ttl
@@ -108,11 +108,11 @@ shnex:exists
.
-# FilterShape Expressions -----------------------------------------------------
+# Filter Shape Expressions ----------------------------------------------------
shnex:FilterShapeExpression
a sh:NamedParameterExpressionFunction ;
- rdfs:label "FilterShape expression"@en ;
+ rdfs:label "Filter shape expression"@en ;
rdfs:comment "A SHACL node expression that returns the values of a given node expression (sh:nodes) except for those that do not conform to a given filter shape."@en ;
rdfs:subClassOf sh:NamedParameterExpression ;
sh:parameter shnex:FilterShapeExpression-filterShape ;
@@ -423,36 +423,36 @@ shnex:offset
.
-# Path Expressions ------------------------------------------------------------
+# Path Values Expressions -----------------------------------------------------
-shnex:PathExpression
+shnex:PathValuesExpression
a sh:NamedParameterExpressionFunction ;
- rdfs:label "Path expression"@en ;
- rdfs:comment "A SHACL node expression that returns the values of a given property path at the focus node, or a list of provided focus nodes."@en ;
+ rdfs:label "Path values expression"@en ;
+ rdfs:comment "A SHACL node expression that returns the values of a given property path at the current focus node, or a computed focus node."@en ;
rdfs:subClassOf sh:NamedParameterExpression ;
- sh:parameter shnex:PathExpression-path ;
- sh:parameter shnex:PathExpression-nodes ;
+ sh:parameter shnex:PathValuesExpression-pathValues ;
+ sh:parameter shnex:PathValuesExpression-focusNode ;
rdfs:isDefinedBy shnex: ;
.
-shnex:PathExpression-path
+shnex:PathValuesExpression-pathValues
a sh:Parameter ;
- sh:path shnex:path ;
+ sh:path shnex:pathValues ;
sh:keyParameter true ;
rdfs:isDefinedBy shnex: ;
.
-shnex:PathExpression-nodes
+shnex:PathValuesExpression-focusNode
a sh:Parameter ;
- sh:path shnex:nodes ;
- sh:name "focus nodes"@en ;
- sh:description "An optional node expression that produces the focus node(s)."@en ;
+ sh:path shnex:focusNode ;
+ sh:name "focus node"@en ;
+ sh:description "An optional node expression that produces the focus node."@en ;
sh:optional true ;
rdfs:isDefinedBy shnex: ;
.
-shnex:path
+shnex:pathValues
a rdf:Property ;
- rdfs:label "path"@en ;
- rdfs:comment "In Path Expressions, this property specifies the property path."@en ;
- rdfs:domain shnex:PathExpression ;
+ rdfs:label "path values"@en ;
+ rdfs:comment "In Path Values Expressions, this property specifies the property path."@en ;
+ rdfs:domain shnex:PathValuesExpression ;
rdfs:isDefinedBy shnex: ;
.