Shapeshift reference¶
The SHACL that shifty shape export writes for each construct, the
reserved words, and the commands. The Shapeshift language explains the constructs.
Constructs in SHACL¶
Targets¶
Shapeshift |
SHACL |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
a SPARQL target over every node, with |
Fields¶
A field is a property shape on its path. A shape with a single field is exported as that property shape.
Shapeshift |
SHACL |
|---|---|
|
|
|
|
|
|
|
|
|
the test |
|
|
|
|
|
|
|
|
|
|
|
|
Tests¶
Shapeshift |
SHACL |
|---|---|
|
|
|
|
|
|
|
a blank-node shape |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
both bounds |
|
|
|
|
On a line, is T tests the node itself. is a C puts sh:class C
on the shape, and is one of ex:x requires that exact node.
Literals¶
Shapeshift |
RDF |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Paths¶
Shapeshift |
SHACL |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
the path, substituted where it is used |
Names, groups, and frames¶
Shapeshift |
SHACL |
|---|---|
|
|
|
a property shape |
|
|
|
the test |
|
|
|
|
row |
only |
|
|
|
|
|
|
|
|
|
a shape for each distinct argument list, with
|
Annotations¶
Shapeshift |
SHACL |
|---|---|
|
|
|
|
|
|
|
|
An export flags what other SHACL engines need to know, on the file’s
owl:Ontology node:
shapeshift:recursive truewhen a shape refers to itself.shapeshift:shapeTargetsorshapeshift:sparqlTargetswhen it uses those targets.
Reserved words¶
These words are keywords and cannot name a shape, a path, or a parameter:
a above and any as at base below between blank datatype different doc each
every exactly false flags for from import iri is language least length
literal matches matching message most node none of one only optional or
path pattern prefix properties required same self severity shape sparql
then these to true unique up value when with
Datatype words, such as string and integer, aren’t reserved. Where a
test goes, though, they always mean the xsd datatype. A shape named
string is reached only with matches string.
Commands¶
shifty shape works on .shm files. Run shifty shape <command>
--help for every option.
Command |
Does |
|---|---|
|
Parse, resolve imports, and build. Prints diagnostics; exits 1 on an
error. |
|
Build and print a summary, or the compiled schema as JSON. |
|
Print the file in the standard layout, keeping comments and docs.
|
|
Write the shapes as SHACL Turtle. |
|
Validate data and report failures against the lines of the file.
|
|
List the import closure. |
|
Show one shape’s source, algebra, and targets. |
|
An interactive session: define shapes, load data, validate, save. |
Every command that reads imports (all but fmt and repl) takes:
--map IRI=PATH, to read an RDF import from a local file.--fetch, to download imports that aren’t mapped.
Editors¶
Tree-sitter.
crates/experimental/tree-sitter-shapeshiftis a grammar for.shm, with highlighting queries. Rust code reaches it asshifty_experimental::shapeshift::grammar, with thetree-sitterfeature.Pygments.
docs/_ext/shapeshift_lexer.pyregisters theshapeshiftandshmlanguages. It highlights these pages.