oxilite for Python
An Oxigraph-compatible SPARQL 1.1 store for Python, on SQLite. It has the API of pyoxigraph and keeps the whole dataset in one SQLite file. The same data can also be queried with openCypher and Datalog, reasoned over with RDFS / OWL, described by SHACL shapes, filled from JSON-LD documents and Verifiable Credentials, and read at any past version.
Website · Python reference · Tutorial · Source · Issues
pip install oxilite
Quick start
from oxilite import Store, NamedNode, Literal, Quad, RdfFormat
store = Store("data.sqlite") # Store() for an in-memory store
store.load("""
@prefix ex: <http://example.com/> .
ex:ada a ex:Person ; ex:name "Ada" ; ex:knows ex:alan .
""", RdfFormat.TURTLE)
store.add(Quad(NamedNode("http://example.com/alan"), NamedNode("http://example.com/name"), Literal("Alan")))
for solution in store.query("SELECT ?name WHERE { ?p <http://example.com/name> ?name }"):
print(solution["name"].value)
store.update("DELETE WHERE { ?s <http://example.com/knows> ?o }")
print(len(store))
query returns what pyoxigraph returns: QuerySolutions for SELECT, QueryBoolean for ASK, and
QueryTriples for CONSTRUCT and DESCRIBE. Each can be serialized to JSON, XML, CSV or TSV (RDF for
triples).
Coming from pyoxigraph
import oxilite as pyoxigraph
Terms, formats, results, parse, serialize, parse_query_results and every Store method keep their
names, arguments and results. pyoxigraph's own test suite runs against this package on every build. Two
kinds of test fail, and they are allow-listed:
- custom Python functions inside SPARQL: a query is one SQL statement, so SQLite cannot call Python for each row
LOADof a remote URL: the core does no network I/O
Store(path) opens a SQLite file. Given an existing directory, as pyoxigraph's paths are, it uses
oxilite.sqlite inside it.
Cypher and Datalog over the same data
opts = {"base": "http://example.com/"}
store.cypher("CREATE (:Person {name: 'Grace'})-[:KNOWS {since: 1950}]->(:Person {name: 'Ada'})", **opts)
r = store.cypher("MATCH (a:Person {name: $name})-[:KNOWS]->(b) RETURN b.name AS friend", {"name": "Grace"}, **opts)
print(r.records) # [{'friend': 'Ada'}]
program = """
@prefix ex: <http://example.com/> .
reach(?x, ?y) :- ex:KNOWS(?x, ?y).
reach(?x, ?z) :- ex:KNOWS(?x, ?y), reach(?y, ?z).
?- reach(?a, ?b).
"""
print(store.datalog(program).records) # [{'a': <NamedNode …>, 'b': <NamedNode …>}]
Nodes are IRIs, labels are rdf:type, properties are literal triples, and relationships are triples,
with an RDF 1.2 reifier when they carry properties. So SPARQL sees everything Cypher writes. A Datalog
program whose recursion is linear runs as one recursive SQL statement.
Synalog, the Datalog-family language for AI agents, runs over the same data, reading triples as tables:
r = store.synalog("""
# @table knows <http://example.com/KNOWS>
@Recursive(Reach, 10);
Reach(a:, b:) distinct :- knows(subject: a, object: b);
Reach(a:, b:) distinct :- Reach(a:, b: m), knows(subject: m, object: b);
""", "Reach")
print(r.records) # [{'a': 'http://example.com/…', 'b': '…'}]
Reasoning, schemas, documents, history
from datetime import datetime, timezone
from oxilite import DefaultGraph, NamedNode, RdfFormat, Store
store = Store()
store.load("@prefix ex: <http://example.com/> . ex:rex a ex:Dog .", RdfFormat.TURTLE)
onto = NamedNode("http://example.com/onto")
store.load("@prefix ex: <http://example.com/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"
"ex:Dog rdfs:subClassOf ex:Animal .", RdfFormat.TURTLE, to_graph=onto)
store.register_schema_graph(onto, "ontology", applies_to=[DefaultGraph()]) # the schema registry
assert store.query("ASK { ex:rex a ex:Animal }", reasoning="rdfs", prefixes={"ex": "http://example.com/"})
store.materialize(engine="reasonable") # OWL 2 RL closure; query it with include_inferred=True
docs = store.jsonld() # JSON-LD stored byte for byte, RDF in a named graph
docs.put('{"@context": {"name": "http://schema.org/name"}, "@id": "urn:uuid:1", "name": "Ada"}')
vcs = store.credentials() # Verifiable Credentials 1.1 and 2.0, indexed by
vcs.find(issuer="did:example:academy", valid_at=datetime.now(timezone.utc)) # issuer, subject, validity
versioned = Store(versioning="log") # an immutable change log
with versioned.commit(author="ada", message="import"):
versioned.update('INSERT DATA { <urn:t1> <urn:status> "open" }')
with versioned.commit(author="grace", message="close"):
versioned.update('DELETE DATA { <urn:t1> <urn:status> "open" } ; INSERT DATA { <urn:t1> <urn:status> "done" }')
print([s["s"].value for s in versioned.query("SELECT ?s { <urn:t1> <urn:status> ?s }", as_of="HEAD~1")]) # ['open']
Examples
Each example is a short script that runs top to bottom, prints what it does and asserts its output. CI runs all of them against every build.
| Example | Shows |
|---|---|
01_quickstart.py |
A store in one file: load, add, SELECT / ASK / CONSTRUCT, results as CSV or dicts, dump, reopen |
02_cypher_property_graph.py |
openCypher writes and reads, parameters, paths, aggregation, and SPARQL over the same data |
03_datalog.py |
Recursive rules, negation, aggregation, and materialized inferences |
04_reasoning_and_schemas.py |
RDFS at query time, OWL 2 RL materialization, registered ontologies and SHACL shapes |
05_jsonld_and_credentials.py |
JSON-LD documents and Verifiable Credentials, found by issuer, subject and validity |
06_time_travel.py |
Commits, queries at past versions, history, diffs, and purging |
07_full_text_search.py |
FTS5 full-text search from SPARQL |
08_threads_and_asyncio.py |
Thread pools, asyncio.to_thread, and read-only handles |
python-tour/tour.py |
Everything above in one script: the code of the Python tutorial |
API at a glance
| Method | Does |
|---|---|
Store(path=None, *, library=None, text_index=False, versioning="off", …), Store.read_only(path) |
Open a file, a directory or memory; library loads a system libsqlite3 |
query(sparql, *, base_iri, prefixes, use_default_graph_as_union, default_graph, named_graphs, substitutions, reasoning, include_inferred, include_schema_graphs, as_of) |
SPARQL 1.1 / 1.2 query |
update(sparql) |
SPARQL Update, atomically |
load, bulk_load, dump |
Turtle, N-Triples, N-Quads, TriG, N3, RDF/XML, JSON-LD, from str, bytes, files or paths |
add, extend, bulk_extend, remove, in, len, iteration, quads_for_pattern |
Quad-level access |
named_graphs, add_graph, clear_graph, remove_graph, clear, optimize, backup |
Graphs and maintenance |
synalog(program, predicate, …), synalog_sql |
Synalog over the store as tables; rows of plain values |
explain, explain_update, explain_cypher, explain_datalog |
The SQL each language compiles to |
cypher(query, params, **options) |
openCypher read or write: CypherResult(columns, rows, records, stats) |
datalog, datalog_materialize |
Recursive rules, stratified negation, aggregation |
materialize(engine), clear_inferences() |
OWL 2 RL materialization ("sql" or "reasonable") |
register_schema_graph, schema_graphs, set_schema_graph_active, unregister_schema_graph, drop_schema_graph, shape_index, install_system_graphs |
The schema registry |
jsonld(**options), credentials(**options) |
JSON-LD documents and Verifiable Credentials |
versioning, set_versioning, commit, set_commit_info, history, changes, diff, purge |
History and time travel |
parse, serialize, parse_query_results |
RDF and results I/O without a store |
Every result is typed: the package ships py.typed and passes mypy --strict. Store calls release the
GIL. The full reference is docs/python.md.
Platforms
Wheels use the stable ABI, so each one serves CPython 3.9 and every later version:
- Linux: glibc x86_64 and aarch64, musl x86_64
- macOS: x86_64 and arm64
- Windows: x64
On other platforms, pip builds the package from the source distribution, which needs a Rust toolchain.
To build it yourself, see
building and publishing the package.
The oxilite family
oxilite is an Oxigraph-compatible RDF database and SPARQL 1.1 engine that stores its data in SQLite. It
runs anywhere SQLite runs: in-process, on a system or vendor libsqlite3, and on Cloudflare D1 and in
Durable Objects.
| Package | What it is for |
|---|---|
oxilite (Rust) |
The store: a drop-in for oxigraph::store::Store, plus AsyncStore for D1 |
oxilite (Python) |
This package: the API of pyoxigraph |
@oxilite/node |
Node.js bindings, with the API of Oxigraph's JS package |
@oxilite/d1 |
Cloudflare D1 and Durable Objects from TypeScript |
oxilite-cli |
The oxilite command and a SPARQL endpoint like oxigraph serve |
oxilite-cypher, oxilite-datalog |
openCypher and Datalog over the same data |
oxilite-jsonld, oxilite-vc |
JSON-LD documents and Verifiable Credentials |
License
Dual-licensed under MIT or Apache-2.0, at your option, like Oxigraph.
Release files for oxilite 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| oxilite-0.9.1.tar.gz | 612.7 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| oxilite-0.9.1-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| oxilite-0.9.1-cp39-abi3-musllinux_1_2_x86_64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ x86-64 | Details |
| oxilite-0.9.1-cp39-abi3-manylinux_2_28_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| oxilite-0.9.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| oxilite-0.9.1-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| oxilite-0.9.1-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 57.5 MB
Release files / oxilite-0.9.1.tar.gz
| Download URL | oxilite-0.9.1.tar.gz |
|---|---|
| Size | 612.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5b392a59de1f6ac587aa86ddb4d3cb3f924581ab3e1504d496592a107e93d58
|
|
BLAKE2b-256 checksum How to use checksums |
9fc6a1f76c7b89b7d0ad0ed31187c76bab4b4a1acbab02436a17e9da3958c881
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / oxilite-0.9.1-cp39-abi3-win_amd64.whl
| Download URL | oxilite-0.9.1-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 9.5 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
aefda7892ee36f00630565dfc0521f6b26b7e21db1739b31d27b8594f541217f
|
|
BLAKE2b-256 checksum How to use checksums |
57ec750c5ab0802d3719265b741b09006b23d5aac7541aa9a5e615706c23b86d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / oxilite-0.9.1-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | oxilite-0.9.1-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 10.0 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ce59f935a23dc637addcee04422f662278b0edbd22381ace3838616b97b901db
|
|
BLAKE2b-256 checksum How to use checksums |
d7d88463a5c74fc84eb294e47936f7ab9342fa0157b09f37cbda8ae86ec90166
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / oxilite-0.9.1-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | oxilite-0.9.1-cp39-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 9.3 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0a6ccd3bec1607e830b81c51866efaae5939355a082eb20fe69b88dbc6a07728
|
|
BLAKE2b-256 checksum How to use checksums |
19d411175f1f645fb17dae9c5273e382f0dfe0e99b6be5541e071ffb8bd44e31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / oxilite-0.9.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | oxilite-0.9.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 9.6 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c85652b87d59312f8f6fcab4055f6d6ce21e4ac71f000e6f53cea3e6dd42e555
|
|
BLAKE2b-256 checksum How to use checksums |
38430034c8054a1e8fd058c0e60232434d05e6e58be3d21499fcc39929ac306a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / oxilite-0.9.1-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | oxilite-0.9.1-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.9 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5c7823ec498197b297203754181f383decaf676d827d177ef6e47e76513fe77f
|
|
BLAKE2b-256 checksum How to use checksums |
60df45208b4b6316f3641e793acc66f810dccd5454ffa4a87ccee931f706f751
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / oxilite-0.9.1-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | oxilite-0.9.1-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 9.5 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
42a5ea06e84d00d383d36e1b5d92c73e81c927523d0872b4b992bf263d223448
|
|
BLAKE2b-256 checksum How to use checksums |
38a992c45acf839dc6274720e724008dbf2f2ab0f737af635f520b84a9bfc323
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency log