Lightweight Python bridge to the Oxigraph RDF/OWL engine, MCP server included. No Rust toolchain, no compilation.
Project description
Open Ontologies Lite (Python bridge)
A lightweight, pip-installable Python bridge to the same Oxigraph RDF/OWL engine that powers Open Ontologies. No Rust toolchain, no compilation, no multi-gigabyte build directory — pyoxigraph ships the engine as a prebuilt wheel, so everything here is pure-Python glue installed from PyPI.
It exposes the core ontology lifecycle as both a Python library and an MCP server.
Why this exists
The full Rust engine compiles a large dependency tree from source (5+ GB of build artifacts, heavy SSD churn). This bridge is the opposite trade: install in seconds, run anywhere Python runs, keep the Oxigraph SPARQL engine underneath. It covers the core surface (validate, load, query, diff, lint, convert, stats, save), not the full 100-tool engine.
Install
pip install open-ontologies-lite # one universal wheel, no compiler
Use as a Python library
from open_ontologies_lite import OntologyEngine
engine = OntologyEngine()
engine.load(open("ontology.ttl").read()) # load Turtle
print(engine.stats()) # {'triples':..,'classes':..,..}
rows = engine.query(
"SELECT ?c WHERE { ?c a <http://www.w3.org/2002/07/owl#Class> }"
)
print([r["c"] for r in rows["rows"]])
print(engine.lint()) # missing labels/domains/ranges
print(OntologyEngine.convert(ttl, "turtle", "ntriples"))
See examples/python_usage.py for a runnable end-to-end script.
Version governance with KGCL
from open_ontologies_lite import kgcl_diff
cs = kgcl_diff(open("v1.ttl").read(), open("v2.ttl").read())
print(cs.counts()) # {'node_creation': 1, 'node_rename': 1, ...}
print(cs.to_kgcl()) # KGCL change records, one per line
kgcl_diff classifies the change between two ontology versions into KGCL records
(node created/deleted, renamed, annotation changed, edge created/deleted). Pure
structural comparison, no model. Also exposed as the onto_kgcl_diff MCP tool.
Alignment candidate generation with HNSW (optional [align] extra)
pip install "open-ontologies-lite[align]"
from open_ontologies_lite import AlignmentIndex
idx = AlignmentIndex(dim=384)
idx.add("flw:PC-BAK", vec_bakery) # vectors come from YOUR embedder
idx.add("FOODON:00001626", vec_foodon)
idx.build()
idx.query(vec_query, k=5) # -> [Candidate(id, score), ...]
MCP-native by design: the package owns the HNSW index, you supply the vectors. Lite never calls an embedding model; bring vectors from your orchestrator and let it adjudicate the candidates.
Use as an MCP server
open-ontologies-lite # stdio MCP server
# or: python -m open_ontologies_lite
Register it with any MCP client (e.g. Claude):
{
"mcpServers": {
"open-ontologies-lite": { "command": "open-ontologies-lite" }
}
}
Tools
| Tool | Purpose |
|---|---|
onto_validate |
Parse RDF/OWL and report syntax validity + triple count (no load) |
onto_load / onto_load_file |
Load RDF text or a file into the in-memory store |
onto_clear |
Reset the store |
onto_stats |
Triple / class / property / individual counts |
onto_query |
SPARQL SELECT / ASK / CONSTRUCT / DESCRIBE |
onto_save |
Serialize the store to a file |
onto_convert |
Convert between Turtle / N-Triples / N-Quads / TriG / RDF-XML / N3 / JSON-LD |
onto_diff |
Triple-level diff between two ontologies |
onto_kgcl_diff |
KGCL change records between two versions (governance / change logs) |
onto_lint |
Missing labels, domains, ranges |
Relationship to the Rust engine
This is the Python layer of the project. For the full engine (three-layer Dynamics/Causal/Planner architecture, HNSW semantic search, OWL2-DL tableaux reasoning, PDDL planning, governance, 100 tools), use the Rust build. Same Oxigraph core; pick the weight class you need.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file open_ontologies_lite-0.2.0.tar.gz.
File metadata
- Download URL: open_ontologies_lite-0.2.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dc6cc8de98364a98e928fe5bd723a72082fcbfa8a6d70cdd935b0c64a1c7111
|
|
| MD5 |
f2185aa1ce4cb6d8294ba4c227f30220
|
|
| BLAKE2b-256 |
b00c6512bbba32cc0ea78705e4c5662f222acf32f3fd0f6dfa9b60d2d3092852
|
Provenance
The following attestation bundles were made for open_ontologies_lite-0.2.0.tar.gz:
Publisher:
python-release.yml on fabio-rovai/open-ontologies
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_ontologies_lite-0.2.0.tar.gz -
Subject digest:
2dc6cc8de98364a98e928fe5bd723a72082fcbfa8a6d70cdd935b0c64a1c7111 - Sigstore transparency entry: 1837493100
- Sigstore integration time:
-
Permalink:
fabio-rovai/open-ontologies@d1703b92ebd2b0e245614912253d652593cac810 -
Branch / Tag:
refs/tags/py-v0.2.0 - Owner: https://github.com/fabio-rovai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@d1703b92ebd2b0e245614912253d652593cac810 -
Trigger Event:
push
-
Statement type:
File details
Details for the file open_ontologies_lite-0.2.0-py3-none-any.whl.
File metadata
- Download URL: open_ontologies_lite-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94fa3c233a353357de25e4d0ca77121aaa48e12836916a193747f5702edc2735
|
|
| MD5 |
87e529f799c0b3f6a05f97b7c9f47be8
|
|
| BLAKE2b-256 |
7be7404402c30d9498c2ec37f5c3e9191b5022e8834a28f42dbfe7b605162304
|
Provenance
The following attestation bundles were made for open_ontologies_lite-0.2.0-py3-none-any.whl:
Publisher:
python-release.yml on fabio-rovai/open-ontologies
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_ontologies_lite-0.2.0-py3-none-any.whl -
Subject digest:
94fa3c233a353357de25e4d0ca77121aaa48e12836916a193747f5702edc2735 - Sigstore transparency entry: 1837493193
- Sigstore integration time:
-
Permalink:
fabio-rovai/open-ontologies@d1703b92ebd2b0e245614912253d652593cac810 -
Branch / Tag:
refs/tags/py-v0.2.0 - Owner: https://github.com/fabio-rovai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@d1703b92ebd2b0e245614912253d652593cac810 -
Trigger Event:
push
-
Statement type: