sqlib is a self-hosted library for SPARQL queries and SPARQL RL rules. Each query keeps its full version history and declares its own parameters. Run it from the web UI, over REST or from an MCP client.
All of these work on the same stored queries, in a library you host yourself.
A VALUES clause with one all-UNDEF row declares a parameter, and LIMIT 0001 declares a named number. sqlib parses the query once and writes each argument into its slot as one escaped RDF term, so an argument cannot change the query’s structure.
VALUES ?city { UNDEF } VALUES (?from ?to) { (UNDEF UNDEF) } LIMIT 0001
Every save creates an immutable version. A run can pin a version for a reproducible result, or follow the latest.
A published library exposes each query as an MCP tool and an HTTP route, with one plain argument per parameter.
Chain queries on a canvas. One step's results become the next step's arguments.
Write explanation between runnable queries, and name each result for use further down.
Author inference rules in SRL and run them against any graph.
Attach tests to a query or rule set. Compare runs across backends and versions.
sqlib compared to the common ways teams keep SPARQL today.
| Approach | Versioned | Safe parameters | Callable by agents |
|---|---|---|---|
| sqlib | every save | bound after parsing | MCP and HTTP |
| .rq files in a repository | with git | string templates | no |
| Queries inside application code | with the app | string concatenation | no |
| Saved queries in a triplestore UI | overwritten | no | no |
Local setup is three commands. A container image is available for deployment.
One process serves the API and the MCP endpoint, with an Oxigraph store on disk.
pnpm install pnpm build just run-local-memory
Write SPARQL in the editor. sqlib finds its parameters and saves version 1.
SELECT ?name WHERE { VALUES ?city { UNDEF } ?p ex:city ?city ; ex:name ?name . }
Publish the library. Each query becomes a route and an MCP tool.
GET /tools/people/find-people
?city=Perth&city=HobartGuides, reference material and design background.
Library, Query, QueryGroup, DataGraph, ArgumentSet, RuleSet: the words every other page uses.
Read conceptssqlib connects to your existing SPARQL endpoints, so the data stays where it is.