pycrap.ontology_wrapper#

Classes#

OntologyWrapper

Wrapper class for user-friendly access of the owlready2 ontology class.

Module Contents#

class pycrap.ontology_wrapper.OntologyWrapper#

Wrapper class for user-friendly access of the owlready2 ontology class.

This class spawns a temporary file that is used to store the ontology. This has to be done whenever several PyCRAP ontologies are needed that store different individuals.

ontology: owlready2.Ontology#

The owlready2 ontology that is used for reasoning.

file: tempfile.NamedTemporaryFile#

The file that the ontology is stored in.

python_objects: typing_extensions.Dict[pycrap.ontologies.base.Base, typing_extensions.Any]#

A dictionary that maps ontology individuals to python objects.

property path: str#
individuals()#
destroy_individuals()#

Destroys all individuals in the ontology.

static classes()#
Returns:

All classes of the PyCRAP ontology.

search(*args, **kwargs)#

Check https://owlready2.readthedocs.io/en/latest/onto.html#simple-queries for details.

Returns:

The search results of the ontology.

search_one(*args, **kwargs)#
__enter__()#
__exit__(exc_type, exc_val, exc_tb)#
reason()#

Reason over the ontology. This may take a long time.

add_individual(individual: pycrap.ontologies.base.Base, python_object: typing_extensions.Any)#