W3C SPARQL-RL test suite
Each of the 203 syntax, well-formedness, stratification and evaluation entries is stored as a rule set and a test. Running an evaluation entry shows the inference graph it produces.
This site runs a read-only sqlib instance with three libraries. The first holds the 203 entries of the W3C SPARQL-RL test suite as sqlib tests. The second is a course in SPARQL rules, taken in Claude or ChatGPT through sqlib's tutorial MCP App. Each lesson lists the suite entries that test the behaviour it teaches. The third holds rules using aggregates, an extension sqlib implements from a proposal the specification does not include.
Each of the 203 syntax, well-formedness, stratification and evaluation entries is stored as a rule set and a test. Running an evaluation entry shows the inference graph it produces.
Ten lessons, from a first rule to stratification and the ground graph. Each lesson is a tag, each worked example a rule set, and each exercise a test.
Rule sets using GROUP, the aggregation element proposed in w3c/data-shapes#1347. Each is tagged with the behaviour it shows, and most have a test. How aggregates work.
An endpoint you register is stored in your browser's localStorage. Queries against it are sent from the browser tab, so the query text and results do not pass through the sqlib API. The endpoint must send CORS headers for the browser to read its responses.
13d452b9b8ec9c863967, copied unedited into sqlib-demosThe report is produced when the site is built and does not change afterwards. To run an entry again, open it in the library and press Run.
sqlib's MCP server publishes Views: HTML documents that an MCP Apps-capable chat client, such as Claude or ChatGPT, renders in a sandboxed frame inside the conversation. The app.tutorial.open tool opens the course in a View with each lesson's objectives, worked examples and exercises, edited in a CodeMirror editor with SRL syntax support.
While you edit, the View reports whether the rule set parses, is well-formed and stratifies, which are the three checks the W3C suite makes of a document. Each rule's stratum is shown beside it.
An answer that fails analysis is rejected before it runs. Otherwise it runs over the lesson's data graph, and the result is compared with the expected inference graph. Missing and unexpected triples are listed.
The View reports the open lesson and each run's result to the chat model. Ask for a hint adds your current attempt to the conversation. Progress is not stored and is lost when the View closes.
GROUP is the aggregation element proposed for SPARQL-RL in w3c/data-shapes#1344, with the grammar of w3c/data-shapes#1347. Where that pull request leaves the meaning open, sqlib follows the behaviour clarified in later discussion in w3c/data-shapes#840. sqlib accepts it only when the FEATURE_RULE_AGGREGATES flag is on, which this site sets.
RULE { ?x :numChildren ?n }
WHERE {
?x a :Person
GROUP BY ?x { ?y :childOf ?x } [ ?n := COUNT(*) ]
}
BY variables, the only variables it shares with the rest of the rule. A BY variable may be bound before the GROUP or supplied by the pattern. With no BY, every match is one group.GROUP is kept, with every variable bound in it, and gains the BY variables and the results. A second GROUP keeps the first one's result.GROUP, as a variable a subquery does not project belongs to the subquery: one of the same name before or after it is a different variable.COUNT(*), COUNT(DISTINCT ?v), SUM, MIN and MAX, and one GROUP can assign several results.SUM.GROUP, an empty group gives 0 for COUNT and SUM, and MIN and MAX have no value, so the row is dropped. A key only the pattern supplies has no value for an empty group, so there is no row.SET does.BY is not well-formed. Correlation therefore has to be stated, and renaming a variable cannot silently change what is counted.AVG, SAMPLE and GROUP_CONCAT, an expression as an argument, and DISTINCT outside COUNT are rejected, as #1347's grammar does not include them.NOT or another GROUP, and a GROUP cannot appear inside NOT.GROUP reads its own output does not stratify. A rule with a GROUP runs once, in a stratum above every rule that derives what it counts, so the counted triples are complete before it fires.HAVING; a FILTER on the result, after the GROUP, filters the same rows.GROUP compiles to a SPARQL 1.2 program, like every SRL rule. The GROUP becomes a subquery grouped by the BY variables and joined to the rest of the rule, OPTIONAL when every key is bound before it, written only with forms SPARQL 1.1 already had.Add the server URL below as a custom connector in your chat client. The chat uses your existing Claude or ChatGPT plan, so this site needs no API key or account. The server has no authentication and publishes only read-only tools.
…
Open the sqlib SPARQL rules tutorial at lesson 1.
These steps were checked on 2026-09-24; Claude and ChatGPT change these menus from time to time. On Claude Team and Enterprise plans, an organisation owner must add the connector first.
The site runs an unmodified sqlib release. The sqlib-demos repository adds the suite files, the course, and configuration that sets the API to read-only.
/sqlib.
ui://sqlib/tutorialBuilt from sqlib-demos: the Docker image pins a sqlib revision and seeds the libraries from committed files. Before deployment, scripts/check-readonly-contract.sh checks that the API refuses writes.
sqlib stores parameterised SPARQL queries, rule sets, tests and ETL jobs as versioned RDF, and provides a web application, a REST API and an MCP server. This demo covers its SPARQL-RL implementation.