Skip to content

Commit 3c1717d

Browse files
authored
Merge pull request #368 from w3c/issue-300
#300: Added support for RDF 1.2 triple terms
2 parents b9ba57a + 2c0a282 commit 3c1717d

File tree

5 files changed

+264
-0
lines changed

5 files changed

+264
-0
lines changed

shacl12-core/index.html

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ <h3>Terminology</h3>
503503
<dfn data-cite="rdf12-concepts#dfn-literal" data-lt="literal|literals">literal</dfn>,
504504
<dfn data-cite="rdf12-concepts#dfn-datatype" data-lt="datatype">datatype</dfn>,
505505
<dfn data-cite="rdf12-concepts#dfn-blank-node" data-lt="blank node|blank nodes">blank node</dfn>,
506+
<dfn data-cite="rdf12-concepts#dfn-triple-term" data-lt="triple term|triple terms">triple term</dfn>,
507+
<dfn data-cite="rdf12-concepts#dfn-reifier" data-lt="reifier">reifier</dfn>,
506508
<dfn data-cite="rdf12-concepts#dfn-node" data-lt="node|nodes">node</dfn> of an RDF graph,
507509
<dfn data-cite="rdf12-concepts#dfn-rdf-term" data-lt="term|terms">RDF term</dfn>,
508510
<dfn data-cite="rdf12-concepts#dfn-subject" data-lt="subject|subjects">subject</dfn>,
@@ -5792,6 +5794,102 @@ <h4>sh:qualifiedValueShape, sh:qualifiedMinCount, sh:qualifiedMaxCount</h4>
57925794
</div>
57935795
</aside>
57945796
</section>
5797+
5798+
<section id="ReifierShapeShapeConstraintComponent">
5799+
<h4>sh:reifierShape, sh:reificationRequired</h4>
5800+
<p>
5801+
<code>sh:reifierShape</code> can be used to link a <a>property shape</a> with one or more <a>node shapes</a>.
5802+
Any <a>reifier</a> must conform to these node shapes.
5803+
</p>
5804+
5805+
<div class="parameters">Parameters:</div>
5806+
<table class="term-table">
5807+
<tr>
5808+
<th>Property</th>
5809+
<th>Summary and Syntax Rules</th>
5810+
</tr>
5811+
<tr>
5812+
<td><code>sh:reifierShape</code></td>
5813+
<td>
5814+
The <a>node shape</a> that a reifier for this triple must conform to.
5815+
<span data-syntax-rule="reifierShape-node">
5816+
The values of <code>sh:reifierShape</code> must be <a>well-formed</a> <a>node shapes</a>.
5817+
If a value for <code>sh:reifierShape</code> is given, <code>sh:path</code> values are constrained to IRIs.
5818+
</span>
5819+
</td>
5820+
</tr>
5821+
<tr>
5822+
<td><code>sh:reificationRequired</code></td>
5823+
<td>
5824+
This is an <a>optional parameter</a> of <code>sh:ReifierShapeConstraintComponent</code>.
5825+
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>.
5826+
<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>
5827+
</td>
5828+
</tr>
5829+
</table>
5830+
5831+
<div class="def def-text">
5832+
<div class="def-header">TEXTUAL DEFINITION</div>
5833+
<div class="def-text-body" data-validator="ReifierShape">
5834+
Let <code>t</code> be the <a>triple term</a> (<a>focus node</a>, <code>$path</code>, <a>value node</a>).
5835+
For each <a>reifier</a> for the <a>triple term</a> <code>t</code>, a failure MUST be produced if validating the <a>reifier</a> against the <a>node shape</a> <code>$reifierShape</code> with the <a>reifier</a> as <a>focus node</a> produces a <a>failure</a>.
5836+
For each <a>reifier</a> <code>t</code> that does not conform to <code>$reifierShape</code>, there is a validation result with <code>t</code> as <code>sh:value</code>.
5837+
</div>
5838+
</div>
5839+
5840+
<div class="def def-text">
5841+
<div class="def-header">TEXTUAL DEFINITION of sh:reificationRequired</div>
5842+
<div class="def-text-body" data-validator="ReificationRequired">
5843+
If <code>$reificationRequired</code> is set to <code>true</code> and there is no reified statement for the <a>triple term</a> <code>t</code> in the <a>data graph</a>, there is a validation result with <code>t</code> as <code>sh:value</code>.
5844+
</div>
5845+
</div>
5846+
5847+
<aside class="example">
5848+
<div class="shapes-graph">
5849+
<div class="turtle">
5850+
ex:ProvenanceShape
5851+
a sh:NodeShape ;
5852+
sh:property [
5853+
sh:path ex:date ;
5854+
sh:datatype xsd:date ;
5855+
sh:maxCount 1 ;
5856+
] ;
5857+
sh:property [
5858+
sh:path ex:author ;
5859+
sh:nodeKind sh:IRI ;
5860+
sh:maxCount 1 ;
5861+
] .
5862+
5863+
ex:PersonShape
5864+
a sh:NodeShape ;
5865+
sh:targetClass ex:Person ;
5866+
sh:property ex:PersonShape-age .
5867+
5868+
ex:PersonShape-age
5869+
a sh:PropertyShape ;
5870+
sh:path ex:age ;
5871+
sh:datatype xsd:integer ;
5872+
sh:maxCount 1 ;
5873+
sh:reifierShape ex:ProvenanceShape ;
5874+
sh:reificationRequired true .
5875+
</div>
5876+
<div class="jsonld">
5877+
<pre class="jsonld"></pre>
5878+
</div>
5879+
</div>
5880+
<div class="data-graph">
5881+
<div class="turtle">
5882+
ex:Bob ex:age 23 {|
5883+
ex:date "2019-12-05"^^xsd:date .
5884+
ex:author ex:Claire
5885+
|}.
5886+
</div>
5887+
<div class="jsonld">
5888+
<pre class="jsonld"></pre>
5889+
</div>
5890+
</div>
5891+
</aside>
5892+
</section>
57955893
</section>
57965894

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

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

Lines changed: 2 additions & 0 deletions
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 <reifierShape-001.ttl> ;
39+
mf:include <reifierShape-002.ttl> ;
3840
mf:include <xone-001.ttl> ;
3941
mf:include <xone-duplicate.ttl> ;
4042
mf:include <qualified-001.ttl> ;
Lines changed: 66 additions & 0 deletions
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/reifierShape-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:propertyB 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:reifierShape 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+
<reifierShape-001>
44+
) ;
45+
.
46+
<reifierShape-001>
47+
rdf:type sht:Validate ;
48+
rdfs:label "Test of sh:reifierShape 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:ReifierShapeConstraintComponent ;
61+
sh:sourceShape ex:TestShape-propertyA ;
62+
sh:value "invalid" ;
63+
] ;
64+
] ;
65+
mf:status sht:approved ;
66+
.
Lines changed: 64 additions & 0 deletions
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/reifierShape-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:reifierShape 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+
<reifierShape-002>
42+
) ;
43+
.
44+
<reifierShape-002>
45+
rdf:type sht:Validate ;
46+
rdfs:label "Test of sh:reifierShape 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:ReifierShapeConstraintComponent ;
59+
sh:sourceShape ex:TestShape-propertyA ;
60+
sh:value "invalid" ;
61+
] ;
62+
] ;
63+
mf:status sht:approved ;
64+
.

shacl12-vocabularies/shacl.ttl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,40 @@ sh:qualifiedValueShapesDisjoint
11201120
rdfs:isDefinedBy sh: .
11211121

11221122

1123+
sh:ReifierShapeConstraintComponent
1124+
a sh:ConstraintComponent ;
1125+
rdfs:label "ReifierShape constraint component"@en ;
1126+
rdfs:comment "A constraint component that can be used to verify that the reifier conforms to a given shape."@en ;
1127+
sh:parameter sh:ReifierShapeConstraintComponent-reifierShape ;
1128+
sh:parameter sh:ReifierShapeConstraintComponent-reificationRequired ;
1129+
rdfs:isDefinedBy sh: .
1130+
1131+
sh:ReifierShapeConstraintComponent-reifierShape
1132+
a sh:Parameter ;
1133+
sh:path sh:reifierShape ;
1134+
rdfs:isDefinedBy sh: .
1135+
1136+
sh:ReifierShapeConstraintComponent-reificationRequired
1137+
a sh:Parameter ;
1138+
sh:path sh:reificationRequired ;
1139+
sh:datatype xsd:boolean ;
1140+
rdfs:isDefinedBy sh: .
1141+
1142+
sh:reifierShape
1143+
a rdf:Property ;
1144+
rdfs:label "reifier shape"@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)