#import #environment #env #ontologies #local #onto-env #ontoenv

pyontoenv

Command line tool to manage ontologies and their imports in a local environment

11 releases

new 0.1.7-a8 Jun 1, 2024
0.1.7-a7 May 30, 2024
0.1.6 Apr 29, 2024

#291 in Science

Download history 38/week @ 2024-04-20 389/week @ 2024-04-27 15/week @ 2024-05-04 266/week @ 2024-05-18 329/week @ 2024-05-25

624 downloads per month

BSD-3-Clause

1MB
2K SLoC

PyOntoenv

Installation

pip install pyontoenv

Usage

from ontoenv import Config, OntoEnv
from rdflib import Graph

cfg = Config(["../brick"], strict=False, offline=True)

# make environment
env = OntoEnv(cfg)

g = Graph()
# get the transitive owl:imports closure into 'g'
env.get_closure("https://brickschema.org/schema/1.4-rc1/Brick", g)

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")

Dependencies

~26–44MB
~745K SLoC