OntoEnv ======= .. raw:: html
crates.io PyPI docs.rs GitHub License
pip install ontoenv    cargo install ontoenv-cli
An ``owl:imports`` statement gives you an IRI. It does not tell you which file to open. The ontology may live in a local checkout, at a URL, behind an alias, or nowhere you can currently reach. OntoEnv is a library and command-line tool that maps ontology IRIs to the files or URLs where their RDF graphs can be found. It follows ``owl:imports`` to build a dependency graph, then saves the graphs and their mappings in an *environment*. Reopening that environment reads the saved catalog instead of parsing every source again. Basic workflow -------------- Scan a directory once. Then ask for an ontology by IRI: .. code-block:: console $ 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: .. code-block:: 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 distinctions explain most of the API: - ``connect`` opens saved state. ``update`` reads ontology sources. - ``get_*`` returns a read-only view. ``copy_*`` allocates a mutable ``rdflib`` graph. These names distinguish catalog access from source access, and views from allocated copies. Where to go next ---------------- .. raw:: html

Tutorials

Build a small environment and inspect an import closure, from the CLI or Python.

Work through an example →

How-to guides

Specific tasks: constrain discovery, work offline, run a service, attach storage, or recover after an interrupted write.

Find a procedure →

Reference

CLI commands, Python methods, configuration keys, and storage interfaces.

Consult the reference →

Explanation

Design constraints and trade-offs: closure transformations, lifecycle choices, views versus copies, and performance limits.

Read the design notes →
What OntoEnv saves ------------------ - RDF graphs from local files and remote URLs. - Canonical ontology IRIs, aliases, source locations, and namespace prefixes. - Direct and transitive ``owl:imports`` relationships, including missing imports and cycles. - A catalog that can be reopened without parsing every stored graph. The same environment is available through the CLI, Python bindings with ``rdflib`` interoperability, and the Rust crate. Upgrading --------- Coming from 0.5? :doc:`migration-0.6` lists the API changes you need to make. The full release history is in the :doc:`changelog`. .. toctree:: :hidden: :maxdepth: 2 tutorials/index how-to/index reference/index explanation/index .. toctree:: :hidden: :caption: Project migration-0.6 development Rust API (docs.rs) changelog ---- Need a plain-text snapshot for LLM ingestion? Grab `llms.txt `_.