Hello Together,
please consider the following ontology:
from owlready2 import *
onto = get_ontology("http://test.org/test.owl")
with onto:
class Fruit(Thing):
pass
class Characteristic(Thing):
pass
class Peel(Characteristic):
pass
class Tool(Thing):
pass
class hasCharacteristic(Fruit >> Characteristic):
pass
class dealsWithCharacteristic(Tool >> Characteristic):
pass
class appliedToFood(Tool >> Fruit):
pass
class Potato(Fruit):
equivalent_to = [Fruit &
hasCharacteristic.some(Peel)]
class Coconut(Fruit):
equivalent_to = [Fruit &
hasCharacteristic.some(Peel)]
class Peeler(Tool):
equivalent_to = [Tool &
dealsWithCharacteristic.some(Peel) &
appliedToFood.some(Potato)]
class CoconutOpener(Tool):
equivalent_to = [Tool &
dealsWithCharacteristic.some(Peel) &
appliedToFood.some(Coconut)]
tool = Tool(dealsWithCharacteristic=[Peel()],
appliedToFood=[Potato()])
sync_reasoner()
After executing the reasoner i get the tool "Peeler" and "CoconutOpener" since both "Fruits" share the characteristic "Peel". How is it possible to just receive "Peeler" as a tool when I specify "Potato"?
I tried to use universal restrictions in the form
class Peeler(Tool):
equivalent_to = [Tool &
dealsWithCharacteristic.some(Peel) &
appliedToFood.only(Potato)],
but was not able to solve this (in Protégé it worked that way).
Best regards,
jayson