-
Notifications
You must be signed in to change notification settings - Fork 40
SHACL
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). RDFUnit reports all errors in the Test-Driven Data Validation Ontology -- that has greatly inspired the SHACL Validation Reporting vocabulary.
If you want to get the results back with the exact SHACL violation Reporting vocabulary, use -r shacl -o ttl
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-doc1,shacl-doc2> -e http://ex.co/sparql \
-g http://ex.co/g1,http://ex.co/g2 \
-eu <endpoint-username> -ep <endpoint-password>
[-r shacl -o ttl,html]
You can validate RDF files against SHACL definitions with
$ bin/rdfunit -d <rdf-doc> -s <shacl-doc1,shacl-doc2> [-r shacl -o ttl,html]
or, if the SHACL constraints are inside the file use (this option cannot apply for SHACL with SPARQL endpoints)
$ bin/rdfunit -d <rdf-doc> [-r shacl -o ttl,html]