Skip to content

#300: Added support for RDF 1.2 triple terms #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 10, 2025
Merged
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
98 changes: 98 additions & 0 deletions shacl12-core/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ <h3>Terminology</h3>
<dfn data-cite="rdf12-concepts#dfn-literal" data-lt="literal|literals">literal</dfn>,
<dfn data-cite="rdf12-concepts#dfn-datatype" data-lt="datatype">datatype</dfn>,
<dfn data-cite="rdf12-concepts#dfn-blank-node" data-lt="blank node|blank nodes">blank node</dfn>,
<dfn data-cite="rdf12-concepts#dfn-triple-term" data-lt="triple term|triple terms">triple term</dfn>,
<dfn data-cite="rdf12-concepts#dfn-reifier" data-lt="reifier">reifier</dfn>,
<dfn data-cite="rdf12-concepts#dfn-node" data-lt="node|nodes">node</dfn> of an RDF graph,
<dfn data-cite="rdf12-concepts#dfn-rdf-term" data-lt="term|terms">RDF term</dfn>,
<dfn data-cite="rdf12-concepts#dfn-subject" data-lt="subject|subjects">subject</dfn>,
Expand Down Expand Up @@ -5683,6 +5685,102 @@ <h4>sh:qualifiedValueShape, sh:qualifiedMinCount, sh:qualifiedMaxCount</h4>
</div>
</aside>
</section>

<section id="ReifierShapeShapeConstraintComponent">
<h4>sh:reifierShape, sh:reificationRequired</h4>
<p>
<code>sh:reifierShape</code> can be used to link a <a>property shape</a> with one or more <a>node shapes</a>.
Any <a>reifier</a> must conform to these node shapes.
</p>

<div class="parameters">Parameters:</div>
<table class="term-table">
<tr>
<th>Property</th>
<th>Summary and Syntax Rules</th>
</tr>
<tr>
<td><code>sh:reifierShape</code></td>
<td>
The <a>node shape</a> that a reifier for this triple must conform to.
<span data-syntax-rule="reifierShape-node">
The values of <code>sh:reifierShape</code> must be <a>well-formed</a> <a>node shapes</a>.
If a value for <code>sh:reifierShape</code> is given, <code>sh:path</code> values are constrained to IRIs.
</span>
</td>
</tr>
<tr>
<td><code>sh:reificationRequired</code></td>
<td>
This is an <a>optional parameter</a> of <code>sh:ReifierShapeConstraintComponent</code>.
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>.
<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>
</td>
</tr>
</table>

<div class="def def-text">
<div class="def-header">TEXTUAL DEFINITION</div>
<div class="def-text-body" data-validator="ReifierShape">
Let <code>t</code> be the <a>triple term</a> (<a>focus node</a>, <code>$path</code>, <a>value node</a>).
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>.
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>.
</div>
</div>

<div class="def def-text">
<div class="def-header">TEXTUAL DEFINITION of sh:reificationRequired</div>
<div class="def-text-body" data-validator="ReificationRequired">
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>.
</div>
</div>

<aside class="example">
<div class="shapes-graph">
<div class="turtle">
ex:ProvenanceShape
a sh:NodeShape ;
sh:property [
sh:path ex:date ;
sh:datatype xsd:date ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path ex:author ;
sh:nodeKind sh:IRI ;
sh:maxCount 1 ;
] .

ex:PersonShape
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:property ex:PersonShape-age .

ex:PersonShape-age
a sh:PropertyShape ;
sh:path ex:age ;
sh:datatype xsd:integer ;
sh:maxCount 1 ;
sh:reifierShape ex:ProvenanceShape ;
sh:reificationRequired true .
</div>
<div class="jsonld">
<pre class="jsonld"></pre>
</div>
</div>
<div class="data-graph">
<div class="turtle">
ex:Bob ex:age 23 {|
ex:date "2019-12-05"^^xsd:date .
ex:author ex:Claire
|}.
</div>
<div class="jsonld">
<pre class="jsonld"></pre>
</div>
</div>
</aside>
</section>
</section>

<section id="core-components-others">
Expand Down
2 changes: 2 additions & 0 deletions shacl12-test-suite/tests/core/node/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
mf:include <or-001.ttl> ;
mf:include <pattern-001.ttl> ;
mf:include <pattern-002.ttl> ;
mf:include <reifierShape-001.ttl> ;
mf:include <reifierShape-002.ttl> ;
mf:include <xone-001.ttl> ;
mf:include <xone-duplicate.ttl> ;
mf:include <qualified-001.ttl> ;
Expand Down
66 changes: 66 additions & 0 deletions shacl12-test-suite/tests/core/node/reifierShape-001.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://datashapes.org/sh/tests/core/node/reifierShape-001.test#> .
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix sht: <http://www.w3.org/ns/shacl-test#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ex:InvalidResource1
ex:propertyA "invalid" {|
ex:propertyB false ;
|} ;
.
ex:ReifyShape
rdf:type sh:NodeShape ;
sh:property ex:ReifyShape-propertyB ;
.
ex:ReifyShape-propertyB
sh:path ex:propertyB ;
sh:in ( true ) ;
.
ex:TestShape
rdf:type sh:NodeShape ;
rdfs:label "Test shape" ;
sh:property ex:TestShape-propertyA ;
sh:targetNode ex:InvalidResource1 ;
sh:targetNode ex:ValidResource1 ;
.
ex:TestShape-propertyA
sh:path ex:propertyA ;
sh:reifierShape ex:ReifyShape ;
.
ex:ValidResource1
ex:propertyA "valid" {|
ex:properrtyB true ;
|} ;
.
<>
rdf:type mf:Manifest ;
mf:entries (
<reifierShape-001>
) ;
.
<reifierShape-001>
rdf:type sht:Validate ;
rdfs:label "Test of sh:reifierShape 001" ;
mf:action [
sht:dataGraph <> ;
sht:shapesGraph <> ;
] ;
mf:result [
rdf:type sh:ValidationReport ;
sh:conforms "false"^^xsd:boolean ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:InvalidResource1 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:ReifierShapeConstraintComponent ;
sh:sourceShape ex:TestShape-propertyA ;
sh:value "invalid" ;
] ;
] ;
mf:status sht:approved ;
.
64 changes: 64 additions & 0 deletions shacl12-test-suite/tests/core/node/reifierShape-002.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://datashapes.org/sh/tests/core/node/reifierShape-002.test#> .
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix sht: <http://www.w3.org/ns/shacl-test#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ex:InvalidResource1
ex:propertyA "invalid" ;
.
ex:ReifyShape
rdf:type sh:NodeShape ;
sh:property ex:ReifyShape-propertyB ;
.
ex:ReifyShape-propertyB
sh:path ex:propertyB ;
.
ex:TestShape
rdf:type sh:NodeShape ;
rdfs:label "Test shape" ;
sh:property ex:TestShape-propertyA ;
sh:targetNode ex:InvalidResource1 ;
sh:targetNode ex:ValidResource1 ;
.
ex:TestShape-propertyA
sh:path ex:propertyA ;
sh:reifierShape ex:ReifyShape ;
sh:reificationRequired true ;
.
ex:ValidResource1
ex:propertyA "valid" {|
ex:properrtyB true ;
|} ;
.
<>
rdf:type mf:Manifest ;
mf:entries (
<reifierShape-002>
) ;
.
<reifierShape-002>
rdf:type sht:Validate ;
rdfs:label "Test of sh:reifierShape 002 with sh:reificationRequired" ;
mf:action [
sht:dataGraph <> ;
sht:shapesGraph <> ;
] ;
mf:result [
rdf:type sh:ValidationReport ;
sh:conforms "false"^^xsd:boolean ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:InvalidResource1 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:ReifierShapeConstraintComponent ;
sh:sourceShape ex:TestShape-propertyA ;
sh:value "invalid" ;
] ;
] ;
mf:status sht:approved ;
.
34 changes: 34 additions & 0 deletions shacl12-vocabularies/shacl.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,40 @@ sh:qualifiedValueShapesDisjoint
rdfs:isDefinedBy sh: .


sh:ReifierShapeConstraintComponent
a sh:ConstraintComponent ;
rdfs:label "ReifierShape constraint component"@en ;
rdfs:comment "A constraint component that can be used to verify that the reifier conforms to a given shape."@en ;
sh:parameter sh:ReifierShapeConstraintComponent-reifierShape ;
sh:parameter sh:ReifierShapeConstraintComponent-reificationRequired ;
rdfs:isDefinedBy sh: .

sh:ReifierShapeConstraintComponent-reifierShape
a sh:Parameter ;
sh:path sh:reifierShape ;
rdfs:isDefinedBy sh: .

sh:ReifierShapeConstraintComponent-reificationRequired
a sh:Parameter ;
sh:path sh:reificationRequired ;
sh:datatype xsd:boolean ;
rdfs:isDefinedBy sh: .

sh:reifierShape
a rdf:Property ;
rdfs:label "reifier shape"@en ;
rdfs:comment "The shape that the reified triples must conform to."@en ;
rdfs:range sh:NodeShape ;
rdfs:isDefinedBy sh: .

sh:reificationRequired
a rdf:Property ;
rdfs:label "reification required"@en ;
rdfs:comment "Can be used to mark the reification statements required."@en ;
rdfs:range xsd:boolean ;
rdfs:isDefinedBy sh: .


sh:SingleLineConstraintComponent
a sh:ConstraintComponent ;
rdfs:label "Single line constraint component"@en ;
Expand Down