Quick Reference#
Todo
Move this reference into “SHACL Guide for Policy Writers”?
SHACL Constraint Components#
Component |
Purpose |
Example |
|---|---|---|
|
Cardinality |
At least 1 author, at most 10 |
|
Literal type |
Must be a string |
|
Instance type |
Must be a Person |
|
Node kind |
Must be IRI, not blank node |
|
Specific value |
Must be “Apache-2.0” |
|
Value set |
Must be one of listed options |
|
String length |
Description at least 50 chars |
|
Regular expression |
Email must match pattern |
|
Counted sub-shape |
At least 1 author from HZDR |
|
Logic |
Must not be a bot |
Parameter Types#
These types must be supported by implementations. More types may be available.
Outer Types:
sc:Scalar- Single valuerdf:List- Ordered list
Inner Types:
xsd:string,xsd:anyURI,xsd:booleanxsd:integer,xsd:int,xsd:decimal,xsd:float,xsd:doublerdfs:Resource
Configuration Type Mapping:
TOML or JSON string →
xsd:string,xsd:anyURI,rdfs:ResourceTOML or JSON integer →
xsd:integer,xsd:int,xsd:decimalTOML or JSON float →
xsd:decimal,xsd:float,xsd:doubleTOML or JSON boolean →
xsd:boolean
Parameter Definition Template#
<parameter-name> a sc:Parameter ;
sc:parameterOuterType <scalar-or-collection-type> ;
sc:parameterInnerType <datatype> ;
sc:parameterConfigPath "<config-key>" ;
sc:parameterDefaultValue <default-value> .
Configuration Template#
[policies.<policy-id>]
source = "<policy-url-or-path>"
[policies.<policy-id>.parameters]
<config-key> = <value>