#1294: WG New Spec: SHACL 1.2 Inference Rules

Visit on Github

Opened Oct 27, 2026

Specification

https://w3c.github.io/data-shapes/shacl12-inference-rules/

Explainer

https://w3c.github.io/data-shapes/shacl12-inference-rules/#abstract

Links

SHACL defines an RDF vocabulary to describe shapes - collections of constraints that apply to a set of nodes. Shapes can be associated with nodes using a flexible target mechanism, e.g. for all instances of a class. One focus area of SHACL is data validation. However, the same principles of describing data patterns in shapes can also be exploited for other purposes. SHACL inference rules build on SHACL to form a light-weight RDF vocabulary for the exchange of rules that can be used to derive inferred RDF triples from existing asserted triples.

The SHACL rules feature defined in this document includes a general framework using the properties such as sh:rule and sh:condition, plus an extension mechanism for specific rule types. This document defines two such rule types: SHACL SPARQL rules and triple rules. This document also defines a declarative mechanism for SPARQL rule templates.

  • A description of the problems that end-users were facing before this proposal:

SHACL has long been used for generating new triples, principally via the mechanisms described in 2017's SHACL Advanced Features Working Group Note. This specification improves on, slightly extends and formalises SHACL AF.

  • Alternatives considered:

To do nothing and keep using SHACL AF. This was deemed unacceptable since we have had innovation in the area of additional rule types that can be used with SHACL, e.g. SPARQL RL. We needed to ensure that SHACL reasoning and SPARQL RL etc. were compatible.

  • Examples of how to use the proposal to solve the end-users' problems:
  1. query targetting

Use a SPARQL CONSTRUCT query like this to generate the area of a rectangle:

CONSTRUCT {
	$this ex:area ?area .
}
WHERE {
	$this ex:width ?width .
	$this ex:height ?height .
	BIND (?width * ?height AS ?area) .
}

Wrap that SPARQL query in logic that refines the targetting of only particular rectangles using SHACL.

  1. Rule ordering / once

Wrap a SPARQL CONSTRUCT statement in a sh:SPARQLRule statement that allows it to be run only once by setting sh:runOnce true.

  • What do the end-users experience with this proposal:

An extension to the SPARQL vocabulary allowing for the expression of simple triple-pattern rules, SPARQL rules or other kinds of rules such as SPARQL RL rules.

  • User research you did to validate the problem and/or design, if any:

We formalised the approach taken in SHACL Advanced Features and considered what the inclusion of other forms of rules would require, not just the triple patter and SPARQL rules provided for directly in the document. This was forced by the creation of SPARQL RL but the approach taken will allow other forms of rules too, such as N3.

  • Web Platform Tests: N/A

The specification

Where and by whom is the work is being done?

  • GitHub repo: https://github.com/w3c/data-shapes/
  • Primary contacts:
    • Holger Knublauch @HolgerKnublauch, Top Quadrant, lead editor
    • Nicholas Car @nicholascar, KurrawongAI, WG co-chair
    • Matt Goldberg @mgberg, Corning, editor
    • Scott Henninger @scotthenninger, JPMorgan Chase & Co., editor
    • Livio Robaldo @liviorobaldo, Swansea University, editor
    • Simon Steyskal @simonstey, Siemens AG, editor
  • Organization/project driving the specification: editors' organizations
  • This work is being funded by: -
  • Primary standards group developing this feature: Data Shapes WG
  • Incubation and standards groups that have discussed the design: only Data Shapes WG. Review by RDF WG has been asked for

Feedback so far

You should also know that...

No response

<!-- Content below this is maintained by @w3c-tag-bot -->

Track conversations at https://tag-github-bot.w3.org/gh/w3ctag/design-reviews/1294

Discussions