Skip to content

Issue 391: support for collections #403

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

Open
wants to merge 30 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ec1d5cd
feat: add memberShape to vocab, shacl-shacl and tests
jeswr Jun 11, 2025
b09c177
chore: add HTML documentation
jeswr Jun 11, 2025
644e29c
fix: use SHACL list rather than RDF list, allow memberShape to be use…
jeswr Jun 11, 2025
8ab3864
Update shacl12-core/index.html
jeswr Jun 13, 2025
387b7e4
Update shacl12-core/index.html
jeswr Jun 13, 2025
1133a3c
#401 fix: constrain deactivated using datatype rather than in (#402)
jeswr Jun 11, 2025
ddc2fb7
Revert "#401 fix: constrain deactivated using datatype rather than in…
jeswr Jun 13, 2025
bacd1ef
chore: cleanup newlines
jeswr Jun 13, 2025
dc710f6
chore: fixup ordering of constraint components
jeswr Jun 13, 2025
2f2f804
chore: remove maxCount constraint on memberShape
jeswr Jun 17, 2025
328bc62
chore: replace list of constraint parameters with reference
jeswr Jun 17, 2025
dfb794d
chore: fix memberShape validation example in text and 001 test
jeswr Jun 18, 2025
333632d
chore: cleanup tests
jeswr Jun 18, 2025
aa20336
chore: update vocab definition
jeswr Jun 18, 2025
8b80bc6
chore: add memberShape test for multiple violating values
jeswr Jun 18, 2025
503c115
chore: cleanup turtle
jeswr Jun 18, 2025
4de9d0b
cleanup: remove unecessary otherwise
jeswr Jun 18, 2025
94ab836
Update shacl12-vocabularies/shacl.ttl
jeswr Jun 19, 2025
1ed3c37
chore: add clarifying comments
jeswr Jun 26, 2025
a0dec2a
chore: add clarifications to tests
jeswr Jun 26, 2025
e95d2dc
feat: use sh:detail
jeswr Jun 26, 2025
5db4a27
chore: update membershape text definition
jeswr Jun 26, 2025
6b418b1
chore: fix must casing
jeswr Jun 28, 2025
4422f15
chore: add better sh:detail examples for invalid lists
jeswr Jun 28, 2025
bf7b597
chore: correctly reference _:b1 in property memberShape
jeswr Jun 28, 2025
0f9fad2
chore: fix formatting of memberShape test
jeswr Jun 28, 2025
5f2bb6b
chore: add link to sh:detail results for sh:memberShape
jeswr Jun 28, 2025
7ff2a9a
chore: move link to sh:detail results for sh:memberShape
jeswr Jun 28, 2025
4eb7e54
chore: remove maxCount form memberShape vocab definition
jeswr Jun 28, 2025
0894e99
chore: remove non-existent files from manifest
jeswr Jun 29, 2025
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
195 changes: 193 additions & 2 deletions shacl12-core/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ <h4>Handling of Ill-formed Shapes Graphs</h4>

<section id="shapes-recursion">
<h4>Handling of Recursive Shapes</h4>
<p>
<p id="shape-expecting-constraint-parameters">
The following properties are the so-called <dfn data-lt="shape-expecting">shape-expecting constraint parameters</dfn> in SHACL Core:
</p>
<ul>
Expand All @@ -2761,6 +2761,7 @@ <h4>Handling of Recursive Shapes</h4>
<li><a href="#PropertyConstraintComponent">sh:property</a></li>
<li><a href="#QualifiedValueShapeConstraintComponent">sh:qualifiedValueShape</a></li>
<li><a href="#NodeConstraintComponent">sh:node</a></li>
<li><a href="#MemberShapeConstraintComponent">sh:memberShape</a></li>
<li><a href="#XoneConstraintComponent">sh:xone</a></li>
</ul>
<p>
Expand Down Expand Up @@ -2810,7 +2811,7 @@ <h3>Conformance Checking</h3>
<a>conforms</a> to a given <a>shape</a>, and <code>false</code> otherwise.
</p>
<p id="conformance-nested">
Note that some <a>constraint components</a> of SHACL Core (e.g., those of <code>sh:not</code>, <code>sh:or</code> and <code>sh:node</code>)
Note that all <a href="#shape-expecting-constraint-parameters">shape-expecting constraint parameters</a> of SHACL Core
rely on conformance checking.
In these cases, the <a>validation results</a> used to determine the outcome of conformance checking are
separated from those of the surrounding validation process and typically do not end up in the same validation report
Expand Down Expand Up @@ -5691,6 +5692,196 @@ <h4>sh:property</h4>
</p>
</section>

<section id="MemberShapeConstraintComponent">
<h4>sh:memberShape</h4>
<p>
<code>sh:memberShape</code> requires that each <a>value node</a> be a <a href="#syntax-rule-SHACL-list">SHACL list</a>,
and that each member of that list conforms to the given <a>node shape</a>.
</p>
<p>
<span class="component-class">Constraint Component IRI</span>: <code>sh:MemberShapeConstraintComponent</code>
</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:memberShape</code></td>
<td>
The shape that all members of the <a href="#syntax-rule-SHACL-list">SHACL list</a> must conform to.
<span data-syntax-rule="memberShape-node">The value of <code>sh:memberShape</code> must be a <a>well-formed</a> <a>node shape</a>.</span>
</td>
</tr>
</table>
<div class="def def-text">
<div class="def-header">TEXTUAL DEFINITION</div>
<div class="def-text-body" data-validator="MemberShape">
Let <code>$memberShape</code> be a <a>value</a> of <code>sh:memberShape</code>.
Each <a>value node</a> <code>v</code> must be a <a href="#syntax-rule-SHACL-list">SHACL list</a> - a <a>failure</a> MUST be produced if <code>v</code> is not a SHACL list.
For each member <code>m</code> of the list <code>v</code>
a <a>failure</a> MUST be produced if the <a>conformance checking</a> of <code>m</code> against <code>$memberShape</code> produces a <a>failure</a>.
There MUST be at most one <a>validation result</a> for each list <code>v</code> and set of triggering constraints.

The <code>sh:detail</code> property SHOULD be used to specify the validation results for each member <code>m</code> of the list that fails conformance checking.
<code>m</code> SHOULD be used as the <code>sh:focusNode</code> for each <code>sh:detail</code> result.

The <code>sh:detail</code> property SHOULD also be used to specify when <code>v</code> is not a valid <a href="#syntax-rule-SHACL-list">SHACL list</a>.
<code>v</code> SHOULD be used as the <code>sh:focusNode</code> for this <code>sh:detail</code> result.
</div>
</div>
<p><em>The remainder of this section is informative.</em></p>
<p>
In the following example, all values of the property <code>ex:speakerOrder</code> must be RDF lists, and each member of those lists must be an IRI.
Note that <code>sh:memberShape</code> can be used in both property shapes (as shown) and node shapes (where it would apply to the focus node itself).

Examples of how to generate <code>sh:detail</code>s can be found in the test cases for <code>sh:memberShape</code> in the SHACL test suite: <a href="../shacl12-test-suite/tests/core/node/memberShape-001.ttl">memberShape-001.ttl</a>.
</p>
<aside class="example">
<div class="shapes-graph">
<div class="turtle">
ex:AgendaShape
a sh:NodeShape ;
<span class="target-can-be-skipped">sh:targetClass ex:Agenda ;</span>
sh:property [
sh:path ex:speakerOrder ;
sh:memberShape [
sh:nodeKind sh:IRI ;
] ;
sh:maxCount 1 ;
] .
</div>
<div class="jsonld">
<pre class="jsonld">{
"@id": "ex:AgendaShape",
"@type": "sh:NodeShape",
"sh:property": {
"sh:maxCount": {
"@type": "xsd:integer",
"@value": "1"
},
"sh:memberShape": {
"sh:nodeKind": {
"@id": "sh:IRI"
}
},
"sh:path": {
"@id": "ex:speakerOrder"
}
},
"sh:targetClass": {
"@id": "ex:Agenda"
}
}</pre>
</div>
</div>
<div class="data-graph">
<div class="turtle">
ex:agenda1 a ex:Agenda ;
ex:speakerOrder ( ex:Alice ex:Bob ex:Charlie ) .

<span class="focus-node-error">ex:agenda2</span> a ex:Agenda ;
ex:speakerOrder ( ex:Alice ex:Bob "Charlie" ) .
</div>
<div class="jsonld">
<pre class="jsonld">{
"@graph": [
{
"@id": "ex:agenda1",
"@type": "ex:Agenda",
"ex:speakerOrder": {
"@list": [
{
"@id": "ex:Alice"
},
{
"@id": "ex:Bob"
},
{
"@id": "ex:Charlie"
}
]
}
},
{
"@id": "ex:agenda2",
"@type": "ex:Agenda",
"ex:speakerOrder": {
"@list": [
{
"@id": "ex:Alice"
},
{
"@id": "ex:Bob"
},
"Charlie"
]
}
}
]
}</pre>
</div>
</div>
<div class="results-graph">
<div class="turtle">
[ a sh:ValidationReport ;
sh:conforms false ;
sh:result [
a sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
sh:focusNode ex:agenda2 ;
sh:resultPath ex:speakerOrder ;
sh:value _:list2 ;
sh:resultMessage "Value does not conform to Shape ex:AgendaShape. See details for more information." ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:AgendaShape ;
sh:detail [
rdf:type sh:ValidationResult ;
sh:focusNode "Charlie" ;
sh:resultMessage "Value is not of Node Kind sh:IRI" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
sh:sourceShape _:b1 ;
sh:value "Charlie" ;
] ;
]
] .
</div>
<div class="jsonld">
<pre class="jsonld">{
"@type": "sh:ValidationReport",
"sh:conforms": {
"@type": "xsd:boolean",
"@value": "false"
},
"sh:result": {
"@type": "sh:ValidationResult",
"sh:focusNode": {
"@id": "ex:agenda2"
},
"sh:resultMessage": "List member does not have the required node kind sh:IRI.",
"sh:resultPath": {
"@id": "ex:speakerOrder"
},
"sh:resultSeverity": {
"@id": "sh:Violation"
},
"sh:sourceConstraintComponent": {
"@id": "sh:MemberShapeConstraintComponent"
},
"sh:sourceShape": {
"@id": "ex:AgendaShape"
},
"sh:value": "Charlie"
}
}</pre>
</div>
</div>
</aside>
</section>

<section id="QualifiedValueShapeConstraintComponent">
<h4>sh:qualifiedValueShape, sh:qualifiedMinCount, sh:qualifiedMaxCount</h4>
<p>
Expand Down
1 change: 1 addition & 0 deletions shacl12-test-suite/tests/core/node/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
mf:include <maxExclusive-001.ttl> ;
mf:include <maxInclusive-001.ttl> ;
mf:include <maxLength-001.ttl> ;
mf:include <memberShape-001.ttl> ;
mf:include <minExclusive-001.ttl> ;
mf:include <minInclusive-001.ttl> ;
mf:include <minInclusive-002.ttl> ;
Expand Down
Loading