Inference issue with existential restriction

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Inference issue with existential restriction

jayson
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
Reply | Threaded
Open this post in threaded view
|

Re: Inference issue with existential restriction

Jiba
Administrator
Hello,

I think the problem is in the definition of Potato and Coconut. Both have the same equivalent_to definition, and thus the reasoner infers that Potato is equivalent to Coconut. Since they are now equivalent, you cannot distinguish them.

The Potato and Coconut definitions means that anything that is a fruit and that can be peeled is a Potato and a Coconut.

I think you should rather defines Potato and Coconut without equivalent_to relations, as follows:

    class Potato(Fruit):
        is_a = [Fruit & hasCharacteristic.some(Peel)]

    class Coconut(Fruit):
        is_a = [Fruit & hasCharacteristic.some(Peel)]

which means that both are fruit and peelable, but does not imply that any fruit peelable is a Potato and a Coconut.

This definition is Ok unless you want to infer the belonging to the Potato and Coconut class.

Best regards,
Jiba