Python bindings for the OntoEnv Rust library. Manages ontology-based environments for building knowledge graphs.
Project description
OntoEnv Python Bindings
Installation
pip install ontoenv
Usage
from ontoenv import OntoEnv
from rdflib import Graph
# creates a new environment in the current directory, or loads
# an existing one. To use a different directory, pass the 'path'
# argument: OntoEnv(path="/path/to/env")
# OntoEnv() will discover ontologies in the current directory and
# its subdirectories
env = OntoEnv()
# add an ontology from a file path.
# env.add returns the name of the ontology, which is its URI
# e.g. "https://brickschema.org/schema/1.4-rc1/Brick"
brick_name = env.add("../brick/Brick.ttl")
print(f"Added ontology {brick_name}")
# When you add from a URL whose declared ontology name differs (for example a
# versioned IRI served at a versionless URL), ontoenv records that alias. You
# can later refer to the ontology by either the canonical name or the original
# URL when resolving imports or querying.
# get the graph of the ontology we just added
# env.get_graph returns an rdflib.Graph
brick_graph = env.get_graph(brick_name)
print(f"Brick graph has {len(brick_graph)} triples")
# get the full closure of the ontology, including all of its imports
# returns a tuple (rdflib.Graph, list[str])
brick_closure_graph, _ = env.get_closure(brick_name)
print(f"Brick closure has {len(brick_closure_graph)} triples")
# you can also add ontologies from a URL
rec_name = env.add("https://w3id.org/rec/rec.ttl")
rec_graph = env.get_graph(rec_name)
print(f"REC graph has {len(rec_graph)} triples")
# if you have an rdflib.Graph with an owl:Ontology declaration,
# you can transitively import its dependencies into the graph
g = Graph()
# this graph just has one triple: the ontology declaration for Brick
g.parse(data="""
@prefix owl: <http://www.w3.org/2002/07/owl#> .
<https://brickschema.org/schema/1.4-rc1/Brick> a owl:Ontology .
""")
# this will load all of the owl:imports of the Brick ontology into 'g'
env.import_dependencies(g)
print(f"Graph with imported dependencies has {len(g)} triples")
CLI Entrypoint
Installing ontoenv also provides the Rust-backed ontoenv command-line tool:
pip install ontoenv
ontoenv --help
The CLI is identical to the standalone ontoenv-cli binary; see the top-level README for usage.
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 Distributions
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 ontoenv-0.4.0.tar.gz.
File metadata
- Download URL: ontoenv-0.4.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
346017b4c93513fec6eb85bce39763ef3dcbbced1b9284674f97032352910e53
|
|
| MD5 |
0d2dfa25241ef84014ec5af10db98d01
|
|
| BLAKE2b-256 |
20872cec3b75876ac516dc59e21a8eb48f35e080ff02e24a0c850408bdae2a9c
|
File details
Details for the file ontoenv-0.4.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ontoenv-0.4.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: PyPy, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26c4b7bc51c25b4fcb48cc67eb119e770160b56603b4adde178841a01fb260ef
|
|
| MD5 |
5f83fc0d6ceeb5fe41029e7ab2cfa4f9
|
|
| BLAKE2b-256 |
2ab60f4abd2202d76dde3cf2fdb85099a7222fb6658b06c111fc9f5cb56eb3fe
|
File details
Details for the file ontoenv-0.4.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: ontoenv-0.4.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 5.3 MB
- Tags: PyPy, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94faaa87e3555f86340eb6e2713c91a5a5cb01fe3c74a4430ae4ed769e45270c
|
|
| MD5 |
ec26513d2ec0c226b34611441388f9e6
|
|
| BLAKE2b-256 |
f106aa3799ff887e18703b7ffdc88c8b07021c617d04e8cf900bcdf07eeff187
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa2dc1925b97307f1d2439ab7df72d2749ddaafb4604c4d3e985c7676ac34489
|
|
| MD5 |
ae60cba306c07f06293e338762561198
|
|
| BLAKE2b-256 |
4917171ae349729eccf69952811964d17799e010f071fc21a6f2aaa42ac7ff1a
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 6.8 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68367e89df7c51c51626ed52524cb8acd1165c15643282b962299c1e2da95787
|
|
| MD5 |
ffc10bb33b2212c86f8f17c6f8ee626d
|
|
| BLAKE2b-256 |
f091c3f473fc9bad289652ab711074d5e4d7d55572ad81c64113c5d3bfd48957
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14a7be385187cb5bcffabd6e8ccba2dd1fcba5b9ecc97a240dffb80e5f1ed8e5
|
|
| MD5 |
6c43164e5258992a379dd79471e2837f
|
|
| BLAKE2b-256 |
d07d3552408b511f17253bdf04e19cd2fdc4f7f02ff8573ab8e8b6ead6205a88
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f31a2a255b851d248eda7fec22ec56c808d4578a6f33cb8bee78bab53c977bce
|
|
| MD5 |
14a98dcf74c7976ae280d99908bc697b
|
|
| BLAKE2b-256 |
b337687450c289596acd4db27153767e6241dcb6989d11bc749320a85eb53014
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99f8329a724401f07e4124bfa708c8349a491e56e889596fd6f6c543e2d73f3b
|
|
| MD5 |
3ccd63194d851b1a8c5cb0df77004ca9
|
|
| BLAKE2b-256 |
ba4947a4bd79926529543721847f93630b78a14d84c84980311298395ed749e1
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cb52ed7d8101f48d4c9966a0c51f31b843bfc1006321b2a5b1a18b122e2591e
|
|
| MD5 |
89891eaad2d27045ee86cacac59ae4d0
|
|
| BLAKE2b-256 |
f9c9c81e1b50524380307460b5ee1267867f4ebc913b97426727c370d8985a8c
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-macosx_10_14_x86_64.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-macosx_10_14_x86_64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.11+, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
208672ea2e9da62b92f7b18eb242162c1d37985d3bec3046b4d957ba68aeb978
|
|
| MD5 |
1074718250940a9ea7257a2e9951ff9b
|
|
| BLAKE2b-256 |
00b865ef9bd33f8633a649ca09415f50a15c6d69553c9b9a5514c79f8c13106a
|
File details
Details for the file ontoenv-0.4.0-cp311-abi3-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl.
File metadata
- Download URL: ontoenv-0.4.0-cp311-abi3-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl
- Upload date:
- Size: 9.7 MB
- Tags: CPython 3.11+, macOS 10.14+ universal2 (ARM64, x86-64), macOS 10.14+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed116957de09c1a51a8089801e5cd4f8dddd0a4b2432437c290db8cb81c488de
|
|
| MD5 |
a3ae736c395e29723624dc084fdfe075
|
|
| BLAKE2b-256 |
276516a65fffb5641dde1ebc682a0d53da4745b5a44a1f32f71627970dbf001c
|