gpt4 book ai didi

java - HermiT Reasoner 显示错误结果

转载 作者:行者123 更新时间:2023-12-01 22:42:43 24 4
gpt4 key购买 nike

我是 OWL API 的新手。我正在使用 here 中大量建议的 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>

无论我在推理机中使用哪个 Pizza,它都不会出现在上面所示的 if 的 else 中。意味着无论属性存在与否,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 都必须有原产国,这是毫无疑问的,因为没有反例。也就是说,没有任何奶酪蔬菜配料没有有原产国。

关于java - HermiT Reasoner 显示错误结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25876069/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com