A code snippet say more than a thousand words or so, so here is a code snippet that demonstrates what I think is an owlready2 bug:
from owlready2 import *
o1 = get_ontology("http://test.de/test")
with o1:
class A(Thing):
pass
class B(Thing):
pass
class C(Thing):
pass
class a_to_b(ObjectProperty):
domain = [A]
range = [B]
class b_to_c(ObjectProperty):
domain = [B]
range = [C]
class c_to_b(ObjectProperty):
domain = [C]
range = [B]
inverse_property = b_to_c
a = A()
b = B()
c = C()
a.a_to_b = [b]
b.b_to_c = [c]
assert c.c_to_b == [b]
destroy_entity(b)
assert a.a_to_b == [] # asserts to True
assert c.c_to_b == [] # asserts to False
Two properties point to entity b, one is a "direct" property, one is an inverse property. When b is destroyed, the direct property is currectly updated, the inverse one is not.
I already had a look at the code: In triplelite.py, in destroy_entity (line 942), the modified relations that are collected are only the direct relations, not the inverse ones.