fbpx
Wikipedia

SHACL

Shapes Constraint Language[1] (SHACL) is a World Wide Web Consortium (W3C) standard language for describing Resource Description Framework (RDF) graphs. SHACL has been designed to enhance the semantic and technical interoperability layers of ontologies expressed as RDF graphs.[3]

SHACL
Shapes Constraint Language
AbbreviationSHACL
StatusPublished, W3C Recommendation [1]
Year started2015 (2015)[2]
First publishedOctober 8, 2015; 8 years ago (2015-10-08)[2]
OrganizationW3C
CommitteeRDF Data Shapes Working Group
Editors
  • Holger Knublauch
  • Dimitris Kontokostas
[1]
Base standards
Related standards
DomainSemantic Web
Websitewww.w3.org/TR/shacl/

SHACL models are defined in terms of constraints on the content, structure and meaning of a graph. SHACL is a highly expressive language. Among others, it 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 and JavaScript. SHACL Rules add inferencing capabilities to SHACL, allowing users to define what new statements can be inferred from existing (asserted) statements.

Terminology edit

SHACL lets its users describe shapes of data, targeting where a specific shape applies.

Property Shapes edit

A property shape describes characteristics of graph nodes that can be reached via a specific path. A path can be a single predicate (property) or a chain of predicates. A property shape must always specify a path. This is done by using sh:path predicate. One can think of property shapes that use simple paths as describing values of certain properties e.g., values of an age property or values of a works for property. Complex paths can specify a combination of different predicates in a chain, including the inverse direction, alternative predicates and transitive chains.

Property shapes can be defined as part of a node shape. In this case, a node shape points to property shapes using sh:property predicate. Property shapes can also be "stand-alone" i.e., completely independent from any node shapes.

Node Shapes edit

A node shape describes characteristics of specific graph nodes irrespective of how you get to them. It can, for example, be said that certain graph nodes must be literals or a URIs, etc. It is common to include property shapes into a node shape, effectively defining values of many different properties of a node.

For example, a node shape for an employee may incorporate property shapes for age and works for properties.

Constraints edit

A constraint is a way to describe different characteristics of values. A shape will contain one or more constraint declarations. SHACL provides many pre-built constraint types. For example, sh:datatype is used to describe the type of literal values e.g., if they are strings or integers or dates. sh:minCount is used to describe the minimum required number of values. sh:length is used to describe the number of characters for a value.

Targets edit

A target connects a shape with data it describes. The simplest way to specify a target is to say that a node shape is also a class. This means that its definition is applicable to all members (instances) of a class. Other ways to define a target of a shape are by:

  1. Explicitly saying that a shape targets members of a certain class. This can be done instead of making a node shape also a class.
  2. Saying that a shape targets a specific resource by giving its URI.
  3. Saying that a shape targets all subjects or all objects of triples with a certain predicate.
  4. Using a SPARQL query to select a set of resource to be targeted.

Target declarations can be included in a node shape or in a property shape. However, when a property shape is a part of a node shape, its own targets are ignored.

SHACL uses rdfs:subClassOf statements to identify targets. A shape targeting members of a class, also targets members of all its subclasses. In other words, all SHACL definitions for a class are inherited by subclasses.

Validation edit

SHACL enables validation of graphs. A SHACL validation engine takes as input a graph to be validated (called data graph) and a graph containing SHACL shapes declarations (called shapes graph) and produces a validation report, also expressed as a graph. All these graphs can be represented in any Resource Description Framework (RDF) serialization formats including JSON-LD or Turtle.

SHACL is fairly unique in its approach in that it builds-in not only the ability to specify a severity level of validation results, but also the ability to return suggestions on how data may be fixed if the validation result is raised. Built-in levels are Violation, Warning and Info, defaulting to Violation if no sh:severity has been specified for a shape. Users of SHACL can add other, custom levels of severity. Validation results may also have values for other properties, as described in the specification. For example, the property sh:resultMessage is designed to communicate additional textual details to users, including recommendations on how data may be fixed to address to validation result. In cases where a constraint does not have any values for sh:message in the shapes graph the SHACL processor may automatically generate other values for sh:resultMessage. Some SHACL processors (e.g., the one implemented by TopQuadrant) made these suggestions actionable in software, automating their application on user's request.

Specifications edit

World Wide Web Consortium published the following SHACL Specifications:

  • SHACL[1] (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[4] (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[5] (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[6] (SHACL Community Group Report).

Open-source tools edit

The SHACL Test Suite and Implementation Report[7] 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:

  • dotNetRDF SHACL - an online SHACL validator service written in the .NET Framework[8][9]
  • pySHACL - an open source SHACL validator library for command line use written in Python[10]
  • SHaclEX - a Scala implementation of both SHACL and ShEx[11]
  • TopBraid SHACL API - an open source implementation of SHACL by TopQuadrant, based on Apache Jena. It covers SHACL Core and SHACL-SPARQL validation as well as SHACL Advanced Features, SHACL Javascript Extension and SHACL Compact Syntax. The same code is used in the TopBraid commercial products.[12]

SHACL Playground is a free SHACL validation service implemented in JavaScript.[13]

Eclipse RDF4J is an open source Java framework by the Eclipse Foundation for processing RDF data, which supports SHACL validation.[14]

Commercial tools edit

SHACL is supported by most RDF Graph technology vendors including Cambridge Semantics (Anzo, coming in Q1 2022), Franz (AllegroGraph), Metaphacts, Ontotext (GraphDB), Stardog and TopQuadrant. There is even support in the commercial products that use property graph data model, such as Neo4J. [15]

Levels of implementation may vary. At minimum, vendors support SHACL Core. Some also support SHACL SPARQL for higher expressivity, while others may support SHACL Advanced Features which include rules and functions.

See also edit

References edit

  1. ^ a b c d Knublauch, Holger; Kontokostas, Dimitris, eds. (2017-07-20). "Shapes Constraint Language (SHACL)". W3C. RDF Data Shapes Working Group. Retrieved 2021-04-06.
  2. ^ a b "Shapes Constraint Language (SHACL) Publication History - W3C". W3C. Retrieved 2021-04-06.
  3. ^ "CAMSS Assessment of SHACL by the European Commission".
  4. ^ Knublauch, Holger; Allemang, Dean; Steyskal, Simon, eds. (2017-06-08). "SHACL Advanced Features". W3C. RDF Data Shapes Working Group. Retrieved 2021-04-06.
  5. ^ Knublauch, Holger; Maria, Pano, eds. (2018-01-09). "SHACL JavaScript Extensions". W3C. SHACL Community Group.
  6. ^ Knublauch, Holger; Maria, Pano, eds. (2018-01-09). "SHACL Compact Syntax". W3C. SHACL Community Group.
  7. ^ Labra Gayo, Jose Emilio; Knublauch, Holger; Kontokostas, Dimitris, eds. (2021-01-22). "SHACL Test Suite and Implementation Report". W3C.
  8. ^ Lang, Samu (n.d.). "dotNetRDF SHACL". langsamu.net. Retrieved 2021-04-06.
  9. ^ Lang, Samu (2019-06-01). "dotNetRDF SHACL validator service". GitHub. Retrieved 2021-04-07.
  10. ^ Sommer, Ashley; Car, Nicholas (2018-08-15). "RDFLib/pySHACL: A Python validator for SHACL". GitHub. Retrieved 2021-04-06.
  11. ^ Labra Gayo, Jose Emilio; et al. (Web Semantics Oviedo, University of Oviedo). "weso/shaclex: SHACL/ShEx implementation". GitHub. Retrieved 2021-04-06.
  12. ^ Knublauch, Holger (2015-05-24). "TopQuadrant/shacl: SHACL API in Java based on Apache Jena". GitHub. Retrieved 2021-04-06.
  13. ^ Knublauch, Holger (2017-05-01). "SHACL Playground". SHACL Playground. Retrieved 2021-04-07.
  14. ^ "Validating Neo4j graphs against SHACL".
  15. ^ Knublauch, Holger (2017-05-01). "SHACL Playground". SHACL Playground. Retrieved 2021-04-07.

Further reading edit

  • What is exciting about SHACL
  • SHACL Use Cases and Requirements, Sept. 2018
  • SHACL and OWL Compared
  • SHACL for SPIN Users
  • Combining GraphQL and SHACL
  • SHACL Wiki
  • SHACL Support in TopBraid Products
  • SHACL Support in GraphDB
  • SHACL Support in AllegroGraph
  • SHACL Support in Stardog

shacl, shapes, constraint, language, world, wide, consortium, standard, language, describing, resource, description, framework, graphs, been, designed, enhance, semantic, technical, interoperability, layers, ontologies, expressed, graphs, shapes, constraint, l. Shapes Constraint Language 1 SHACL is a World Wide Web Consortium W3C standard language for describing Resource Description Framework RDF graphs SHACL has been designed to enhance the semantic and technical interoperability layers of ontologies expressed as RDF graphs 3 SHACLShapes Constraint LanguageAbbreviationSHACLStatusPublished W3C Recommendation 1 Year started2015 2015 2 First publishedOctober 8 2015 8 years ago 2015 10 08 2 OrganizationW3CCommitteeRDF Data Shapes Working GroupEditorsHolger Knublauch Dimitris Kontokostas 1 Base standardsRDF SPARQLRelated standardsRDF Schema OWLDomainSemantic WebWebsitewww wbr w3 wbr org wbr TR wbr shacl wbr SHACL models are defined in terms of constraints on the content structure and meaning of a graph SHACL is a highly expressive language Among others it 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 and JavaScript SHACL Rules add inferencing capabilities to SHACL allowing users to define what new statements can be inferred from existing asserted statements Contents 1 Terminology 1 1 Property Shapes 1 2 Node Shapes 1 3 Constraints 1 4 Targets 2 Validation 3 Specifications 4 Open source tools 5 Commercial tools 6 See also 7 References 8 Further readingTerminology editSHACL lets its users describe shapes of data targeting where a specific shape applies Property Shapes edit A property shape describes characteristics of graph nodes that can be reached via a specific path A path can be a single predicate property or a chain of predicates A property shape must always specify a path This is done by using sh path predicate One can think of property shapes that use simple paths as describing values of certain properties e g values of an age property or values of a works for property Complex paths can specify a combination of different predicates in a chain including the inverse direction alternative predicates and transitive chains Property shapes can be defined as part of a node shape In this case a node shape points to property shapes using sh property predicate Property shapes can also be stand alone i e completely independent from any node shapes Node Shapes edit A node shape describes characteristics of specific graph nodes irrespective of how you get to them It can for example be said that certain graph nodes must be literals or a URIs etc It is common to include property shapes into a node shape effectively defining values of many different properties of a node For example a node shape for an employee may incorporate property shapes for age and works for properties Constraints edit A constraint is a way to describe different characteristics of values A shape will contain one or more constraint declarations SHACL provides many pre built constraint types For example sh datatype is used to describe the type of literal values e g if they are strings or integers or dates sh minCount is used to describe the minimum required number of values sh length is used to describe the number of characters for a value Targets edit A target connects a shape with data it describes The simplest way to specify a target is to say that a node shape is also a class This means that its definition is applicable to all members instances of a class Other ways to define a target of a shape are by Explicitly saying that a shape targets members of a certain class This can be done instead of making a node shape also a class Saying that a shape targets a specific resource by giving its URI Saying that a shape targets all subjects or all objects of triples with a certain predicate Using a SPARQL query to select a set of resource to be targeted Target declarations can be included in a node shape or in a property shape However when a property shape is a part of a node shape its own targets are ignored SHACL uses rdfs subClassOf statements to identify targets A shape targeting members of a class also targets members of all its subclasses In other words all SHACL definitions for a class are inherited by subclasses Validation editSHACL enables validation of graphs A SHACL validation engine takes as input a graph to be validated called data graph and a graph containing SHACL shapes declarations called shapes graph and produces a validation report also expressed as a graph All these graphs can be represented in any Resource Description Framework RDF serialization formats including JSON LD or Turtle SHACL is fairly unique in its approach in that it builds in not only the ability to specify a severity level of validation results but also the ability to return suggestions on how data may be fixed if the validation result is raised Built in levels are Violation Warning and Info defaulting to Violation if no sh severity has been specified for a shape Users of SHACL can add other custom levels of severity Validation results may also have values for other properties as described in the specification For example the property sh resultMessage is designed to communicate additional textual details to users including recommendations on how data may be fixed to address to validation result In cases where a constraint does not have any values for sh message in the shapes graph the SHACL processor may automatically generate other values for sh resultMessage Some SHACL processors e g the one implemented by TopQuadrant made these suggestions actionable in software automating their application on user s request Specifications editWorld Wide Web Consortium published the following SHACL Specifications SHACL 1 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 4 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 5 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 6 SHACL Community Group Report Open source tools editThe SHACL Test Suite and Implementation Report 7 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 dotNetRDF SHACL an online SHACL validator service written in the NET Framework 8 9 pySHACL an open source SHACL validator library for command line use written in Python 10 SHaclEX a Scala implementation of both SHACL and ShEx 11 TopBraid SHACL API an open source implementation of SHACL by TopQuadrant based on Apache Jena It covers SHACL Core and SHACL SPARQL validation as well as SHACL Advanced Features SHACL Javascript Extension and SHACL Compact Syntax The same code is used in the TopBraid commercial products 12 SHACL Playground is a free SHACL validation service implemented in JavaScript 13 Eclipse RDF4J is an open source Java framework by the Eclipse Foundation for processing RDF data which supports SHACL validation 14 Commercial tools editSHACL is supported by most RDF Graph technology vendors including Cambridge Semantics Anzo coming in Q1 2022 Franz AllegroGraph Metaphacts Ontotext GraphDB Stardog and TopQuadrant There is even support in the commercial products that use property graph data model such as Neo4J 15 Levels of implementation may vary At minimum vendors support SHACL Core Some also support SHACL SPARQL for higher expressivity while others may support SHACL Advanced Features which include rules and functions See also editShape Expressions ShEx References edit a b c d Knublauch Holger Kontokostas Dimitris eds 2017 07 20 Shapes Constraint Language SHACL W3C RDF Data Shapes Working Group Retrieved 2021 04 06 a b Shapes Constraint Language SHACL Publication History W3C W3C Retrieved 2021 04 06 CAMSS Assessment of SHACL by the European Commission Knublauch Holger Allemang Dean Steyskal Simon eds 2017 06 08 SHACL Advanced Features W3C RDF Data Shapes Working Group Retrieved 2021 04 06 Knublauch Holger Maria Pano eds 2018 01 09 SHACL JavaScript Extensions W3C SHACL Community Group Knublauch Holger Maria Pano eds 2018 01 09 SHACL Compact Syntax W3C SHACL Community Group Labra Gayo Jose Emilio Knublauch Holger Kontokostas Dimitris eds 2021 01 22 SHACL Test Suite and Implementation Report W3C Lang Samu n d dotNetRDF SHACL langsamu net Retrieved 2021 04 06 Lang Samu 2019 06 01 dotNetRDF SHACL validator service GitHub Retrieved 2021 04 07 Sommer Ashley Car Nicholas 2018 08 15 RDFLib pySHACL A Python validator for SHACL GitHub Retrieved 2021 04 06 Labra Gayo Jose Emilio et al Web Semantics Oviedo University of Oviedo weso shaclex SHACL ShEx implementation GitHub Retrieved 2021 04 06 Knublauch Holger 2015 05 24 TopQuadrant shacl SHACL API in Java based on Apache Jena GitHub Retrieved 2021 04 06 Knublauch Holger 2017 05 01 SHACL Playground SHACL Playground Retrieved 2021 04 07 Validating Neo4j graphs against SHACL Knublauch Holger 2017 05 01 SHACL Playground SHACL Playground Retrieved 2021 04 07 Further reading editThis further reading section may need cleanup Please read the editing guide and help improve the section April 2021 Learn how and when to remove this message What is exciting about SHACL SHACL Use Cases and Requirements Sept 2018 SHACL and OWL Compared SHACL for SPIN Users Combining GraphQL and SHACL SHACL Wiki SHACL Support in TopBraid Products SHACL Support in GraphDB SHACL Support in AllegroGraph SHACL Support in Stardog Retrieved from https en wikipedia org w index php title SHACL amp oldid 1208810697, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.