OntoEnv¶
owl:imports for you — from the
command line, Python, or Rust.
pip install ontoenv
cargo install ontoenv-cli
Overview¶
OntoEnv is a tool for managing knowledge graphs, ontologies, and their
interdependencies. It is designed to handle the part you would otherwise do by
hand: an ontology declares owl:imports, those imports declare their own,
and before long a single file needs a dozen others — some local, some on the
web, some moved or renamed since they were published.
OntoEnv keeps an environment: a directory of ontologies it has discovered, plus everything it learned about them — canonical names, source locations, namespace prefixes, and the import graph connecting them. Ask for one ontology and you can get its complete imports closure as a single graph, in milliseconds, without re-parsing anything.
The minimum you need to know¶
Point OntoEnv at a directory, then ask for a closure. That is the whole idea.
$ pip install ontoenv
$ ontoenv init ./ontologies # build the environment
$ ontoenv closure https://example.org/site closure.ttl # export IRI + its imports
The same thing from Python:
from ontoenv import OntoEnv
env = OntoEnv.connect("./ontology-env", search_directories=["./ontologies"])
env.update()
view, imported = env.get_closure("https://example.org/site")
print(f"{len(imported)} graphs, {len(view)} triples")
Two rules explain most of the rest of the API: connect opens an
environment but never reads your files — update does that, explicitly. And
get_* returns a fast read-only view, while copy_* returns a mutable
rdflib graph.
Where to go next¶
Tutorials
Start here. Two short, hands-on walkthroughs that take you from an empty directory to a working environment — one for the CLI, one for Python.
Learn the basics →How-to guides
Recipes for specific jobs: filtering what gets loaded, working offline, running inside a long-lived service, plugging in your own storage, recovering a broken environment.
Solve a problem →Reference
Every CLI command and flag, every Python method, every configuration key. Look things up here.
Look something up →Explanation
How OntoEnv thinks: what a closure actually contains, why there are five ways to open an environment, when views beat copies, and what the performance numbers mean.
Understand the design →What you get¶
Import resolution — follows
owl:importsto fetch and cache every transitive dependency, local or remote.A queryable dependency graph — ask for a closure, find every importer of an ontology, or detect cycles.
Fast restarts — the environment is stored in a compact binary format and reopens in milliseconds without re-parsing RDF.
Read-only views — query a 200k-triple closure through SPARQL without materializing it in memory.
Three front ends — a CLI, Python bindings with native
rdflibinterop, and the underlying Rust crate.
Upgrading¶
Coming from 0.5? Migrating from 0.5 to 0.6 lists the API changes you need to make. The full release history is in the Changelog.
Need a plain-text snapshot for LLM ingestion? Grab llms.txt.