Skip to content

Commit d4e769c

Browse files
committed
fix: make invalid SHACL lists a top-level violation
1 parent bb0f363 commit d4e769c

File tree

4 files changed

+14
-99
lines changed

4 files changed

+14
-99
lines changed

shacl12-core/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4566,13 +4566,13 @@ <h4>sh:memberShape</h4>
45664566
<div class="def-text-body" data-validator="MemberShape">
45674567
Let <code>$memberShape</code> be a <a>parameter value</a> for <code>sh:memberShape</code>.
45684568
Each <a>value node</a> <code>v</code> must be a <a href="#syntax-rule-SHACL-list">SHACL list</a> - if <code>v</code> is not a SHACL list there is a <a>validation result</a>.
4569-
If any member <code>m</code> of the list <code>v</code> does not <a>conform</a> to <code>$memberShape</code>, there is a <a>validation result</a>. There must be at most one <a>validation result</a> for each list <code>v</code>.
4569+
If any member <code>m</code> of the <a href="#syntax-rule-SHACL-list">SHACL list</a> <code>v</code> does not <a>conform</a> to <code>$memberShape</code>, there is a <a>validation result</a>.
45704570
</div>
45714571
</div>
45724572
<p><em>The remainder of this section is informative.</em></p>
45734573
<p>
45744574
Each member <code>m</code> of a value node <code>v</code> that does not conform to the <code>$memberShape</code> should be reported as a separate <code>sh:detail</code> in the <a>validation result</a> for <code>v</code>.
4575-
If the list <code>v</code> is not a valid <a href="#syntax-rule-SHACL-list">SHACL list</a>, this should also be reported as a <code>sh:detail</code> in the <a>validation result</a> for <code>v</code>.
4575+
If <code>v</code> is not a valid <a href="#syntax-rule-SHACL-list">SHACL list</a>, this should be reported as a top-level <a>validation result</a> and validation of individual members should not be attempted.
45764576
</p>
45774577
<p>
45784578
Examples of how to generate <code>sh:detail</code>s in validation results 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>.
@@ -4902,12 +4902,12 @@ <h4>sh:uniqueMembers</h4>
49024902
Let <code>$uniqueMembers</code> be a <a>parameter value</a> for <code>sh:uniqueMembers</code>.
49034903
Each <a>value node</a> <code>v</code> must be a <a href="#syntax-rule-SHACL-list">SHACL list</a> - if <code>v</code> is not a SHACL list there is a <a>validation result</a>.
49044904
If <code>$uniqueMembers</code> is <code>true</code> and the list <code>v</code> has duplicate members,
4905-
there is a <a>validation result</a>. There must be at most one <a>validation result</a> for each list <code>v</code>.
4905+
there is a <a>validation result</a>.
49064906
</div>
49074907
</div>
49084908
<p><em>The remainder of this section is informative.</em></p>
49094909
<p>
4910-
Each duplicate member <code>m</code> of a list <code>v</code> should be reported as a separate <code>sh:detail</code> in the <a>validation result</a> for <code>v</code>. If the list <code>v</code> is not a valid <a href="#syntax-rule-SHACL-list">SHACL list</a>, this should also be reported as a <code>sh:detail</code> in the <a>validation result</a> for <code>v</code>.
4910+
Each duplicate member <code>m</code> of a list <code>v</code> should be reported as a separate <code>sh:detail</code> in the <a>validation result</a> for <code>v</code>. If the list <code>v</code> is not a valid <a href="#syntax-rule-SHACL-list">SHACL list</a>, this should be reported as a top-level <a>validation result</a> and validation of unique membership should not be attempted.
49114911
</p>
49124912
<p>
49134913
Examples of how to generate <code>sh:detail</code>s in validation results can be found in the test cases for <code>sh:uniqueMembers</code> in the SHACL test suite: <a href="../shacl12-test-suite/tests/core/node/uniqueMembers-001.ttl">uniqueMembers-001.ttl</a>.

shacl12-test-suite/tests/core/node/memberShape-001.ttl

Lines changed: 8 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -110,38 +110,20 @@ ex:list10
110110
sh:result [
111111
rdf:type sh:ValidationResult ;
112112
sh:focusNode ex:list3 ;
113-
sh:resultMessage "Value is a malformed SHACL List." ;
113+
sh:resultMessage "Value is a malformed SHACL List. ex:list3 is missing rdf:first and rdf:rest properties." ;
114114
sh:resultSeverity sh:Violation ;
115115
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
116116
sh:sourceShape ex:IRIListShape ;
117117
sh:value ex:list3 ;
118-
sh:detail [
119-
rdf:type sh:ValidationResult ;
120-
sh:focusNode ex:list3 ;
121-
sh:resultMessage "Value is a malformed SHACL List. ex:list3 is missing rdf:first and rdf:rest properties." ;
122-
sh:resultSeverity sh:Violation ;
123-
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
124-
sh:sourceShape ex:IRIListShape ;
125-
sh:value ex:list3 ;
126-
] ;
127118
] ;
128119
sh:result [
129120
rdf:type sh:ValidationResult ;
130121
sh:focusNode ex:list4 ;
131-
sh:resultMessage "Value does not conform to Shape ex:IRIListShape. See details for more information." ;
122+
sh:resultMessage "Value is a malformed SHACL List. ex:list4 is missing rdf:rest property." ;
132123
sh:resultSeverity sh:Violation ;
133124
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
134125
sh:sourceShape ex:IRIListShape ;
135126
sh:value ex:list4 ;
136-
sh:detail [
137-
rdf:type sh:ValidationResult ;
138-
sh:focusNode ex:list4 ;
139-
sh:resultMessage "Value is a malformed SHACL List. ex:list4 is missing rdf:rest property." ;
140-
sh:resultSeverity sh:Violation ;
141-
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
142-
sh:sourceShape ex:IRIListShape ;
143-
sh:value ex:list4 ;
144-
] ;
145127
] ;
146128
sh:result [
147129
rdf:type sh:ValidationResult ;
@@ -171,77 +153,29 @@ ex:list10
171153
sh:result [
172154
rdf:type sh:ValidationResult ;
173155
sh:focusNode ex:list6 ;
174-
sh:resultMessage "Value does not conform to Shape ex:IRIListShape. See details for more information." ;
156+
sh:resultMessage "Value is a malformed SHACL List. ex:list6 is missing rdf:rest property." ;
175157
sh:resultSeverity sh:Violation ;
176158
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
177159
sh:sourceShape ex:IRIListShape ;
178-
sh:detail [
179-
rdf:type sh:ValidationResult ;
180-
sh:focusNode "Charlie" ;
181-
sh:resultMessage "Value is not of Node Kind sh:IRI" ;
182-
sh:resultSeverity sh:Violation ;
183-
sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
184-
sh:sourceShape ex:IRIShape ;
185-
sh:value "Charlie" ;
186-
], [
187-
rdf:type sh:ValidationResult ;
188-
sh:focusNode ex:list6 ;
189-
sh:resultMessage "Value is a malformed SHACL List. ex:list6 is missing rdf:rest property." ;
190-
sh:resultSeverity sh:Violation ;
191-
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
192-
sh:sourceShape ex:IRIListShape ;
193-
sh:value ex:list6 ;
194-
] ;
160+
sh:value ex:list6 ;
195161
] ;
196162
sh:result [
197163
rdf:type sh:ValidationResult ;
198164
sh:focusNode ex:list7 ;
199-
sh:resultMessage "Value does not conform to Shape ex:IRIListShape. See details for more information." ;
165+
sh:resultMessage "Value is a malformed SHACL List. ex:list8 is missing rdf:first and rdf:rest property." ;
200166
sh:resultSeverity sh:Violation ;
201167
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
202168
sh:sourceShape ex:IRIListShape ;
203-
sh:detail [
204-
rdf:type sh:ValidationResult ;
205-
sh:focusNode "Charlie" ;
206-
sh:resultMessage "Value is not of Node Kind sh:IRI" ;
207-
sh:resultSeverity sh:Violation ;
208-
sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
209-
sh:sourceShape ex:IRIShape ;
210-
sh:value "Charlie" ;
211-
], [
212-
rdf:type sh:ValidationResult ;
213-
sh:focusNode ex:list8 ;
214-
sh:resultMessage "Value is a malformed SHACL List. ex:list8 is missing rdf:first and rdf:rest property." ;
215-
sh:resultSeverity sh:Violation ;
216-
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
217-
sh:sourceShape ex:IRIListShape ;
218-
sh:value ex:list8 ;
219-
] ;
169+
sh:value ex:list8 ;
220170
] ;
221171
sh:result [
222172
rdf:type sh:ValidationResult ;
223173
sh:focusNode ex:list9 ;
224-
sh:resultMessage "Value does not conform to Shape ex:IRIListShape. See details for more information." ;
174+
sh:resultMessage "Value is a malformed SHACL List. A list cannot have itself in the rdf:rest+ path. List ex:list9 follows from ex:list10." ;
225175
sh:resultSeverity sh:Violation ;
226176
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
227177
sh:sourceShape ex:IRIListShape ;
228-
sh:detail [
229-
rdf:type sh:ValidationResult ;
230-
sh:focusNode "Charlie" ;
231-
sh:resultMessage "Value is not of Node Kind sh:IRI" ;
232-
sh:resultSeverity sh:Violation ;
233-
sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
234-
sh:sourceShape ex:IRIShape ;
235-
sh:value "Charlie" ;
236-
], [
237-
rdf:type sh:ValidationResult ;
238-
sh:focusNode ex:list10 ;
239-
sh:resultMessage "Value is a malformed SHACL List. A list cannot have itself in the rdf:rest+ path. List ex:list9 follows from ex:list10." ;
240-
sh:resultSeverity sh:Violation ;
241-
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
242-
sh:sourceShape ex:IRIListShape ;
243-
sh:value ex:list9 ;
244-
] ;
178+
sh:value ex:list10 ;
245179
] ;
246180
] ;
247181
mf:status sht:approved ;

shacl12-test-suite/tests/core/node/uniqueMembers-001.ttl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,11 @@ ex:list1
7070
sh:result [
7171
rdf:type sh:ValidationResult ;
7272
sh:focusNode ex:notAList ;
73-
sh:resultMessage "Value does not conform to Shape ex:ListShape. See details for more information." ;
73+
sh:resultMessage "Value is a malformed SHACL List. ex:notAList is missing rdf:first and rdf:rest properties." ;
7474
sh:resultSeverity sh:Violation ;
7575
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
7676
sh:sourceShape ex:ListShape ;
7777
sh:value ex:notAList ;
78-
sh:detail [
79-
rdf:type sh:ValidationResult ;
80-
sh:focusNode ex:notAList ;
81-
sh:resultMessage "Value is a malformed SHACL List. ex:notAList is missing rdf:first and rdf:rest properties." ;
82-
sh:resultSeverity sh:Violation ;
83-
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
84-
sh:sourceShape ex:ListShape ;
85-
sh:value ex:notAList ;
86-
]
8778
] ;
8879
] ;
8980
mf:status sht:approved ;

shacl12-test-suite/tests/core/property/uniqueMembers-001.ttl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,12 @@ _:b1
9292
sh:result [
9393
rdf:type sh:ValidationResult ;
9494
sh:focusNode ex:person4 ;
95-
sh:resultMessage "Value does not conform to Shape ex:PersonShape. See details for more information." ;
95+
sh:resultMessage "Value is a malformed SHACL List. ex:notAList is missing rdf:first and rdf:rest properties." ;
9696
sh:resultPath ex:preferences ;
9797
sh:resultSeverity sh:Violation ;
9898
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
9999
sh:sourceShape ex:PersonShape ;
100100
sh:value ex:notAList ;
101-
sh:detail [
102-
rdf:type sh:ValidationResult ;
103-
sh:focusNode ex:person4 ;
104-
sh:resultMessage "Value is a malformed SHACL List. ex:notAList is missing rdf:first and rdf:rest properties." ;
105-
sh:resultPath ex:preferences ;
106-
sh:resultSeverity sh:Violation ;
107-
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
108-
sh:sourceShape ex:PersonShape ;
109-
sh:value ex:notAList ;
110-
]
111101
] ;
112102
] ;
113103
mf:status sht:approved ;

0 commit comments

Comments
 (0)