Ambiguous reasoner output

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

Ambiguous reasoner output

Chen
Hello, first of all thank you for this amazing ontology package. My question is not exactly related to the owlready2 itself.

When I was playing around with the reasoner example using one of my own made-ups, I got some missing classifications in the process. For example, let's say we have an ontology like this:

'''
import owlready2 as owl2
onto = owl2.get_ontology("http://test.org/onto/")

with onto:
    class Temperature(owl2.Thing):
        pass
    class Material(owl2.Thing):
        pass
   
    # Temperature Partition
    class Cold(Temperature):
        pass
    class Hot(Temperature):
        pass
    Temperature.equivalent_to = [Cold | Hot]
    owl2.AllDisjoint([Cold, Hot])
    class canWithstandTemperature(owl2.ObjectProperty):
        domain = [Material]
        range = [Temperature]
        python_name = "can_withstand_temperature"
   
    # Material Partition
    class SoftMaterial(Material):
        equivalent_to = [Material & ~ canWithstandTemperature.some(Hot)]
    class HardMaterial(Material):
        equivalent_to = [Material & ~ SoftMaterial]
       
    Material.equivalent_to = [SoftMaterial | HardMaterial]
    owl2.AllDisjoint([SoftMaterial, HardMaterial])

# Test the reasoner
temp1 = Cold('15_deg')
temp2 = Hot('85_deg')

owl2.AllDifferent([temp1, temp2])

material1 = Material('Plastic', can_withstand_temperature = [temp1])
material2 = Material('Centric', can_withstand_temperature = [temp2])
material3 = Material('Glass', can_withstand_temperature = [temp1, temp2])

# Run reasoner
with onto:
    owl2.sync_reasoner()
'''

The logic is, any SoftMaterial cannot withstand Hot temperature while HardMaterial has no problem with Cold or Hot. After I run the reasoner, material2 and 3 have no problem being classified as HardMaterial, while material1 is not classified as either SoftMaterial or HardMaterial.

Wonder if I misunderstand anything in detail.
Reply | Threaded
Open this post in threaded view
|

Re: Ambiguous reasoner output

Jiba
Administrator
Hello,

The result you obtain is normal: for material1, you stated that it withstand cold temperature, but you did not mention anything regarding hot temperature. Thus, the reasoner cannot conclude.

If you want the reasoner to conclude that it is a soft material, you need to explicitly state that material1 can only withstand cold temperatures. For example :

material1.is_a.append(canWithstandTemperature.only(Cold))

Jiba