|
This post was updated on .
Hello,
I would like to create a transitive PropertyChain (here PChain) which chains property A and property B.
I use this code to create it :
class PChain(owl.ObjectProperty, owl.TransitiveProperty): pass
impacts.property_chain.append(owl.PropertyChain([A, B]))
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():
owl.destroy_entity(indiv)
for prop in ontology.properties():
owl.destroy_entity(prop)
for class_ in ontology.classes():
owl.destroy_entity(class_)
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.
Thanks in advance for any answer !
|