Skip to main content

oxilite

oxilite for Python

PyPI license

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
  • LOAD of 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.

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

Metadata

Release files for oxilite 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oxilite 0.8.0
File Size Uploaded
oxilite-0.8.0.tar.gz 592.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for oxilite 0.8.0
File
oxilite-0.8.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
oxilite-0.8.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
oxilite-0.8.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
oxilite-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
oxilite-0.8.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
oxilite-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 52.9 MB

Release files / oxilite-0.8.0.tar.gz

Download URL oxilite-0.8.0.tar.gz
Size 592.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b2ccfcfd44f82f7c39b7732c7a94cbabd0d10a6b0dfd907f20340636362cf349
BLAKE2b-256 checksum
How to use checksums
3cbfbe31d4ac3563af30a86685380201f0e2366881278429c62add3477fe07ed
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 28, 2026.

Transparency log

Release files / oxilite-0.8.0-cp39-abi3-win_amd64.whl

Download URL oxilite-0.8.0-cp39-abi3-win_amd64.whl
Size 8.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1ab0d23cc1c851263ef3a3beba40eb41f8734ac024fe4f3cc12ad937a5d96249
BLAKE2b-256 checksum
How to use checksums
07759955de7d19fc44c44057e62d9388aaacb3046d6c43d2c82f54a8e3a9c56e
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 28, 2026.

Transparency log

Release files / oxilite-0.8.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL oxilite-0.8.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 9.2 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
f4d57abd721249c262630f19e6d6ffa421cd9c64731c0029af65bf0e09d464e6
BLAKE2b-256 checksum
How to use checksums
806051506595e39a4a0b5da95fbc3a69cc96081f3f5adb4be6d7320d3be79c8d
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 28, 2026.

Transparency log

Release files / oxilite-0.8.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL oxilite-0.8.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 8.6 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
b37055b9d3f630ead61d38b70e5401db1ef8c05d3a5e5503aae2c2a5bf8692c1
BLAKE2b-256 checksum
How to use checksums
ab68a99a6105cfedd3f4c19d12357f1e92e1e610e23124fe018e0054a7737aec
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 28, 2026.

Transparency log

Release files / oxilite-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL oxilite-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 8.8 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
fe31f9ff8a4433427229494498ebb0344f7c16976982c091b4ab933cbbaab52e
BLAKE2b-256 checksum
How to use checksums
78bcf66851c3c9326a5028f6c40346036df04c95258a90e063205f1bf4383407
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 28, 2026.

Transparency log

Release files / oxilite-0.8.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL oxilite-0.8.0-cp39-abi3-macosx_11_0_arm64.whl
Size 8.3 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b0d9314814600e922b729cb9c069eef42b31b468f799736a20e14e9ec1106ff9
BLAKE2b-256 checksum
How to use checksums
53a52a746e50a96be18c2adb4cce13867b027188c208f352ec07e18bdb4e4b29
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 28, 2026.

Transparency log

Release files / oxilite-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL oxilite-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 8.7 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
385e0961e12f25db51e2faf2414ec5f8d76327f3a4ef9e4960b96fee4f5f1af0
BLAKE2b-256 checksum
How to use checksums
439fc3d37f8bf441f69c1554959790e59993fc21541399fa7b66dd6bb82469e1
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 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.1

7 release files

0.9.0

7 release files

This release

0.8.0 This release

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page