README
¶
shaWell
A validator for SHACL using Well-founded semantics.
Contents
- Usage
- Flags
- How to Build
- Support for recursive SHACL
- Using Oxigraph as a SPARQL endpoint
- New: Support for other semantics
Usage
When running against a given RDF dataset with constraints:
./shawell --shaclDoc <location to a SHACL document, in Turtle format>
When running against a given SPARQL endpoint, with an external SHACL document:
./shawell --endpoint <URL to a Sparql endpoint> --shaclDoc <location to a SHACL document, in Turtle format>
Flags
| Flag | Short | Description |
|---|---|---|
--endpoint |
-e |
The URL to a SPARQL endpoint. |
--endpointUpdate |
-E |
The URL to a SPARQL endpoint used for updating the data. |
--local |
-l |
Start a local in-memory Oxigraph SPARQL server. Requires --dataIncluded. |
--shaclDoc |
-s |
The file path to a SHACL document. |
--dlv |
-d |
The location of the DLV binary used to evaluate recursive SHACL. |
--semantics |
-m |
The semantics for recursive SHACL: well-founded (default), stable-brave, stable-cautious, supported-brave or supported-cautious. See New: Support for other semantics. |
--clingo |
The location of the clingo binary, used by all semantics except well-founded. |
|
--dataIncluded |
-i |
Set this if the SHACL document also contains the data to be checked. |
--user |
-u |
The username needed to access the endpoint. |
--password |
-p |
The password needed to access the endpoint. |
--debug |
-D |
Activate debugging features. |
--silent |
-S |
Completely suppress any stdio output. |
--poseTestQuery |
-q |
A query to run and return the results. Used for testing/debug purposes. |
--omitVR |
-o |
Omit outputting the Validation Report. |
--outputVR |
-O |
A filepath used to export the Validation Report in Turtle notation. |
--forceLP |
-f |
Force the translation into logic programs. |
--stratified |
-T |
Use stratified evaluation: each rule and shape must carry a [N]/sw:stratum annotation; strata are evaluated in order 1..N instead of iterating to fixpoint. |
--demoOutputLP |
-L |
Output only the produced logic programs. |
--demoOutputQueries |
-Q |
Output only the produced SPARQL queries. |
How to Build
Install Go on your system. Installation files for Linux, macOS and Windows can be found here. Then simply run:
go build
There is an included script to automatically download the needed binaries. If the user wishes to download the needed binaries themselves, for example to use a different version, it's explained below how to do so.
Support for recursive SHACL
Currently, shaWell uses the solver DLV to compute well-founded models in the presence of recursion. The most recent versions of DLV can be found here. The tool expects by default that the binary to dlv is present in a local "bin/" subfolder and simply named "dlv". This can be overridden via the optional "-dlv" flag, which expects the location to a DLV binary.
Using Oxigraph as a SPARQL endpoint
Oxigraph is a lightweight, self-contained SPARQL 1.1 triple store that can be used in place of a SPARQL endpoint (this tool has been tested against such as GraphDB, but in theory works on any SPARQL endpoint).
Manually Downloading Oxigraph
Pre-built binaries are available on the Oxigraph releases page. Download the binary that matches your platform (e.g. oxigraph_linux_x86_64 on 64-bit Linux) and place it under bin/oxigraph:
# Example for Linux x86-64 — adjust the version and filename for your platform
VERSION=0.5.7
curl -L "https://github.com/oxigraph/oxigraph/releases/download/v${VERSION}/oxigraph_linux_x86_64" \
-o bin/oxigraph
chmod +x bin/oxigraph
The tool also accepts an oxigraph binary anywhere on your PATH, so a system-wide install works equally well. Manually downloading is optional, since the tool, as with dlv, can detect when the oxigraph binary is missing (or not in the right directory and name), and initiate the script to download all missing binaries automatically.
Manual mode: external Oxigraph server
If you want to keep the store running between invocations, start Oxigraph manually first:
bin/oxigraph serve --location /tmp/oxigraph-data --bind 127.0.0.1:7878
Then point shaWell at its endpoints:
./shawell \
--endpoint http://127.0.0.1:7878/query \
--endpointUpdate http://127.0.0.1:7878/update \
--shaclDoc <path/to/document.ttl>
New: Support for other semantics
shaWell was originally written just to support the well-founded semantics of SHACL [1,2]. However, its use of logic programs enables it to easily encode other logic-based semantics as well, such as the supported model semantics of Corman et al. [3] and the stable model semantics of Andreşel et al. [4].
shaWell now supports these as well, by use of the --semantics (-m) flag:
--semantics |
A target is valid if | Solver |
|---|---|---|
well-founded (default) |
it is true in the well-founded model | DLV |
stable-brave |
it is true in some stable model (all targets in the same model) | clingo |
stable-cautious |
it is true in every stable model | clingo |
supported-brave |
it is true in some supported model (all targets in the same model) | clingo |
supported-cautious |
it is true in every supported model | clingo |
For example:
./shawell --shaclDoc <path/to/document.ttl> --semantics stable-cautious
Note: For now, shaWell only supports the two-valued versions of these other semantics.
For the four new semantics, a shapes graph without any stable (resp. supported) model on the data is never valid, since validation then fails for every target.
The four new semantics need clingo. shaWell looks for it, in order: at the path given by --clingo, on your PATH, in a Python virtual environment at bin/clingo-venv, and as bin/clingo. The included download script sets up the virtual environment.
The exit code reports the outcome of validation:
| Exit code | Meaning |
|---|---|
| 0 | the data is valid |
| 1 | an error occurred |
| 2 | the command line is invalid, e.g. an unknown flag or --semantics value |
| 3 | the data is not valid |
| 4 | the shapes graph has no stable (resp. supported) model on the data |
| 5 | the solver could not decide, e.g. because it was interrupted |
References
- Adrian Chmurovič and Mantas Šimkus. Well-founded Semantics for Recursive SHACL. Datalog 2.0 2022, CEUR Workshop Proceedings, Vol. 3203, pp. 2–13.
- Cem Okulmus and Mantas Šimkus. SHACL Validation under the Well-founded Semantics. KR 2024.
- Julien Corman, Juan L. Reutter and Ognjen Savković. Semantics and Validation of Recursive SHACL. ISWC 2018, LNCS 11136, pp. 318–336.
- Medina Andreşel, Julien Corman, Magdalena Ortiz, Juan L. Reutter, Ognjen Savković and Mantas Šimkus. Stable Model Semantics for Recursive SHACL. The Web Conference (WWW) 2020, pp. 1570–1580.
Documentation
¶
There is no documentation for this package.