Versioned SPARQL queries, callable from any app or agent.

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.

Get started Try the demo
$ just run-local-memory
Web UI REST MCP Static export

What sqlib does with a saved query

All of these work on the same stored queries, in a library you host yourself.

Parameters are declared in the query

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

Pinned versions

Every save creates an immutable version. A run can pin a version for a reproducible result, or follow the latest.

Publish as tools

A published library exposes each query as an MCP tool and an HTTP route, with one plain argument per parameter.

Query groups

Chain queries on a canvas. One step's results become the next step's arguments.

Notebooks

Write explanation between runnable queries, and name each result for use further down.

SPARQL RL rules

Author inference rules in SRL and run them against any graph.

Tests and benchmarks

Attach tests to a query or rule set. Compare runs across backends and versions.

Why not just…?

sqlib compared to the common ways teams keep SPARQL today.

ApproachVersionedSafe parametersCallable by agents
sqlibevery savebound after parsingMCP and HTTP
.rq files in a repositorywith gitstring templatesno
Queries inside application codewith the appstring concatenationno
Saved queries in a triplestore UIoverwrittennono

From query to tool in three steps

Local setup is three commands. A container image is available for deployment.

1

Start the server

One process serves the API and the MCP endpoint, with an Oxigraph store on disk.

pnpm install
pnpm build
just run-local-memory
2

Save a parameterised query

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 .
}
3

Call it from anywhere

Publish the library. Each query becomes a route and an MCP tool.

GET /tools/people/find-people
    ?city=Perth&city=Hobart

Documentation

Guides, reference material and design background.

Run sqlib on your own data

sqlib connects to your existing SPARQL endpoints, so the data stays where it is.

Get started Try the demo Star on GitHub