Theory
Common property constraints:
| Constraint | Meaning |
|---|---|
sh:minCount n | at least n values |
sh:maxCount n | at most n values |
sh:datatype xsd:T | each literal has datatype T |
sh:class :C | each value is an instance of class C |
minCount, maxCount, datatype, class.
Common property constraints:
| Constraint | Meaning |
|---|---|
sh:minCount n | at least n values |
sh:maxCount n | at most n values |
sh:datatype xsd:T | each literal has datatype T |
sh:class :C | each value is an instance of class C |
Worked example — combining constraints on one property.
All constraints on the same property go inside a single sh:property blank node. You don't nest — you just list them with ;:
@prefix sh: <http://www.w3.org/ns/shacl#> .
:MasterShape a sh:NodeShape ;
sh:targetClass :Master ;
sh:property [
sh:path :teaches ;
sh:class :Ninja ;
sh:minCount 1 ;
sh:maxCount 3
] .
This shape says: every :Master must teach at least 1 and at most 3 things, and each of those things must be a :Ninja. Copy this template, then adapt the path / class / counts for the challenge below.
Reading in progress · 0 of 3 activities done