You would like to edit SHACL, but you are wondering how to get started ? Start from Excel.
Start by downloading the template file here
The file has the following structure:
sh:targetClass
and other constraints:^sh:property
.sh:path
. Property paths are supported, you can write them either the SHACL way Turtle, e.g. [sh:inversePath foaf:knows]
,
or the SPARQL way, e.g. ^foaf:knows
, which will be converted automagically in SHACL.URI
, based on the line number.sh:minCount
: minimum cardinality that the predicate/path must have;sh:maxCount
: maximum cardinality that the predicate/path must have;sh:nodeKind
: type of nodes that the values must have (usually sh:IRI
or sh:Literal
);sh:datatype
: for literal values, the expected datatype of the values, e.g. xsd:string
, xsd:integer
, etc. ;sh:class
: expected class that the values of the predicate/path must have, if only one. If more than one, use the sh:or
column;sh:node
: if needed, expected shape that the values of the predicate/path must follow. This must be a reference to a URI of NodeShape from the first sheet;Once you have filled in the Excel file, you can convert it to SHACL using the xsl2rdf converter. The converter is available in different packagings : online API, command-line app, Java lib, and also an online Excel conversion form which is the most practical solution to start with :
Test how your SHACL looks like by uploading it in the documentation generator.
This kind of SHACL specification is also used to configure and fine-tune the Sparnatural query builder Sparnatural can use plain SHACL but it has its own custom SHACL Excel template with additionnal annotations.
For more information about how to configure Sparnatural in SHACL, see Sparnatural documentation website.