Later in the execution, I would like to clean the whole ontology by destroying every of its entities with this function :
def empty_ontology() -> None:
"""Empty the ontology by destroying individuals, properties and classes."""
for indiv in ontology.individuals():
for prop in ontology.properties():
for class_ in ontology.classes():
I have three questions about this :
- Is it the right way to create my PropertyChain ? It seems to work when I run the reasoner (Relation is created when needed and axioms from transitivity are inferred) after creating it but I not sure it's the proper way to do it.
- Is there a better way to destroy all entities of an ontology ? Maybe a function that already exists in owlready ?
- When I create the PropertyChain and then try to empty the ontology, I have an error that I don't know how to fix : AttributeError: 'PropertyChain' object has no attribute 'subclasses'. If I save my ontology after creating the PropertyChain, then stop the execution, reload the ontology in another execution, and try to empty it, I don't have the same message and everything seems to work.