简体   繁体   中英

HermiT Reasoner showing wrong result

I am new to OWL API. I am using OWL API vastly suggested documentation from here . I am using same famous Pizza.owl. Consider the following code snippet

OWLClass mozzarellaTopping = manager.getOWLDataFactory().getOWLClass(IRI.create(prefix + "CheeseyVegetableTopping"));  
OWLObjectProperty hasOrigin = manager.getOWLDataFactory().getOWLObjectProperty(IRI.create(prefix + "hasCountryOfOrigin"));  

if (hasProperty(manager, reasoner, mozzarellaTopping, hasOrigin)) 
    System.out.println("Instances of " + mozzarellaTopping  + " have a country of origin" + hasOrigin);  
else
    System.out.println("No country of origin does not exist");  

Now the "CheeseyVegetableTopping" does not have property "hasCountryOfOrigin" for sure but the if statement would printout following:-

Instances of <http://localhost:3030/Pizza.owl#CheeseyVegetableTopping> have a country of origin<http://localhost:3030/Pizza.owl#hasCountryOfOrigin>

No matter which Pizza i used in the reasoner, it would not go in the else of the if shown above. Means the hasProperty function would return true no matter the property exist or not. The helper hasProperty has been used exactly the same from OWL-API-documentation . I dont know should i have copied that here or not. I am not copying to keep the things simple. Thanks in advance.

In this case, you need to take a closer look at pizza.owl:

<owl:Class rdf:about="#CheeseyVegetableTopping">
    <rdfs:label xml:lang="pt"
        >CoberturaDeQueijoComVegetais</rdfs:label>
    <rdfs:comment xml:lang="en"
        >This class will be inconsistent. This is because we have given it 2 disjoint parents, which means it could never have any members (as nothing can simultaneously be a CheeseTopping and a VegetableTopping). NB Called ProbeInconsistentTopping in the ProtegeOWL Tutorial.</rdfs:comment>
    <rdfs:subClassOf>
        <owl:Class rdf:about="#CheeseTopping"/>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
        <owl:Class rdf:about="#VegetableTopping"/>
    </rdfs:subClassOf>
</owl:Class>

Note that CheeseyVegetableTopping is inconsistent . That means that there can be no instances of it. It's vacuously true that every CheesesyVegetableTopping must have country of origin because there are no counterexamples. That is, there are no cheesey vegetable toppings that don't have a country of origin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM