Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 165 additions & 97 deletions shacl12-node-expr/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,8 @@ <h3>If Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
ex:City
a sh:ShapeClass ;
sh:property ex:City-fillColor .
a sh:ShapeClass ;
sh:property ex:City-fillColor .

ex:City-fillColor
a sh:PropertyShape ;
Expand Down Expand Up @@ -1139,24 +1139,24 @@ <h3>Distinct Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
ex:ClassShape
a sh:NodeShape ;
sh:targetClass rdfs:Class ;
sh:property ex:ClassShape-superClassesIncludingRoot .
a sh:NodeShape ;
sh:targetClass rdfs:Class ;
sh:property ex:ClassShape-superClassesIncludingRoot .

ex:ClassShape-superClassesIncludingRoot
a sh:PropertyShape ;
sh:path ex:superClassesIncludingRoot ;
sh:description "The superclasses of this, always including rdfs:Resource." ;
sh:values <b>[
shnex:distinct [
shnex:union (
[
shnex:pathValues [ sh:zeroOrMorePath rdfs:subClassOf ] ;
]
( rdfs:Resource )
)
]</b> ;
] .
a sh:PropertyShape ;
sh:path ex:superClassesIncludingRoot ;
sh:description "The superclasses of this, always including rdfs:Resource." ;
sh:values <b>[
shnex:distinct [
shnex:union (
[
shnex:pathValues [ sh:zeroOrMorePath rdfs:subClassOf ] ;
]
( rdfs:Resource )
)
]</b> ;
] .
</div>
</div>
</aside>
Expand Down Expand Up @@ -1209,13 +1209,13 @@ <h3>Intersection Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
ex:DualCitizenShape
a sh:NodeShape ;
sh:targetNode <b>[
shnex:intersection (
[ shnex:instancesOf ex:Australian ]
[ shnex:instancesOf ex:German ]
)
]</b> .
a sh:NodeShape ;
sh:targetNode <b>[
shnex:intersection (
[ shnex:instancesOf ex:Australian ]
[ shnex:instancesOf ex:German ]
)
]</b> .
</div>
</div>
</aside>
Expand Down Expand Up @@ -1376,24 +1376,24 @@ <h3>Filter Shape Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
ex:Person
a sh:ShapeClass ;
sh:property ex:Person-maleChildren .
a sh:ShapeClass ;
sh:property ex:Person-maleChildren .

ex:Person-maleChildren
a sh:PropertyShape ;
sh:path ex:maleChildren ;
sh:class ex:Person ;
sh:values <b>[
shnex:nodes</b> [
shnex:pathValues ex:child ;
] ;
<b>shnex:filterShape [
sh:property [
sh:path ex:gender ;
sh:hasValue "male" ;
]
] ;
]</b> .
a sh:PropertyShape ;
sh:path ex:maleChildren ;
sh:class ex:Person ;
sh:values <b>[
shnex:nodes [
shnex:pathValues ex:child ;
] ;
shnex:filterShape [
sh:property [
sh:path ex:gender ;
sh:hasValue "male" ;
]
] ;
]</b> .
</div>
</div>
</aside>
Expand Down Expand Up @@ -1461,23 +1461,23 @@ <h3>Limit Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
ex:PersonShape
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:property ex:PersonShape-oldestTwoChildren .
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:property ex:PersonShape-oldestTwoChildren .

ex:PersonShape-oldestTwoChildren
a sh:PropertyShape ;
sh:path ex:oldestTwoChildren ;
sh:class ex:Person ;
sh:values <b>[
shnex:nodes</b> [
shnex:nodes [
shnex:pathValues ex:child ;
] ;
shnex:orderBy ex:dateOfBirth ;
] ;
<b>shnex:limit 2 ;
]</b> .
a sh:PropertyShape ;
sh:path ex:oldestTwoChildren ;
sh:class ex:Person ;
sh:values <b>[
shnex:nodes [
shnex:nodes [
shnex:pathValues ex:child ;
] ;
shnex:orderBy ex:dateOfBirth ;
] ;
shnex:limit 2 ;
]</b> .
</div>
</div>
</aside>
Expand Down Expand Up @@ -1545,23 +1545,23 @@ <h3>Offset Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
ex:PersonShape
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:property ex:PersonShape-remainingChildren .
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:property ex:PersonShape-remainingChildren .

ex:PersonShape-remainingChildren
a sh:PropertyShape ;
sh:path ex:remainingChildren ;
sh:class ex:Person ;
sh:values <b>[
shnex:nodes</b> [
shnex:nodes [
shnex:pathValues ex:child ;
] ;
shnex:orderBy ex:dateOfBirth ;
] ;
<b>shnex:offset 1 ;
]</b> .
a sh:PropertyShape ;
sh:path ex:remainingChildren ;
sh:class ex:Person ;
sh:values <b>[
shnex:nodes [
shnex:nodes [
shnex:pathValues ex:child ;
] ;
shnex:orderBy ex:dateOfBirth ;
] ;
shnex:offset 1 ;
]</b> .
</div>
</div>
</aside>
Expand Down Expand Up @@ -1627,21 +1627,21 @@ <h3>Count Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
skos:ConceptScheme
a rdfs:Class, sh:NodeShape ;
sh:property skos:ConceptScheme-topConceptCount .
a rdfs:Class, sh:NodeShape ;
sh:property skos:ConceptScheme-topConceptCount .

skos:ConceptScheme-topConceptCount
a sh:PropertyShape ;
sh:path ex:topConceptCount ;
sh:datatype xsd:integer ;
sh:description "The number of top concepts in this scheme." ;
sh:maxCount 1 ;
sh:name "top concept count" ;
sh:values [
shnex:count [
shnex:pathValues skos:hasTopConcept ;
] ;
] .
a sh:PropertyShape ;
sh:path ex:topConceptCount ;
sh:datatype xsd:integer ;
sh:description "The number of top concepts in this scheme." ;
sh:maxCount 1 ;
sh:name "top concept count" ;
sh:values <b>[
shnex:count [
shnex:pathValues skos:hasTopConcept ;
] ;
]</b> .
</div>
</div>
</aside>
Expand Down Expand Up @@ -1697,21 +1697,21 @@ <h3>Min Expressions</h3>
<div class="shapes-graph">
<div class="turtle">
ex:CompanyShape
a sh:NodeShape ;
sh:targetClass ex:Company ;
sh:property ex:CompanyShape-minStartDate .
a sh:NodeShape ;
sh:targetClass ex:Company ;
sh:property ex:CompanyShape-minStartDate .

ex:CompanyShape-minStartDate
a sh:PropertyShape ;
sh:path ex:minStartDate ;
sh:datatype xsd:date ;
sh:maxCount 1 ;
sh:name "min start date" ;
sh:values [
shnex:min [
shnex:pathValues ( ex:employee ex:startDate ) ;
] ;
] .
a sh:PropertyShape ;
sh:path ex:minStartDate ;
sh:datatype xsd:date ;
sh:maxCount 1 ;
sh:name "min start date" ;
sh:values <b>[
shnex:min [
shnex:pathValues ( ex:employee ex:startDate ) ;
] ;
]</b> .
</div>
</div>
</aside>
Expand Down Expand Up @@ -1867,6 +1867,74 @@ <h3>InstancesOf Expressions</h3>
</p>
</section>

<section id="NodesWhereExpression">
<h3>Nodes Where Expressions</h3>
<p class="syntax">
<span data-syntax-rule="NodesWhereExpression-syntax">
A <a>blank node</a> that is the <a>subject</a> of the following properties
is called a <dfn>nodes where expression</dfn> with the <a>function name</a> <code>shnex:NodesWhereExpression</code>:
<table class="term-table">
<thead>
<th>Property</th>
<th>Constraints</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td><b><code>shnex:nodesWhere</code></b></td>
<td>
<code>sh:nodeKind sh:BlankNodeOrIRI</code><br/>
<span>Must be a <a>well-formed</a> <a>shape</a>.</span>
</td>
<td>
The shape that the <a>output nodes</a> must conform to.
</td>
</tr>
</tbody>
</table>
</span>
</p>
<div class="def" id="WhereExpression-evaluation">
<div class="def-header">EVALUATION OF NODES WHERE EXPRESSIONS</div>
<p>
Let <code>shape</code> be the <a>value</a> of <code>shnex:nodesWhere</code> in a <a>nodes where expression</a>.
The <a>output nodes</a> of the <a>nodes where expression</a> are the <a>nodes</a> in the <a>focus graph</a>
that <a>conform</a> to <code>shape</code>.
</p>
</div>
<p><em>The remainder of this section is informative.</em></p>
<p>
Users of this node expression function should be aware that the list of output nodes may be very large
and that some implementations may not be able to efficiently process it.
</p>
<p>
The following example illustrates the use of <code>shnex:nodesWhere</code> to compute all instances of
<code>ex:Company</code> that have at least 100 employees.
</p>
<aside class="example" id="nodes-where-example">
<div class="shapes-graph">
<div class="turtle">
ex:LargeCompanyShape
a sh:NodeShape ;
sh:targetNode <b>[
shnex:nodesWhere [
sh:class ex:Company ;
sh:property [
sh:path ex:employee ;
sh:minCount 100 ;
]
]
]</b> .
</div>
</div>
</aside>
<p>
The interpretation of <code>shnex:nodesWhere</code> is similar to <code>sh:targetWhere</code>.
The main differences are that <code>sh:targetWhere</code> is part of SHACL Core and that
<code>shnex:nodesWhere</code> can be used in arbitrary node expressions.
</p>
</section>

</section>

</section>
Expand Down
26 changes: 26 additions & 0 deletions shacl12-vocabularies/shnex.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,32 @@ shnex:minus
.


# Nodes Where Expressions -----------------------------------------------------

shnex:NodesWhereExpression
a sh:NamedParameterExpressionFunction ;
rdfs:label "Nodes where expression"@en ;
rdfs:comment "A SHACL node expression that returns the nodes that conform to a given shape."@en ;
rdfs:subClassOf sh:NamedParameterExpression ;
sh:parameter shnex:NodesWhereExpression-where ;
rdfs:isDefinedBy shnex: ;
.
shnex:NodesWhereExpression-nodesWhere
a sh:Parameter ;
sh:path shnex:nodesWhere ;
sh:keyParameter true ;
rdfs:isDefinedBy shnex: ;
.
shnex:nodesWhere
a rdf:Property ;
rdfs:label "nodes where"@en ;
rdfs:comment "In Nodes Where Expressions, this property specifies the shape of which conforming nodes shall be returned."@en ;
rdfs:domain shnex:NodesWhereExpression ;
rdfs:range sh:Shape ;
rdfs:isDefinedBy shnex: ;
.


# Offset Expressions ----------------------------------------------------------

shnex:OffsetExpression
Expand Down