繁体   English   中英

HermiT推理机显示错误结果

[英]HermiT Reasoner showing wrong result

我是OWL API的新手。 我从这里开始使用OWL API大量建议的文档。 我正在使用相同的著名Pizza.owl。 考虑以下代码片段

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");  

现在,“ CheeseyVegetableTopping”没有确定的属性“ hasCountryOfOrigin”,但是if语句将输出以下内容:

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

无论我在推理机中使用哪个比萨饼,都不会出现在上面显示的其他比萨饼中。 意味着无论属性是否存在,hasProperty函数都将返回true。 辅助工具hasProperty的使用与OWL-API-documentation中的用法完全相同。 我不知道我应该在这里复制还是不复制。 我不是为了简化事情而复制。 提前致谢。

在这种情况下,您需要仔细查看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>

请注意, CheeseyVegetableTopping不一致的 这意味着不可能有任何实例。 毫无疑问 ,每个CheesesyVegetableTopping必须具有原产国,因为没有反例。 也就是说,有没有没有来源国cheesey蔬菜浇头。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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