Skip to content

Commit f8242fc

Browse files
committed
#300: Added support for RDF 1.2 triple terms
1 parent 0773d54 commit f8242fc

File tree

5 files changed

+260
-0
lines changed

5 files changed

+260
-0
lines changed

shacl12-core/index.html

+94
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,8 @@ <h3>Terminology</h3>
495495
<dfn data-cite="rdf12-concepts#dfn-literal" data-lt="literal|literals">literal</dfn>,
496496
<dfn data-cite="rdf12-concepts#dfn-datatype" data-lt="datatype">datatype</dfn>,
497497
<dfn data-cite="rdf12-concepts#dfn-blank-node" data-lt="blank node|blank nodes">blank node</dfn>,
498+
<dfn data-cite="rdf12-concepts#dfn-triple-term" data-lt="triple term|triple terms">triple term</dfn>,
499+
<dfn data-cite="rdf12-concepts#dfn-reifier" data-lt="reifier">reifier</dfn>,
498500
<dfn data-cite="rdf12-concepts#dfn-node" data-lt="node|nodes">node</dfn> of an RDF graph,
499501
<dfn data-cite="rdf12-concepts#dfn-rdf-term" data-lt="term|terms">RDF term</dfn>,
500502
<dfn data-cite="rdf12-concepts#dfn-subject" data-lt="subject|subjects">subject</dfn>,
@@ -5683,6 +5685,98 @@ <h4>sh:qualifiedValueShape, sh:qualifiedMinCount, sh:qualifiedMaxCount</h4>
56835685
</div>
56845686
</aside>
56855687
</section>
5688+
5689+
<section id="ReifiableByShapeConstraintComponent">
5690+
<h4>sh:reifiableBy, sh:reificationRequired</h4>
5691+
<p>
5692+
<code>sh:reifiableBy</code> can be used to link a <a>property shape</a> with one or more <a>node shapes</a>.
5693+
Any reified statement must conform to these node shapes.
5694+
</p>
5695+
5696+
<div class="parameters">Parameters:</div>
5697+
<table class="term-table">
5698+
<tr>
5699+
<th>Property</th>
5700+
<th>Summary and Syntax Rules</th>
5701+
</tr>
5702+
<tr>
5703+
<td><code>sh:reifiableBy</code></td>
5704+
<td>
5705+
The <a>node shape</a> that the reified statement must conform to.
5706+
<span data-syntax-rule="reifiableBy-node">The values of <code>sh:reifiableBy</code> must be <a>well-formed</a> <a>node shapes</a>.</span>
5707+
</td>
5708+
</tr>
5709+
<tr>
5710+
<td><code>sh:reificationRequired</code></td>
5711+
<td>
5712+
This is an <a>optional parameter</a> of <code>sh:ReifiableByConstraintComponent</code>.
5713+
If set to <code>true</code> there must be at least one reification value for the focus node/path combination in the <a>data graph</a>.
5714+
<span data-syntax-rule="reificationRequired-datatype">The values of <code>sh:reificationRequired</code> in a shape are literals with datatype <code>xsd:boolean</code>.</span>
5715+
</td>
5716+
</tr>
5717+
</table>
5718+
5719+
<div class="def def-text">
5720+
<div class="def-header">TEXTUAL DEFINITION</div>
5721+
<div class="def-text-body" data-validator="ReifiableBy">
5722+
Let <code>t</code> be the <a>triple terms</a> of the triples obtained from the last traversal step when following the <code>$path</code> <a>SHACL property path</a> of the <a>property shape</a> from the <a>focus node</a> to the <a>value node</a>.
5723+
For each reified statement for the <a>triple terms</a> <code>t</code>, a failure MUST be produced if the validation of the reified statement with the <a>reifier</a> as <a>focus node</a> against the <a>node shape</a> <code>$reifiableBy</code> produces a <a>failure</a>.
5724+
</div>
5725+
</div>
5726+
5727+
<div class="def def-text">
5728+
<div class="def-header">TEXTUAL DEFINITION of sh:reificationRequired</div>
5729+
<div class="def-text-body" data-validator="ReificationRequired">
5730+
If <code>$reificationRequired</code> is set to <code>true</code>, a failure MUST be produced when there is no reified statement for the <a>triple term</a> <code>t</code> in the <a>data graph</a>.
5731+
</div>
5732+
</div>
5733+
5734+
<aside class="example">
5735+
<div class="shapes-graph">
5736+
<div class="turtle">
5737+
ex:ProvenanceShape
5738+
a sh:NodeShape ;
5739+
sh:property [
5740+
sh:path ex:date ;
5741+
sh:datatype xsd:date ;
5742+
sh:maxCount 1 ;
5743+
] ;
5744+
sh:property [
5745+
sh:path ex:author ;
5746+
sh:nodeKind sh:IRI ;
5747+
sh:maxCount 1 ;
5748+
] .
5749+
5750+
ex:PersonShape
5751+
a sh:NodeShape ;
5752+
sh:targetClass ex:Person ;
5753+
sh:property ex:PersonShape-age .
5754+
5755+
ex:PersonShape-age
5756+
a sh:PropertyShape ;
5757+
sh:path ex:age ;
5758+
sh:datatype xsd:integer ;
5759+
sh:maxCount 1 ;
5760+
sh:reifiableBy ex:ProvenanceShape ;
5761+
sh:reificationRequired true .
5762+
</div>
5763+
<div class="jsonld">
5764+
<pre class="jsonld"></pre>
5765+
</div>
5766+
</div>
5767+
<div class="data-graph">
5768+
<div class="turtle">
5769+
ex:Bob ex:age 23 {|
5770+
ex:date "2019-12-05"^^xsd:date .
5771+
ex:author ex:Claire
5772+
|}.
5773+
</div>
5774+
<div class="jsonld">
5775+
<pre class="jsonld"></pre>
5776+
</div>
5777+
</div>
5778+
</aside>
5779+
</section>
56865780
</section>
56875781

56885782
<section id="core-components-others">

shacl12-test-suite/tests/core/node/manifest.ttl

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
mf:include <or-001.ttl> ;
3636
mf:include <pattern-001.ttl> ;
3737
mf:include <pattern-002.ttl> ;
38+
mf:include <reifiableBy-001.ttl> ;
39+
mf:include <reifiableBy-002.ttl> ;
3840
mf:include <xone-001.ttl> ;
3941
mf:include <xone-duplicate.ttl> ;
4042
mf:include <qualified-001.ttl> ;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
@prefix dash: <http://datashapes.org/dash#> .
2+
@prefix ex: <http://datashapes.org/sh/tests/core/node/reifiableBy-001.test#> .
3+
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
4+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
5+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
6+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
7+
@prefix sh: <http://www.w3.org/ns/shacl#> .
8+
@prefix sht: <http://www.w3.org/ns/shacl-test#> .
9+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
10+
11+
ex:InvalidResource1
12+
ex:propertyA "invalid" {|
13+
ex:properrtyB false ;
14+
|} ;
15+
.
16+
ex:ReifyShape
17+
rdf:type sh:NodeShape ;
18+
sh:property ex:ReifyShape-propertyB ;
19+
.
20+
ex:ReifyShape-propertyB
21+
sh:path ex:propertyB ;
22+
sh:in ( true ) ;
23+
.
24+
ex:TestShape
25+
rdf:type sh:NodeShape ;
26+
rdfs:label "Test shape" ;
27+
sh:property ex:TestShape-propertyA ;
28+
sh:targetNode ex:InvalidResource1 ;
29+
sh:targetNode ex:ValidResource1 ;
30+
.
31+
ex:TestShape-propertyA
32+
sh:path ex:propertyA ;
33+
sh:reifiableBy ex:ReifyShape ;
34+
.
35+
ex:ValidResource1
36+
ex:propertyA "valid" {|
37+
ex:properrtyB true ;
38+
|} ;
39+
.
40+
<>
41+
rdf:type mf:Manifest ;
42+
mf:entries (
43+
<reifiableBy-001>
44+
) ;
45+
.
46+
<reifiableBy-001>
47+
rdf:type sht:Validate ;
48+
rdfs:label "Test of sh:reifiableBy 001" ;
49+
mf:action [
50+
sht:dataGraph <> ;
51+
sht:shapesGraph <> ;
52+
] ;
53+
mf:result [
54+
rdf:type sh:ValidationReport ;
55+
sh:conforms "false"^^xsd:boolean ;
56+
sh:result [
57+
rdf:type sh:ValidationResult ;
58+
sh:focusNode ex:InvalidResource1 ;
59+
sh:resultSeverity sh:Violation ;
60+
sh:sourceConstraintComponent sh:ReifiableByConstraintComponent ;
61+
sh:sourceShape ex:TestShape-propertyA ;
62+
sh:value "invalid" ;
63+
] ;
64+
] ;
65+
mf:status sht:approved ;
66+
.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@prefix dash: <http://datashapes.org/dash#> .
2+
@prefix ex: <http://datashapes.org/sh/tests/core/node/reifiableBy-002.test#> .
3+
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
4+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
5+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
6+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
7+
@prefix sh: <http://www.w3.org/ns/shacl#> .
8+
@prefix sht: <http://www.w3.org/ns/shacl-test#> .
9+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
10+
11+
ex:InvalidResource1
12+
ex:propertyA "invalid" ;
13+
.
14+
ex:ReifyShape
15+
rdf:type sh:NodeShape ;
16+
sh:property ex:ReifyShape-propertyB ;
17+
.
18+
ex:ReifyShape-propertyB
19+
sh:path ex:propertyB ;
20+
.
21+
ex:TestShape
22+
rdf:type sh:NodeShape ;
23+
rdfs:label "Test shape" ;
24+
sh:property ex:TestShape-propertyA ;
25+
sh:targetNode ex:InvalidResource1 ;
26+
sh:targetNode ex:ValidResource1 ;
27+
.
28+
ex:TestShape-propertyA
29+
sh:path ex:propertyA ;
30+
sh:reifiableBy ex:ReifyShape ;
31+
sh:reificationRequired true ;
32+
.
33+
ex:ValidResource1
34+
ex:propertyA "valid" {|
35+
ex:properrtyB true ;
36+
|} ;
37+
.
38+
<>
39+
rdf:type mf:Manifest ;
40+
mf:entries (
41+
<reifiableBy-002>
42+
) ;
43+
.
44+
<reifiableBy-002>
45+
rdf:type sht:Validate ;
46+
rdfs:label "Test of sh:reifiableBy 002 with sh:reificationRequired" ;
47+
mf:action [
48+
sht:dataGraph <> ;
49+
sht:shapesGraph <> ;
50+
] ;
51+
mf:result [
52+
rdf:type sh:ValidationReport ;
53+
sh:conforms "false"^^xsd:boolean ;
54+
sh:result [
55+
rdf:type sh:ValidationResult ;
56+
sh:focusNode ex:InvalidResource1 ;
57+
sh:resultSeverity sh:Violation ;
58+
sh:sourceConstraintComponent sh:ReifiableByConstraintComponent ;
59+
sh:sourceShape ex:TestShape-propertyA ;
60+
sh:value "invalid" ;
61+
] ;
62+
] ;
63+
mf:status sht:approved ;
64+
.

shacl12-vocabularies/shacl.ttl

+34
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,40 @@ sh:qualifiedValueShapesDisjoint
11201120
rdfs:isDefinedBy sh: .
11211121

11221122

1123+
sh:ReifiableByConstraintComponent
1124+
a sh:ConstraintComponent ;
1125+
rdfs:label "ReifiableBy constraint component"@en ;
1126+
rdfs:comment "A constraint component that can be used to verify that reified triples conform to a given shape."@en ;
1127+
sh:parameter sh:ReifiableByConstraintComponent-reifiableBy ;
1128+
sh:parameter sh:ReifiableByConstraintComponent-reificationRequired ;
1129+
rdfs:isDefinedBy sh: .
1130+
1131+
sh:ReifiableByConstraintComponent-reifiableBy
1132+
a sh:Parameter ;
1133+
sh:path sh:reifiableBy ;
1134+
rdfs:isDefinedBy sh: .
1135+
1136+
sh:ReifiableByConstraintComponent-reificationRequired
1137+
a sh:Parameter ;
1138+
sh:path sh:reificationRequired ;
1139+
sh:datatype xsd:boolean ;
1140+
rdfs:isDefinedBy sh: .
1141+
1142+
sh:reifiableBy
1143+
a rdf:Property ;
1144+
rdfs:label "reifiable by"@en ;
1145+
rdfs:comment "The shape that the reified triples must conform to."@en ;
1146+
rdfs:range sh:NodeShape ;
1147+
rdfs:isDefinedBy sh: .
1148+
1149+
sh:reificationRequired
1150+
a rdf:Property ;
1151+
rdfs:label "reification required"@en ;
1152+
rdfs:comment "Can be used to mark the reification statements required."@en ;
1153+
rdfs:range xsd:boolean ;
1154+
rdfs:isDefinedBy sh: .
1155+
1156+
11231157
sh:SingleLineConstraintComponent
11241158
a sh:ConstraintComponent ;
11251159
rdfs:label "Single line constraint component"@en ;

0 commit comments

Comments
 (0)