Skip to content
Dimitris Kontokostas edited this page Oct 27, 2017 · 10 revisions

RDFUnit supports SHACL but not through the Test-Generators & Patterns approach as it does for DSP and Resource Shapes.

Whenever RDFUnit tries to read the provided constraints, it searches for SHACL constraints as well and executes them along with the other type of constraints it may find (OWL-CWA, Schema.org, DSP, RS). and reports all errors in the RDFUnit result ontology that has greatly inspired the SHACL ontology.

If you want to get the results back with the SHACL violation Reporting vocabulary, use -r shacl in the command line.

RDFUnit has very good coverage of SHACL-Core and SHACL-SPARQL.

Note that all supported SHACL constructs can be executed directly on a SPARQL endpoint, you do not need to have the dataset in memory in a Jena model. You can also limit the execution in a specific graph (or a set of graphs). e.g.

$ bin/rdfunit -s <shacl-doc> -e http://ex.co/sparql \
              -g http://ex.co/g1,http://ex.co/g2 \
              -eu <endpoint-username> -ep <endpoint-password>

If you keep the shapes directly in your endpoint, RDFUnit can identify them automatically with e.g.

$ bin/rdfunit -g http://ex.co/g1,http://ex.co/g2 \
              -eu <endpoint-username> -ep <endpoint-password>

You can validate RDF files against SHACL definitions with

$ bin/rdfunit -d <rdf-doc> -s <shacl-doc>

or again if the SHACL constraints are inside the file use

$ bin/rdfunit -d <rdf-doc>