PyOntoenv
Installation
pip install pyontoenv
Usage
# 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
=
# 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"
=
# get the graph of the ontology we just added
# env.get returns an rdflib.Graph
=
# get the full closure of the ontology, including all of its imports
# also returns an rdflib.Graph
=
# you can also add ontologies from a URL
=
=
# if you have an rdflib.Graph with an owl:Ontology declaration,
# you can transitively import its dependencies into the graph
=
# this graph just has one triple: the ontology declaration for Brick
# this will load all of the owl:imports of the Brick ontology into 'g'