Crates.io | pyontoenv |
lib.rs | pyontoenv |
version | 0.1.10-a1 |
source | src |
created_at | 2024-04-26 22:17:04.22401 |
updated_at | 2024-10-08 14:59:54.010872 |
description | Command line tool to manage ontologies and their imports in a local environment |
homepage | https://github.com/gtfierro/ontoenv-rs |
repository | https://github.com/gtfierro/ontoenv-rs |
max_upload_size | |
id | 1221959 |
size | 37,043 |
pip install pyontoenv
from ontoenv import Config, OntoEnv
from rdflib import Graph
cfg = Config(["../brick"], strict=False, offline=True)
# make environment
env = OntoEnv(cfg)
g = Graph()
# put the transitive owl:imports closure into 'g'
env.get_closure("https://brickschema.org/schema/1.4-rc1/Brick", g)
# or, get the graph directly
g = env.get_closure("https://brickschema.org/schema/1.4-rc1/Brick")
brick = Graph()
brick.parse("Brick.ttl", format="turtle")
# transitively import dependencies into the 'brick' graph, using the owl:imports declarations
env.import_dependencies(brick)
# pull Brick graph out of environment
brick = env.get_graph("https://brickschema.org/schema/1.4-rc1/Brick")
# import graphs by name
env.import_graph(brick, "https://w3id.org/rec")