SPARQL 1.1 Query v0.1.0 MIT

Query RDF.
Keep control.

An embeddable SPARQL 1.1 Query parser and execution engine for Odin. Bring your own RDF data and storage; retain ownership of limits, lifetimes, networking, and source policy.

94/94
Pinned W3C syntax cases
3 OS
Linux, macOS, Windows
Bounded
Explicit execution limits
examples/minimal/main.odin
import sparql "../../sparql"
import dataset "../../sparql/dataset"
import engine "../../sparql/engine"

query, parse_error := sparql.Parse(
  `SELECT ?name WHERE {
     <urn:ada> <urn:name> ?name
   }`,
)
defer sparql.Destroy(&query)

store: dataset.Memory_Dataset
dataset.init(&store)
defer dataset.destroy(&store)

// Add application-owned RDF data, seal it,
// then execute with explicit limits.
result, execute_error := engine.execute(
  &query, view, {Max_Solutions = 8},
)
✓ parser · ✓ owned results · ✓ explicit resource limits

A focused query layer for application-owned RDF

SELECT / ASK CONSTRUCT Property paths Custom Views Result writers

Designed for integration

Small surface. Clear boundaries.

The engine is deliberately a query layer, not a hidden database or network client. Its contracts make the important decisions visible to the application.

01 / bound

Limits are explicit

Set solution and numeric limits at execution. Queries fail clearly at their boundary instead of relying on hidden truncation.

02 / own

Storage stays yours

Use the sealed in-memory Dataset or expose your own graph-scoped, streaming View over a snapshot or index.

03 / connect

No hidden I/O

SERVICE, clocks, UUIDs, random values, and cancellation enter through caller-supplied callbacks. The core never opens a connection.

04 / retain

Results are owned

Serialized SELECT and ASK results, plus graph results, stay valid after query parsing and dataset resources are released.

05 / plan

Planning is observable

An opt-in deterministic BGP ordering heuristic and caller-owned execution statistics keep query work inspectable.

06 / prove

Claims have evidence

Pinned W3C fixtures, local policy gates, property tests, fuzzing, and cross-platform CI keep scope honest and reviewable.

SPARQL 1.1 Query

The language where it belongs. The policy where you need it.

The public surface concentrates on the SPARQL 1.1 Query Language. `FROM` and `FROM NAMED` only restrict graphs already offered by the View; they never fetch a resource or presume a graph store.

Read the SPARQL 1.1 Query recommendation →

Included

  • Complete SPARQL 1.1 Query syntax gate
  • SELECT, ASK, CONSTRUCT, and concise-policy DESCRIBE
  • BGP, OPTIONAL, UNION, MINUS, GRAPH, VALUES, FILTER, and BIND
  • Subqueries, grouping, aggregates, expressions, and modifiers
  • Property paths and explicit SERVICE callbacks
  • SPARQL Results JSON/XML/CSV/TSV and graph writers

Deliberately separate

  • SPARQL Update and Graph Store Protocol
  • SPARQL Protocol or HTTP endpoints
  • Automatic remote loading and authentication
  • Graph or dataset storage
  • RDFS, OWL, or other entailment regimes
  • SPARQL 1.2 evaluation claims

Quick start

Parse, supply data, execute.

Point Odin's named `odin-rdf` collection at a sibling, vendored, or application-owned checkout. The minimal example builds a sealed Dataset, then writes SPARQL Results JSON.

terminal
# run the end-to-end public API example
odin run examples/minimal \
  -collection:odin-rdf=../odin-rdf

# run the same path over application-owned storage
odin run examples/custom_view \
  -collection:odin-rdf=../odin-rdf

# check the parser and engine
odin check sparql -no-entry-point \
  -collection:odin-rdf=../odin-rdf
odin test sparql \
  -collection:odin-rdf=../odin-rdf
odin test sparql/engine \
  -collection:odin-rdf=../odin-rdf

Expected example output:
{"head":{"vars":["name"]},"results":{...}}

Evidence before claims

Conformance is a ledger, not a badge.

Syntax, evaluation, result serialization, and the implementation-defined DESCRIBE policy are documented separately. The complete record states what passes, what is intentionally excluded, and what remains future work.

Start at the boundary

Use SPARQL without inheriting a database policy.

Read the API contract, then choose the Dataset or custom View that fits your application.