Shapes Constraint Language (SHACL) [1] is a World Wide Web Consortium (W3C) specification for validating graph-based data against a set of conditions. Among others, SHACL includes features to express conditions that constrain the number of values that a property may have, the type of such values, numeric ranges, string matching patterns, and logical combinations of such constraints. SHACL also includes an extension mechanism to express more complex conditions in languages such as SPARQL.

Shapes Constraint Language
StatusPublished W3C Recommendation (20 July 2017)
Year started2015
EditorsHolger Knublauch, Dimitris Kontokostas
Base standardsRDF, SPARQL
Related standardsRDFS, OWL
DomainSemantic Web
AbbreviationSHACL
Websitewww.w3.org/TR/shacl/

A SHACL validation engine takes as input a data graph and a graph containing shapes declarations and produces a validation report that can be consumed by tools. All these graphs can be represented in any Resource Description Framework (RDF) serialization formats including JSON-LD or Turtle. The adoption of SHACL may influence the future of linked data.[2]

World Wide Web Consortium published the following SHACL Specifications:

  • SHACL (W3C Technical Recommendation) is the main document, defining the features of SHACL Core and its extension mechanism called SHACL-SPARQL. SHACL Core defines the basic syntax and structure of shapes, constraints, the built-in kinds of constraints, and how to link shapes to data nodes. SHACL-SPARQL defines how to express constraints that are not covered by the built-in constraint kinds.
  • SHACL Advanced Features (W3C Working Group Note), the most recent version of which is maintained by the SHACL Community Group defines support for SHACL Rules, a powerful feature (inspired by SPIN rules) for data transformations, inferences and mappings based on data shapes. Also includes extensions of SHACL-SPARQL such as user-defined functions.
  • SHACL JavaScript Extensions (W3C Working Group Note) defines how JavaScript can be used to express constraints, rules, functions and other features. This covers similar ground as SHACL-SPARQL, but using JavaScript as its execution language.
  • SHACL Compact Syntax (SHACL Community Group Report).

Further Reading and Commercial ToolsEdit

Open Source ToolsEdit

The SHACL Test Suite and Implementation Report linked to from the SHACL W3C specification lists some open source tools that could be used for SHACL validation as of June 2019. By the end of 2019 many commercial RDF database and framework vendors announced support for at least SHACL Core.

Some of the open source tools listed in the report are:

SHACL Playground is a free SHACL validation service implemented in JavaScript.

Eclipse rdf4j is an open source Java framework for processing RDF data. It now supports SHACL validation.

ReferencesEdit