[w3ctag/design-reviews] WG New Spec: SPARQL RL (Issue #1306)

nicholascar created an issue (w3ctag/design-reviews#1306)

### Specification

https://www.w3.org/TR/sparql-rl/

### Explainer

https://w3c.github.io/data-shapes/shacl12-overview/#whatsnew

### Links

- The WG's request for this TAG review: 
    - https://www.w3.org/2026/10/26-data-shapes-minutes.html#fee4
- Previous early design review, if any: 
    - N/A

#### An introduction to the feature, aimed at unfamiliar audiences: 

This document defines SPARQL-RL, a [Datalog](https://en.wikipedia.org/wiki/Datalog)-style rules language for RDF.

SPARQL-RL generates new RDF data by evaluating a set of declarative rules against an input RDF graph. Rules are written in a SPARQL-like text syntax.

SPARQL-RL supports negation as failure, which could lead to different inference graphs depending on the order in which rules are evaluated. To avoid this, rules are evaluated using the technique of stratification, which establishes an ordering among rules, ensuring that the same inference graph is always produced.

SPARQL-RL provides grouping and aggregation, with assignment of the aggregation function result to a variable in the body of a rule.

For information about SPARQL-RL in the context of SHACL 1.2, see [SHACL 1.2 Overview's _What's New in SHACL 1.2_ section](https://w3c.github.io/data-shapes/shacl12-overview/#whatsnew). In particular:

SHACL 1.2 Inference Rules defines an extension to SHACL for representing inference rules, in particular rules that can be linked to shapes. It was inspired by the SPARQL-based rules introduced by the SHACL Advanced Features and older technologies such as SPIN.

SPARQL 1.2 RL allows the representation and execution of Datalog-based rules using a SPARQL-like syntax. These have a straight-forward mapping to SPARQL CONSTRUCT statements and can be executed within a SHACL Inferencing Rules envelope, allowing for integration with other SHACL features such as node expressions. 

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

* inability to stratify (order) SPARQL inference statements
* inability to ensure SPARQL inferencing run-once
* inability to exchange RDF reasoning rules with a standard format
    * since the W3C's Rule Interchange Format (RIF) has not see wide/any adoption

#### Alternatives considered: 

A SHACL-specific rules language which was to be a direct evolution of SHACL-AF. That has been published as [SHACL 1.2 Inference Rules](https://www.w3.org/TR/shacl12-inference-rules/) but it was still thought necessary, or at least useful, to publish a ruls language for RDF inference without dependence on SHACL. 

A mapping to SPARQL is given in this document and, through that, integration with SHACL is achieved too.

- Examples of how to use the proposal to solve the end-users' problems: 

Encode RDF inference rules in stratified and terminating-guaranteed SPARQL-like syntax. These can be stored in .srl files and exchanged. This can replace the various custom rules languages that RDF DB vendors implement.
 
#### What do the end-users experience with this proposal: 

A new specification for SPARQL rules that can be stratified (ordered, with dependence) and with execution guarantees. This lets reasoning rules be packaged and reused with much more confidence than just SPARQL files which have no ordering or execution guarantees.

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

This specification was built on top of the previous Data Shapes WG NOTE output of [SHACL Advanced Features](https://www.w3.org/TR/shacl-af/). SHACL-AF was never made into a REC in 2017 and yet the _SHACL Rules_ part of it was implemented by vendors and open source communities. We included implementers in this WG to try and improve on SHACL AF and this SPARQL RL specification is one output of improvement, alongside SHACL 1.2 Inference Rules.

We also consulted with SPARQL and SPARQL-like rule implementor communities such as Apache Jena, Python's RDFLib and GraphDB. All were in favor of a tightly specified datalog-style SPARQL-like rules language.

#### Web Platform Tests: 

N/A - this is not a browser specification


### The specification

- [ ] Follows the [Web Platform Design Principles](https://www.w3.org/TR/design-principles/).
- [x] Includes Security and Privacy Considerations sections based on answers to the [Security/Privacy Questionnaire](https://www.w3.org/TR/security-privacy-questionnaire/).

### Where and by whom is the work is being done?

- GitHub repo: https://github.com/w3c/data-shapes/
- Primary contacts:
  - Andy Seaborne (@afs), Apache Foundation, lead editor
  - David Habgood (recalcitrantsupplant), KurrawongAI, editor
  - Nicholas Car (@nicholascar), KurrawongAI, WG co-chair
- Organization/project driving the specification:
  - Apache Foundation
  - KurrawongAI
  - GraphWise
  - Siemens
- This work is being funded by:
  - -
- Primary standards group developing this feature:
 - Data Shapes WG
- Incubation and standards groups that have discussed the design:
  - RDF & SPARQL Working Group


### Feedback so far

- Active horizontal reviews: 
   https://github.com/w3c/data-shapes/issues/893
- Multi-stakeholder feedback:
  - N/A
- Major unresolved issues with or opposition to this specification:
  - Scope reduced to solved issues only
- Status/issue trackers for implementations:
  - https://github.com/w3c/data-shapes/tree/gh-pages/shacl12-test-suite/tests/sparql-rl


### You should also know that...

_No response_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/1306
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/1306@github.com>

Received on Sunday, 8 November 2026 12:44:02 UTC