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.
Dataframe ingestion (fenic, polars, pandas, pyarrow)
engine.load_rows(df, base_iri="http://x.org/", class_iri="http://x.org/Thing", id_column="id")
load_rows duck-types against the common export methods — to_pylist()
(fenic DataFrame, pyarrow Table), to_dicts() (polars), to_dict("records")
(pandas) — or takes a plain list of dicts. Values become typed literals
(int/float/bool → XSD), None is skipped, and the output is deterministic.
The primary consumer is fenic: its
semantic operators do the LLM extraction, this bridge just loads and lets
SHACL/lint/SPARQL govern the result. See
examples/fenic_pipeline.py for the end-to-end
shape, and docs/data-pipeline.md for ingesting a fenic DuckDB catalog with
the full Rust engine.
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 |
onto_shacl |
SHACL conformance: violations with focus node, path, value, severity and constraint, plus focus_nodes and unmatched_shapes (needs the [shacl] extra) |
onto_vocab_check |
Closed-world check: which terms in the data are not declared in the loaded ontology |
Closed-world checking
RDF is open-world, so a predicate nobody declared is unknown rather than wrong.
An extractor that invents ex:hasProteinName because it sounded plausible
produces RDF that parses, loads and satisfies SHACL without a murmur. Closing
that world is the only way to tell an invented term from a real one:
from open_ontologies_lite import vocab_check
report = vocab_check(ontology_ttl, generated_data_ttl)
report["undeclared_terms"] # ['http://example.org/onto#hasProteinName']
Instance IRIs are never policed, because individuals belong to the data rather
than the vocabulary, and the standard vocabularies are never policed either.
With no ontology loaded the check reports that nothing was checked and returns
conforms: False, never True: a green light from an empty vocabulary is the
failure this exists to prevent.
Validation that never passes vacuously
A shapes graph whose targets match nothing validates every constraint against
the empty set and reports conforms: True, byte-identical to a run where every
constraint was checked and passed. shacl_validate reports how many focus nodes
were actually selected and names the shapes that selected none:
report["focus_nodes"] # 0
report["unmatched_shapes"] # [{'shape': '...PersonShape', 'target_class': '...Person'}]
report["conforms"] # None, because nothing was examined
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
Metadata
Release files for open-ontologies-lite 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| open_ontologies_lite-0.4.0.tar.gz | 22.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| open_ontologies_lite-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.2 kB
Release files / open_ontologies_lite-0.4.0.tar.gz
| Download URL | open_ontologies_lite-0.4.0.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43ff5264759bc37282533cd77c0214c728e240597487113ca755db53fedc2183
|
|
BLAKE2b-256 checksum How to use checksums |
395eef13bc0292d7047c39f9ec515642025e4e4117c84dbf0a12707c0f5c2627
|
| 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 Aug 19, 2026.
Transparency logRelease files / open_ontologies_lite-0.4.0-py3-none-any.whl
| Download URL | open_ontologies_lite-0.4.0-py3-none-any.whl |
|---|---|
| Size | 21.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91f6935bd4a0c2133e5794603adafc0d54f424b35b00b764f3411a3b01770dbd
|
|
BLAKE2b-256 checksum How to use checksums |
19c9907e7d0023758d90cc6870072d1f1c77db426e1c9febb830f771d2705e4f
|
| 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 Aug 19, 2026.
Transparency log