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.

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.

Metadata

Release files for oxilite 0.10.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.10.0
File Size Uploaded Provenance Actions
oxilite-0.10.0.tar.gz 641.9 kB With provenance Details for oxilite-0.10.0.tar.gz

Built distributions (wheels)

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

Total release size: 57.7 MB

Release files / oxilite-0.10.0.tar.gz

Download URL oxilite-0.10.0.tar.gz
Size 641.9 kB
Tags Source
SHA-256 checksum
How to use checksums
54374abeda40e9248a735c890adb8c35784989a511e4d2a68c48c07f30cdb351
BLAKE2b-256 checksum
How to use checksums
dd476408c8e29c4817b1fb612b55604bdbc93abdba774fc335c51185af1498e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 3, 2026.

Transparency log

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

Download URL oxilite-0.10.0-cp39-abi3-win_amd64.whl
Size 9.6 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
68e902a3bea60c3e7fbc4665b04d09f07dd98a1ee0c8ac9bc008863773bb9d57
BLAKE2b-256 checksum
How to use checksums
4828206252af2855fc86c5278905f9366259e7569b3ed7bfa0f572e9c3a8f628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 3, 2026.

Transparency log

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

Download URL oxilite-0.10.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 10.1 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
2a4bbddb535cc4516265f8721f537501964bcce42d022fdb80bd2f224ac53aba
BLAKE2b-256 checksum
How to use checksums
7d6848a108dba96af09801758a3f5379ea6e68d80ce587a64d09e759651a4b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 3, 2026.

Transparency log

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

Download URL oxilite-0.10.0-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
bb23ced2a151c39d8c11bb71c135782189ab3dbdea7ab36bfb0a87e352b27a82
BLAKE2b-256 checksum
How to use checksums
004b9287f4d9fee8fec779df473b00b761a6473b648437a6bc8f391b3a6141cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 3, 2026.

Transparency log

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

Download URL oxilite-0.10.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 9.7 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
3aaccb7716cd03c6623337f7939f365b07d678171a211f9f579432f88a1fba3d
BLAKE2b-256 checksum
How to use checksums
1499aa1feddccdab4fe0695dce6edea12029234aa56c8636c4958f060e088c61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 3, 2026.

Transparency log

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

Download URL oxilite-0.10.0-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
450d20dec4fe4cc51e17bceb2d91822d846dc201e129e230d33fcccaec961bce
BLAKE2b-256 checksum
How to use checksums
2a050ae20e93da5db3865e743286865eac0f725fcdb0c80b3bbee27a8369515b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 3, 2026.

Transparency log

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

Download URL oxilite-0.10.0-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
352614a9ed19c409ee6237f035f23c8aad5a84d9bc5bd32100adebe4f5d62533
BLAKE2b-256 checksum
How to use checksums
088771dcc1e8be9dd33e8905125a0df4ebc7aa145de9ea2e2296cd56ea848b60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 3, 2026.

Transparency log

Security for oxilite 0.10.0

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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for oxilite-0.10.0.tar.gz

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 Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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