Skip to content

Commit 175e03f

Browse files
committed
chore: update vocab, shacl and tests to make sh:minListLength, sh:maxListLength, sh:uniqueMembers separate constraint components
1 parent 480da45 commit 175e03f

File tree

11 files changed

+511
-118
lines changed

11 files changed

+511
-118
lines changed

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

Lines changed: 0 additions & 104 deletions
This file was deleted.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
mf:include <maxExclusive-001.ttl> ;
2727
mf:include <maxInclusive-001.ttl> ;
2828
mf:include <maxLength-001.ttl> ;
29+
mf:include <maxListLength-001.ttl> ;
2930
mf:include <memberShape-001.ttl> ;
3031
mf:include <minExclusive-001.ttl> ;
3132
mf:include <minInclusive-001.ttl> ;
3233
mf:include <minInclusive-002.ttl> ;
3334
mf:include <minInclusive-003.ttl> ;
3435
mf:include <minLength-001.ttl> ;
36+
mf:include <minListLength-001.ttl> ;
3537
mf:include <node-001.ttl> ;
3638
mf:include <nodeKind-001.ttl> ;
3739
mf:include <not-001.ttl> ;
@@ -41,6 +43,7 @@
4143
mf:include <pattern-002.ttl> ;
4244
mf:include <reifierShape-001.ttl> ;
4345
mf:include <reifierShape-002.ttl> ;
46+
mf:include <uniqueMembers-001.ttl> ;
4447
mf:include <xone-001.ttl> ;
4548
mf:include <xone-duplicate.ttl> ;
4649
mf:include <qualified-001.ttl> ;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@prefix dash: <http://datashapes.org/dash#> .
2+
@prefix ex: <http://datashapes.org/sh/tests/core/node/maxListLength-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:ListShape
12+
rdf:type sh:NodeShape ;
13+
sh:maxListLength 2 ;
14+
# Satisfies all constraints
15+
sh:targetNode ( 1 2 ), rdf:nil ;
16+
# Violates maxListLength constraint
17+
sh:targetNode _:b1, ex:notAList ;
18+
.
19+
20+
_:b1
21+
rdf:first 1 ;
22+
rdf:rest ( 2 3 ) .
23+
24+
<>
25+
rdf:type mf:Manifest ;
26+
mf:entries (
27+
<maxListLength-001>
28+
) ;
29+
.
30+
31+
<maxListLength-001>
32+
rdf:type sht:Validate ;
33+
rdfs:label "Test of sh:maxListLength on node shape 001" ;
34+
mf:action [
35+
sht:dataGraph <> ;
36+
sht:shapesGraph <> ;
37+
] ;
38+
mf:result [
39+
rdf:type sh:ValidationReport ;
40+
sh:conforms "false"^^xsd:boolean ;
41+
sh:result [
42+
rdf:type sh:ValidationResult ;
43+
sh:focusNode rdf:nil ;
44+
sh:resultMessage "List has length 3, but maximum allowed length is 2." ;
45+
sh:resultSeverity sh:Violation ;
46+
sh:sourceConstraintComponent sh:MaxListLengthConstraintComponent ;
47+
sh:sourceShape ex:ListShape ;
48+
] ;
49+
sh:result [
50+
rdf:type sh:ValidationResult ;
51+
sh:focusNode ex:notAList ;
52+
sh:resultMessage "Value is a malformed SHACL List. ex:notAList is missing rdf:first and rdf:rest properties." ;
53+
sh:resultSeverity sh:Violation ;
54+
sh:sourceConstraintComponent sh:MaxListLengthConstraintComponent ;
55+
sh:sourceShape ex:ListShape ;
56+
sh:value ex:notAList ;
57+
] ;
58+
] ;
59+
mf:status sht:approved ;
60+
.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
@prefix dash: <http://datashapes.org/dash#> .
2+
@prefix ex: <http://datashapes.org/sh/tests/core/node/minListLength-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:ListShape
12+
rdf:type sh:NodeShape ;
13+
sh:minListLength 1 ;
14+
# Satisfies all constraints
15+
sh:targetNode ( 1 2 ) ;
16+
# Violates minListLength constraint
17+
sh:targetNode rdf:nil, ex:notAList ;
18+
.
19+
20+
<>
21+
rdf:type mf:Manifest ;
22+
mf:entries (
23+
<minListLength-001>
24+
) ;
25+
.
26+
27+
<minListLength-001>
28+
rdf:type sht:Validate ;
29+
rdfs:label "Test of sh:minListLength on node shape 001" ;
30+
mf:action [
31+
sht:dataGraph <> ;
32+
sht:shapesGraph <> ;
33+
] ;
34+
mf:result [
35+
rdf:type sh:ValidationReport ;
36+
sh:conforms "false"^^xsd:boolean ;
37+
sh:result [
38+
rdf:type sh:ValidationResult ;
39+
sh:focusNode rdf:nil ;
40+
sh:resultMessage "List has length 0, but minimum required length is 1." ;
41+
sh:resultSeverity sh:Violation ;
42+
sh:sourceConstraintComponent sh:MinListLengthConstraintComponent ;
43+
sh:sourceShape ex:ListShape ;
44+
] ;
45+
sh:result [
46+
rdf:type sh:ValidationResult ;
47+
sh:focusNode ex:notAList ;
48+
sh:resultMessage "Value is a malformed SHACL List. ex:notAList is missing rdf:first and rdf:rest properties." ;
49+
sh:resultSeverity sh:Violation ;
50+
sh:sourceConstraintComponent sh:MinListLengthConstraintComponent ;
51+
sh:sourceShape ex:ListShape ;
52+
sh:value ex:notAList ;
53+
] ;
54+
] ;
55+
mf:status sht:approved ;
56+
.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
@prefix dash: <http://datashapes.org/dash#> .
2+
@prefix ex: <http://datashapes.org/sh/tests/core/node/uniqueMembers-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:ListShape
12+
rdf:type sh:NodeShape ;
13+
sh:uniqueMembers true ;
14+
# Satisfies all constraints
15+
sh:targetNode ( 1 2 ), rdf:nil ;
16+
# Violates uniqueMembers constraint
17+
sh:targetNode _:b1, ex:notAList ;
18+
.
19+
20+
_:b1
21+
rdf:first 1 ;
22+
rdf:rest ( 2 1 2 2 ) .
23+
24+
<>
25+
rdf:type mf:Manifest ;
26+
mf:entries (
27+
<uniqueMembers-001>
28+
) ;
29+
.
30+
31+
<uniqueMembers-001>
32+
rdf:type sht:Validate ;
33+
rdfs:label "Test of sh:uniqueMembers on node shape 001" ;
34+
mf:action [
35+
sht:dataGraph <> ;
36+
sht:shapesGraph <> ;
37+
] ;
38+
mf:result [
39+
rdf:type sh:ValidationReport ;
40+
sh:conforms "false"^^xsd:boolean ;
41+
sh:result [
42+
rdf:type sh:ValidationResult ;
43+
sh:focusNode _:b1 ;
44+
sh:resultMessage "Value does not conform to Shape ex:ListShape. See details for more information." ;
45+
sh:resultSeverity sh:Violation ;
46+
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
47+
sh:sourceShape ex:ListShape ;
48+
sh:detail [
49+
rdf:type sh:ValidationResult ;
50+
sh:focusNode _:b1 ;
51+
sh:resultMessage "List is required to have unique elements. Two occurences of '\"1\"^^xsd:integer' found." ;
52+
sh:resultSeverity sh:Violation ;
53+
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
54+
sh:sourceShape ex:ListShape ;
55+
sh:value 1 ;
56+
], [
57+
rdf:type sh:ValidationResult ;
58+
sh:focusNode _:b1 ;
59+
sh:resultMessage "List is required to have unique elements. Three occurences of '\"2\"^^xsd:integer' found." ;
60+
sh:resultSeverity sh:Violation ;
61+
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
62+
sh:sourceShape ex:ListShape ;
63+
sh:value 2 ;
64+
]
65+
] ;
66+
sh:result [
67+
rdf:type sh:ValidationResult ;
68+
sh:focusNode ex:notAList ;
69+
sh:resultMessage "Value does not conform to Shape ex:ListShape. See details for more information." ;
70+
sh:resultSeverity sh:Violation ;
71+
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
72+
sh:sourceShape ex:ListShape ;
73+
sh:value ex:notAList ;
74+
sh:detail [
75+
rdf:type sh:ValidationResult ;
76+
sh:focusNode ex:notAList ;
77+
sh:resultMessage "Value is a malformed SHACL List. ex:notAList is missing rdf:first and rdf:rest properties." ;
78+
sh:resultSeverity sh:Violation ;
79+
sh:sourceConstraintComponent sh:UniqueMembersConstraintComponent ;
80+
sh:sourceShape ex:ListShape ;
81+
sh:value ex:notAList ;
82+
]
83+
] ;
84+
] ;
85+
mf:status sht:approved ;
86+
.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
mf:include <maxExclusive-001.ttl> ;
2727
mf:include <maxInclusive-001.ttl> ;
2828
mf:include <maxLength-001.ttl> ;
29+
mf:include <maxListLength-001.ttl> ;
2930
mf:include <memberShape-001.ttl> ;
3031
mf:include <minCount-001.ttl> ;
3132
mf:include <minCount-002.ttl> ;
3233
mf:include <minExclusive-001.ttl> ;
3334
mf:include <minExclusive-002.ttl> ;
3435
mf:include <minLength-001.ttl> ;
36+
mf:include <minListLength-001.ttl> ;
3537
mf:include <node-001.ttl> ;
3638
mf:include <node-002.ttl> ;
3739
mf:include <nodeKind-001.ttl> ;
@@ -47,4 +49,5 @@
4749
mf:include <singleLine-001.ttl> ;
4850
mf:include <uniqueLang-001.ttl> ;
4951
mf:include <uniqueLang-002.ttl> ;
52+
mf:include <uniqueMembers-001.ttl> ;
5053
.

0 commit comments

Comments
 (0)