- Source: https://github.com/VladimirAlexiev/shaclc-mode
- Author: Vladimir Alexiev, Ontotext Corp
Many people think that semantic models should be described with RDF Shapes, not just ontologies. SHACL is the W3C standard for specifying shapes, and SHEX is a popular competitive standard.
SHACL is very verbose because it expresses shapes as RDF triples. SHACL Compact Syntax (SHACLC) is a dedicated syntax modeled after SHEX that is a lot more compact and nicer to work with.
Just like there is shexc-mode for editing SHEX in Emacs,
this creates a shaclc-mode
(in fact this mostly borrows from shexc-mode
).
The easiest way to understand the benefits of SHACLC compared to SHACL is by looking at some example shapes from the euBusinessGraph semantic model:
- SHEX has a compact dedicated syntax (in addition to JSON and RDF representations): see ebg-shapes.shex, 143 lines
- SHACL is very verbose because all constructs are represented in triples: see ebg-shapes.shacl, 504 lines (the shot below shows only 6 properties of Company)
- SHACLC adds a compact dedicated syntax, so SHACLC schemas are easy to understand: see ebg-shapes.shaclc, 183 lines (35 lines are prefixes)
- Syntax highlighting
- Syntax checking using
flycheck
andshaclconvert
(see TQ SHACL below)
- Comment/uncomment block with
M-;
- Index of shape definitions (
imenu
) and panel on the right (imenu-list
)
- Optionally, byte compile
shaclc-mode.el
- Add this to
.emacs
(add-to-list 'load-path "{path-to-shaclc}")
(autoload 'shaclc-mode "shaclc-mode" "Major mode for SHACLC (SCHACL Compact Syntax)" t)
(add-to-list 'auto-mode-alist '("\\.\\(shaclc\\|shc\\)$" . shaclc-mode))
The TQ SHACL API implements SHACLC since June 2000.
Ontotext's shaclconvert tool is a simple CLI on top of the TQ API. It is not open sourced yet but we hope to merge it to TQ SHACL in the future.
Bugs and issues: https://github.com/TopQuadrant/shacl/search?q=shaclc&type=issues
Starting June 2020, Jena now includes SHACL and SHACLC processing in riot
and a new command shacl
:
- Documentation: https://jena.apache.org/documentation/shacl/
- Source: https://github.com/apache/jena/tree/main/jena-shacl
- Tests: https://github.com/apache/jena/tree/main/jena-shacl/src/test
Bugs and issues: https://issues.apache.org/jira/issues/?jql=text~shaclc
- Make an ELPA package
- Use SHACLC.g4 grammar to make highlighting better
- Merge
shaclconvert
to TopQuadrant SHACL - Fix bugs in
shaclconvert
reading and writing - Make SHACLC (see TopQuadrant/shacl#98) nearly lossless so it can be round-tripped with SHACL
Help wanted!