Skip to main content

SHACL shapes file support

For error-checking and validation of RDF graph data, data.world supports the Shapes Creation Language, or SHACL. SHACL allows the user to specify a rich variety of constraints (called shapes) which the RDF files in a dataset should meet.  To add SHACL constraints to a dataset, specify the constraints (in the Turtle RDF format) in a file called shacl.ttl and add it to the dataset.  If such a SHACL file is in the dataset, data.world will validate any other ingested data against those rules, and add the resulting SHACL result triples to the dataset’s graph.  You can then query for those triples to see which rules (if any) have been violated, and by which resources in your graph.  Note that only ingested data is validated against the SHACL rules. A full introduction to SHACL exceeds the scope of this document, but the full shape language specification can be found here.

Note

Note: Virtualized data and R2RML mapped data are not validated.

Example - SHACL

Important

All the links in the following examples open datasets/projects in the data.world open data community. For best experience, make sure you are logged in to the application when you click these links.

Here is a simple query for getting error reports for SHACL rules violations:

PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-shacl/>
PREFIX sh: <http://www.w3.org/ns/shacl#>

SELECT ?node ?path ?message
{
    ?result a                sh:ValidationResult.
    ?result sh:focusNode     ?node.
    ?result sh:resultMessage ?message.
    ?result sh:resultPath    ?path.
}

Run query

Here is what it looks like on data.world:

SHACL_report_query.png