Skip to content

Commit 6376bfa

Browse files
committed
Include sh:nodeByExpression example in the core spec scoped to the core spec
1 parent a355688 commit 6376bfa

File tree

1 file changed

+163
-2
lines changed

1 file changed

+163
-2
lines changed

shacl12-core/index.html

Lines changed: 163 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6693,9 +6693,170 @@ <h4>sh:nodeByExpression</h4>
66936693
as an <a>IRI expression</a> that evaluates to a set containing the same <a>node shape</a>.
66946694
</p>
66956695
<p>
6696-
For a simple example of its use, refer to the example for <a href="#NodeConstraintComponent"><code>sh:node</code></a>,
6697-
replacing `sh:node` with `sh:nodeByExpression`.
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>.
66986698
</p>
6699+
<aside class="example">
6700+
<div class="shapes-graph">
6701+
<div class="turtle">
6702+
ex:AddressShape
6703+
a sh:NodeShape ;
6704+
sh:property [
6705+
sh:path ex:postalCode ;
6706+
sh:datatype xsd:string ;
6707+
sh:maxCount 1 ;
6708+
] .
6709+
6710+
ex:PersonShape
6711+
a sh:NodeShape ;
6712+
<span class="target-can-be-skipped">sh:targetClass ex:Person ;</span>
6713+
sh:property [ # _:b1
6714+
sh:path ex:address ;
6715+
sh:minCount 1 ;
6716+
sh:nodeByExpression ex:AddressShape ;
6717+
] .
6718+
</div>
6719+
<div class="jsonld">
6720+
<pre class="jsonld">{
6721+
"@graph": [
6722+
{
6723+
"@id": "ex:AddressShape",
6724+
"@type": "sh:NodeShape",
6725+
"sh:property": {
6726+
"sh:datatype": {
6727+
"@id": "xsd:string"
6728+
},
6729+
"sh:maxCount": {
6730+
"@type": "xsd:integer",
6731+
"@value": "1"
6732+
},
6733+
"sh:path": {
6734+
"@id": "ex:postalCode"
6735+
}
6736+
}
6737+
},
6738+
{
6739+
"@id": "ex:PersonShape",
6740+
"@type": "sh:NodeShape",
6741+
"sh:property": {
6742+
"sh:minCount": {
6743+
"@type": "xsd:integer",
6744+
"@value": "1"
6745+
},
6746+
"sh:nodeByExpression": {
6747+
"@id": "ex:AddressShape"
6748+
},
6749+
"sh:path": {
6750+
"@id": "ex:address"
6751+
}
6752+
},
6753+
"sh:targetClass": {
6754+
"@id": "ex:Person"
6755+
}
6756+
}
6757+
]
6758+
}</pre>
6759+
</div>
6760+
</div>
6761+
<div class="data-graph">
6762+
<div class="turtle">
6763+
ex:Bob a ex:Person ;
6764+
ex:address ex:BobsAddress .
6765+
6766+
ex:BobsAddress
6767+
ex:postalCode "1234" .
6768+
6769+
<span class="focus-node-error">ex:Reto</span> a ex:Person ;
6770+
ex:address ex:RetosAddress .
6771+
6772+
ex:RetosAddress
6773+
ex:postalCode 5678 .
6774+
</div>
6775+
<div class="jsonld">
6776+
<pre class="jsonld">{
6777+
"@graph": [
6778+
{
6779+
"@id": "ex:Bob",
6780+
"@type": "ex:Person",
6781+
"ex:address": {
6782+
"@id": "ex:BobsAddress"
6783+
}
6784+
},
6785+
{
6786+
"@id": "ex:BobsAddress",
6787+
"ex:postalCode": "1234"
6788+
},
6789+
{
6790+
"@id": "ex:Reto",
6791+
"@type": "ex:Person",
6792+
"ex:address": {
6793+
"@id": "ex:RetosAddress"
6794+
}
6795+
},
6796+
{
6797+
"@id": "ex:RetosAddress",
6798+
"ex:postalCode": {
6799+
"@type": "xsd:integer",
6800+
"@value": "5678"
6801+
}
6802+
}
6803+
]
6804+
}</pre>
6805+
</div>
6806+
</div>
6807+
<div class="results-graph">
6808+
<div class="turtle">
6809+
[ a sh:ValidationReport ;
6810+
sh:conforms false ;
6811+
sh:result [
6812+
a sh:ValidationResult ;
6813+
sh:resultSeverity sh:Violation ;
6814+
sh:focusNode ex:Reto ;
6815+
sh:resultPath ex:address ;
6816+
sh:value ex:RetosAddress ;
6817+
sh:resultMessage "Value does not conform to shape ex:AddressShape." ;
6818+
sh:sourceConstraint ex:AddressShape ;
6819+
sh:sourceConstraintComponent sh:NodeByExpressionConstraintComponent ;
6820+
sh:sourceShape _:b1 ;
6821+
]
6822+
] .
6823+
</div>
6824+
<div class="jsonld">
6825+
<pre class="jsonld">{
6826+
"@type": "sh:ValidationReport",
6827+
"sh:conforms": {
6828+
"@type": "xsd:boolean",
6829+
"@value": "false"
6830+
},
6831+
"sh:result": {
6832+
"@type": "sh:ValidationResult",
6833+
"sh:focusNode": {
6834+
"@id": "ex:Reto"
6835+
},
6836+
"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+
}
6856+
}</pre>
6857+
</div>
6858+
</div>
6859+
</aside>
66996860
</section>
67006861
</section>
67016862

0 commit comments

Comments
 (0)