Re: Reasoner object property value inference on individuals
Posted by
Jiba on
URL: http://owlready.306.s1.nabble.com/Reasoner-object-property-value-inference-on-individuals-tp3096p3136.html
Hello,
Simple inferences based only on subclass / subproperty relations or inverse relations are indeed not considered when performing reasoning.
Indeed, they are not needed in Owlready, because Owlready automatically takes into account inverse relations when getting the value of a property for an individual. And you can take into account subproperty relations by prefixing the property name with "INDIRECT_".
Here is an example:
from owlready2 import *
onto = get_ontology('
http://test.org/t.owl')
with onto:
class C(Thing): pass
class p1(Thing >> Thing): pass
class p2(p1): pass
class i2(Thing >> Thing):
inverse = p2
c1 = C()
c2 = C()
c1.p2 = [c2]
print(c2.i2) # => [t.c1]
print(c1.INDIRECT_p1) # => [t.c2]