|
Hello,
I'm trying to destroy some annotations properties and when a run a code like this
___________________________________________
onto = get_ontology('file://ontology_path).load()
ann_props = [ann for ann in onto.annotation_properties()]
for ann_prop in ann_props:
if 'obo.RO_0002514' in str(ann_prop):
destroy_entity(ann_prop)
__________________________________________
I get this error:
___________________________________________________
KeyError Traceback (most recent call last)
/Users/citlallimejiaalmonte/Documents/ECCO/ontologies/MICRO/Fixing_logic/looking_for_error_insertion in <module>()
30 for ann_prop in ann_props:
31 if 'obo.RO_0002514' in str(ann_prop):
---> 32 destroy_entity(ann_prop)
33
34 # for ann_prop in ann_props:
/Users/citlallimejiaalmonte/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/site-packages/owlready2/prop.py in destroy_entity(e)
384 delattr(s, e._python_name)
385
--> 386 del e.namespace.world._props[e._python_name]
387 del e.namespace.world._reasoning_props[e._python_name]
388
KeyError: 'RO_0002514'
_________________________________________________________
when I run almost the exact same code (only the entity name changed), I successfully destroy the entity.
_____________________________________________
onto = get_ontology('file://ontology_path).load()
ann_props = [ann for ann in onto.annotation_properties()]
for ann_prop in ann_props:
if 'obo.BFO_0000054' in str(ann_prop):
destroy_entity(ann_prop)
_______________________________________________
What is going on?
Also, I'm trying to remove these annotation properties to fix some "Illegal redeclaration of entities". In other words, I have an ontology which uses the same IRI for an object property and for an annotation property. I would like to destroy only the annotation property, is this possible?
Cheers
|