Login  Register

Inverse proeprty is not updated when in other ontology

Posted by franzlst on May 31, 2022; 11:14am
URL: http://owlready.306.s1.nabble.com/Inverse-proeprty-is-not-updated-when-in-other-ontology-tp2859.html

When I have a individual in ontology o1 and update a property, it's inverse property is not updated, when I am in the context of another ontology o2.

Here is a short code snippet that reproduces the issue:

from owlready2 import *

o1 = get_ontology("http://test.de/o1")
o2 = get_ontology("http://test.de/o2")

with o1:  # all information defined in o1
    class A(Thing):
        pass

    class B(Thing):
        pass

    class parent(ObjectProperty, FunctionalProperty):
        domain = [A]
        range = [B]

    class child(ObjectProperty):
        domain = [A]
        range = [B]
        inverse_property = parent

    a = A()
    b = B()
    a.parent = b
    assert b.child == [a]

with o2:  # updating property in other ontology context
    a.parent = None
    assert b.child is None  # AssertionError: b.child is still set to [a]


Is this supposed to happen? It's irritating and I think this is a bug.