CLI reference¶
cargo install --locked ontoenv-cli # with a Rust toolchain
pip install ontoenv # or as part of the Python package
Every command locates the nearest .ontoenv/ directory by walking up from
the current working directory. Set ONTOENV_DIR to override that.
Global flags¶
Accepted by every subcommand.
Flag |
Meaning |
|---|---|
|
gitignore-style globs on file paths. Supports |
|
Globs on file paths to exclude. |
|
Regex whitelist on ontology IRIs, applied after parsing. |
|
Regex exclusions on ontology IRIs, applied after includes. |
|
Skip all network access. |
|
Treat missing imports as errors instead of warnings. |
|
Reject files that lack an |
|
Max age of a cached remote ontology before re-fetch. Default 86400. |
|
Keep everything in memory; write no |
|
Resolution policy when several files declare the same ontology IRI:
|
|
Log at info level. |
|
Log at debug level. |
Omitted mode flags preserve their saved values when the environment already
exists. Boolean flags take explicit values — --offline=false,
--strict=false, --require-ontology-names=false — so a saved true
can be turned off. Explicit changes are persisted without rescanning.
Creating and updating¶
ontoenv init [LOCATION]...
Create the environment under .ontoenv/. Directory arguments are scanned
immediately; with none, the current directory is used.
--overwriteRebuild in place if an environment already exists.
$ ontoenv init ./ontologies ./vendor
$ ontoenv init ./ontologies --overwrite
$ ontoenv init . --includes '*.ttl' --exclude-ontology 'experimental'
ontoenv add <LOCATION>
Register one ontology from a file path or URL, following owl:imports by
default.
--no-importsDo not follow
owl:imports.--rename <IRI>Store the graph under IRI instead of the one it declares. See Rename and alias ontologies.
$ ontoenv add ./ontologies/site.ttl
$ ontoenv add https://brickschema.org/schema/Brick --no-imports
$ ontoenv add ./vendor/upstream.ttl --rename https://my-org.com/local/upstream
ontoenv update
Re-ingest modified local files and re-fetch stale remote ontologies, following imports throughout.
-a,--allRefresh everything regardless of modification times or cache age.
-q,--quietSuppress per-ontology output.
--jsonMachine-readable output.
$ ontoenv update
$ ontoenv update --all
$ ontoenv update --remote-cache-ttl-secs 604800
ontoenv recover
Rebuild the catalog from the persistent graph store after an interrupted
mutation. Removes .ontoenv/catalog.pending only once the replacement
catalog is published. Unavailable with --temporary. See
Recover an interrupted environment.
ontoenv reset
Delete .ontoenv/ entirely, including cached remote ontologies.
-f,--forceSkip the confirmation prompt.
Exporting graphs¶
Three commands write graph data. They differ in scope and in what they do to the result.
Command |
Returns |
Imports |
Output |
|---|---|---|---|
|
one stored graph |
not followed |
|
|
ontology + transitive imports, flattened |
fully resolved and merged |
|
|
an explicit list of graphs, raw |
only with |
|
ontoenv get <ONTOLOGY>
-l,--location <PATH|URL>Disambiguate when several sources provide the same IRI.
--output <FILE>Write to a file instead of
STDOUT.-f,--format <FORMAT>turtle(default),ntriples,rdfxml, orjsonld.
$ ontoenv get https://brickschema.org/schema/Brick
$ ontoenv get https://brickschema.org/schema/Brick --output brick.ttl --format turtle
ontoenv closure <ONTOLOGY> [DESTINATION]
--keep-owl-importsKeep resolved
owl:importsstatements (removed by default).--no-rewrite-sh-prefixesDo not consolidate SHACL
sh:prefixesonto the root (rewritten by default).--recursion-depth <N><0unlimited (default),0no imports,>0that many levels.
$ ontoenv closure https://brickschema.org/schema/Brick brick_closure.ttl
$ ontoenv closure https://brickschema.org/schema/Brick out.ttl --keep-owl-imports
ontoenv union --root <ROOT> <ONTOLOGY>...
--root <IRI>Required. The IRI used as the root for ontology-declaration and SHACL prefix cleanup.
--include-closuresAlso expand each listed graph’s transitive imports.
--keep-owl-imports,--no-rewrite-sh-prefixes,--recursion-depth <N>As for
closure.--output <FILE>Destination, default
output.ttl.
$ ontoenv union --root https://example.org/C \
https://example.org/A https://example.org/B --output merged.ttl
$ ontoenv union --root https://example.org/C --include-closures \
--recursion-depth 2 https://example.org/A --output merged_with_deps.ttl
Inspecting the environment¶
ontoenv status
Summary: where .ontoenv/ lives, how many ontologies are loaded, when it
was last updated, and the on-disk store size. --json for machine-readable
output.
ontoenv list <SUBCOMMAND>
ontologiesDeclared ontology IRIs.
locationsSource URLs the ontologies came from, as
file://orhttp(s)://URLs. Useontoenv dumpto see which location belongs to which IRI.missingowl:importstargets nothing in the environment resolves.
--json is accepted.
ontoenv dump [CONTAINS]
Print every stored ontology and its metadata to STDOUT. An optional
substring filters by name.
ontoenv why [ONTOLOGIES]...
Print every import path leading to each given IRI, from the most distant
importer down to the target. --json is accepted.
ontoenv doctor
Check for duplicate ontology IRIs, files with no owl:Ontology
declaration, and conflicting namespace prefixes. --json is accepted.
ontoenv namespaces [ONTOLOGY]
Print prefix-to-IRI mappings taken from @prefix/PREFIX declarations
and SHACL sh:declare entries. With no argument, merges every ontology in
the environment.
--closureInclude namespaces from the ontology’s transitive imports.
--jsonOutput a JSON object instead of
prefix: namespacelines.
ontoenv dep-graph [ROOTS]... --output <FILE>
Render the import dependency graph as a PDF. Requires Graphviz. With root IRIs, limits the render to their subgraph.
--output <FILE>Destination, default
dep_graph.pdf. There is no short form —-ois the global--offlineflag.
ontoenv version
Print the version of the installed binary.
Configuration¶
ontoenv config <SUBCOMMAND>
listShow every persisted key and value.
get <KEY>/set <KEY> <VALUE>/unset <KEY>Read, write, or revert one key.
add <KEY> <VALUE>/remove <KEY> <VALUE>Modify a list-valued key.
$ ontoenv config list
$ ontoenv config set remote_cache_ttl_secs 604800
$ ontoenv config add locations ./more-ontologies
$ ontoenv config remove locations ./old-path
add/remove handle locations, includes, and excludes. The
ontology-IRI regex lists must be edited in .ontoenv/config.json directly.
See Configuration for every key and its default.