Skip to content

Issue 414: list constraints #416

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 53 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 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
8d7637a
chore: add vocab definitions for sh:minListLength, sh:maxListLength, …
jeswr Jun 28, 2025
990e698
chore: add list constraints
jeswr Jun 28, 2025
044c3e5
chore: mark sh:minListLength, sh:maxListLength and sh:uniqList as opt…
jeswr Jun 28, 2025
c0be857
chore: add list tests
jeswr Jun 28, 2025
e21007c
chore: cleanup sh:memberShape text deifnition
jeswr Jun 28, 2025
3f8c33a
chore: cleanup sh:memberShape text deifnition
jeswr Jun 28, 2025
480da45
fix list test url
jeswr Jun 28, 2025
175e03f
chore: update vocab, shacl and tests to make sh:minListLength, sh:max…
jeswr Jun 29, 2025
ba60f54
chore: separate list validators separate components in the spec document
jeswr Jun 29, 2025
2133631
chore: add examples to list constraints
jeswr Jun 29, 2025
61696f5
chore: fix unique members namespace
jeswr Jun 29, 2025
97ecfe6
chore: rename `uniqList` ->` uniqueMembers` in shacl shacl
jeswr Jun 30, 2025
8c6b52b
chore: fix reference to `UniqueMembersConstraintComponent` in vocab
jeswr Jun 30, 2025
5c72e8e
chore: remove blank node targetNodes for lists
jeswr Jun 30, 2025
ca91c2c
fix: make invalid SHACL lists a top-level violation
jeswr Jun 30, 2025
1c17cb0
fix: Use correct focusNode and value for maxListLength test
jeswr Jun 30, 2025
54f1500
fix: remove unnecessary maxCount and fix maxListLength name error in …
jeswr Jun 30, 2025
91bf091
chore: remove result messages from tests
jeswr Jun 30, 2025
99ca14f
chore: make sourceShape a property shape where applicable
jeswr Jun 30, 2025
9195eca
chore: remove lingering `uniqList` references
jeswr Jul 3, 2025
58daff6
Fixed membershape test case
HolgerKnublauch Jul 7, 2025
e01a2a6
Fixed missing sh:value at minListLength test
HolgerKnublauch Jul 7, 2025
77f8392
Fixed missing sh:value at uniqueMembers test case
HolgerKnublauch Jul 7, 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
464 changes: 462 additions & 2 deletions shacl12-core/index.html

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions shacl12-test-suite/tests/core/node/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@
mf:include <maxExclusive-001.ttl> ;
mf:include <maxInclusive-001.ttl> ;
mf:include <maxLength-001.ttl> ;
mf:include <maxListLength-001.ttl> ;
mf:include <memberShape-001.ttl> ;
mf:include <minExclusive-001.ttl> ;
mf:include <minInclusive-001.ttl> ;
mf:include <minInclusive-002.ttl> ;
mf:include <minInclusive-003.ttl> ;
mf:include <minLength-001.ttl> ;
mf:include <minListLength-001.ttl> ;
mf:include <node-001.ttl> ;
mf:include <nodeKind-001.ttl> ;
mf:include <not-001.ttl> ;
Expand All @@ -40,6 +43,7 @@
mf:include <pattern-002.ttl> ;
mf:include <reifierShape-001.ttl> ;
mf:include <reifierShape-002.ttl> ;
mf:include <uniqueMembers-001.ttl> ;
mf:include <xone-001.ttl> ;
mf:include <xone-duplicate.ttl> ;
mf:include <qualified-001.ttl> ;
Expand Down
63 changes: 63 additions & 0 deletions shacl12-test-suite/tests/core/node/maxListLength-001.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://datashapes.org/sh/tests/core/node/maxListLength-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:ListShape
rdf:type sh:NodeShape ;
sh:maxListLength 2 ;
# Satisfies all constraints
sh:targetNode ex:list0, rdf:nil ;
# Violates maxListLength constraint
sh:targetNode ex:list1, ex:notAList ;
.

ex:list0
rdf:first 1 ;
rdf:rest ( 2 ) .

ex:list1
rdf:first 1 ;
rdf:rest ( 2 3 ) .

<>
rdf:type mf:Manifest ;
mf:entries (
<maxListLength-001>
) ;
.

<maxListLength-001>
rdf:type sht:Validate ;
rdfs:label "Test of sh:maxListLength on node shape 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:list1 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MaxListLengthConstraintComponent ;
sh:sourceShape ex:ListShape ;
sh:value ex:list1 ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:notAList ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MaxListLengthConstraintComponent ;
sh:sourceShape ex:ListShape ;
sh:value ex:notAList ;
] ;
] ;
mf:status sht:approved ;
.
174 changes: 174 additions & 0 deletions shacl12-test-suite/tests/core/node/memberShape-001.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://datashapes.org/sh/tests/core/node/memberShape-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:IRIShape a sh:NodeShape ;
sh:nodeKind sh:IRI .

ex:IRIListShape
rdf:type sh:NodeShape ;
sh:memberShape ex:IRIShape ;
sh:targetNode ex:list0 ;
# Valid empty list
sh:targetNode rdf:nil ;
# ex:list1 is valid, the remainder trigger violations (including ex:list3 which has no properties in this graph)
sh:targetNode ex:list1, ex:list2, ex:list3, ex:list4, ex:list5, ex:list6, ex:list7, ex:list9 ;
.

ex:list0
rdf:first ex:Alice ;
rdf:rest (
ex:Bob
) ;
.

ex:list1
rdf:first ex:Alice ;
rdf:rest rdf:nil ;
ex:extraProperty "extra" ;
.

ex:list2
rdf:first ex:Alice ;
rdf:rest (
"Bob"
)
.

ex:list4
rdf:first ex:Alice ;
.

ex:list5
rdf:first "Charlie" ;
rdf:rest (
"Donna"
)
.

ex:list6
rdf:first "Charlie" ;
.

ex:list8 rdfs:label "Malformed SHACL List" .

ex:list7
rdf:first "Charlie" ;
rdf:rest ex:list8 ;
.

# using ex:list9 and ex:list10 to test recursive list error
ex:list9
rdf:first ex:Alice ;
rdf:rest ex:list10 ;
.

ex:list10
rdf:first "Bob" ;
rdf:rest ex:list9 .

<>
rdf:type mf:Manifest ;
mf:entries (
<memberShape-001>
) ;
.

<memberShape-001>
rdf:type sht:Validate ;
rdfs:label "Test of sh:memberShape on node shape 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:list2 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:IRIListShape ;
sh:value ex:list2 ;
sh:detail [
rdf:type sh:ValidationResult ;
sh:focusNode "Bob" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
sh:sourceShape ex:IRIShape ;
sh:value "Bob" ;
] ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:list3 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:IRIListShape ;
sh:value ex:list3 ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:list4 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:IRIListShape ;
sh:value ex:list4 ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:list5 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:IRIListShape ;
sh:value ex:list5 ;
sh:detail [
rdf:type sh:ValidationResult ;
sh:focusNode "Charlie" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
sh:sourceShape ex:IRIShape ;
sh:value "Charlie" ;
], [
rdf:type sh:ValidationResult ;
sh:focusNode "Donna" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
sh:sourceShape ex:IRIShape ;
sh:value "Donna" ;
]
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:list6 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:IRIListShape ;
sh:value ex:list6 ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:list7 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:IRIListShape ;
sh:value ex:list7 ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:list9 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MemberShapeConstraintComponent ;
sh:sourceShape ex:IRIListShape ;
sh:value ex:list9 ;
] ;
] ;
mf:status sht:approved ;
.
59 changes: 59 additions & 0 deletions shacl12-test-suite/tests/core/node/minListLength-001.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://datashapes.org/sh/tests/core/node/minListLength-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:ListShape
rdf:type sh:NodeShape ;
sh:minListLength 1 ;
# Satisfies all constraints
sh:targetNode ex:list0 ;
# Violates minListLength constraint
sh:targetNode rdf:nil, ex:notAList ;
.

ex:list0
rdf:first 1 ;
rdf:rest ( 2 ) .

<>
rdf:type mf:Manifest ;
mf:entries (
<minListLength-001>
) ;
.

<minListLength-001>
rdf:type sht:Validate ;
rdfs:label "Test of sh:minListLength on node shape 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 rdf:nil ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MinListLengthConstraintComponent ;
sh:sourceShape ex:ListShape ;
sh:value rdf:nil ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode ex:notAList ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MinListLengthConstraintComponent ;
sh:sourceShape ex:ListShape ;
sh:value ex:notAList ;
] ;
] ;
mf:status sht:approved ;
.
Loading