Re: Inferring Object Properties for Individuals Based on Asserted SomeValuesFrom
Posted by
Jiba on
URL: http://owlready.306.s1.nabble.com/Inferring-Object-Properties-for-Individuals-Based-on-Asserted-SomeValuesFrom-tp527p538.html
I tested your example (its now test case prop_29 in test/regtest.py), as follows:
def test_prop_29(self):
world = self.new_world()
n = world.get_ontology("
http://www.semanticweb.org/test.owl")
with n:
class Ingredient(Thing): pass
class Kale(Ingredient): pass
class Taste(Thing): pass
class Bitter(Taste): pass
class has_taste(Ingredient >> Taste): pass
bitter = Bitter()
Kale.is_a.append(has_taste.some(Bitter))
kale = Kale()
print(kale.has_taste)
print(set(kale.has_taste.indirect()))
assert kale.has_taste == []
assert set(kale.has_taste.indirect()) == { Bitter }
kale.has_taste.indirect() contains Bitter. It is not the instance but the class, because resolving singleton is not so simple (if you want to resolve all of them, you must take into account "same as" relations between individuals).
If you really need individuals, you can remove the class Bitter, create individual bitter as an instance of Taste, and assert that: Kale.is_a.append(has_taste.value(bitter))
Jiba