[英]no inferences with DL queries in OWL - API
I am trying to write a query 我正在尝试编写查询
Hospitals and hasNameWithWords value "center"^^string
医院和hasNameWithWords值“中心” ^^字符串
This query returns me the instances that has the hospitals that has "center" in its name in Protege 4.2 with FACT++ reasoner as well as Hermit reasoner 此查询返回我的实例,该实例的医院在Protege 4.2中使用FACT ++推理程序和隐士推理程序,其名称中具有“中心”
but when i input the same query in the OWL-API's DL Query Example thats available in the website http://sourceforge.net/p/owlapi/code/ci/aef6981535f07a2d0d44c394b9f4d5415f36025a/tree/contract/src/test/java/org/coode/owlapi/examples/DLQueryExample.java 但是当我在OWL-API的DL查询示例中输入相同的查询时,该查询可在以下网站上找到: http://sourceforge.net/p/owlapi/code/ci/aef6981535f07a2d0d44c394b9f4d5415f36025a/tree/contract/src/test/java/org/ coode / owlapi / examples / DLQueryExample.java
I don't get any result. 我没有任何结果。
But it gives me result when i write simple queries such as 但是当我编写简单的查询(例如,
Hospitals
医院
Is it because the reasoner in the code is not able to make the inference? 是因为代码中的推理程序无法进行推理吗?
What other reasoner would be better? 还有什么其他理由会更好?
The class you use as example ( DLQueryExample.java
) relies on an OWL-API built-in structural reasoner ( OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
). 您作为示例使用的类(
DLQueryExample.java
)依赖于OWL-API内置的结构推理器 ( OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
)。
This type of reasoner is fairly simple and is not suited for complex queries as yours. 这种类型的推理程序非常简单,不适合像您这样的复杂查询。 It can however provide answers on the class hierarchy: This is why you get some results with the straightforward query
Hospitals
. 但是,它可以提供有关类层次结构的答案:这就是为什么通过直接查询
Hospitals
可以获得一些结果的原因。
What you need to do is to set your code to either use Hermit or FACT++. 您需要做的是将代码设置为使用隐士或FACT ++。 I give the example with Hermit :
我以隐士为例:
OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
by: OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
. org.semanticweb.HermiT.Reasoner
in order to make it work. org.semanticweb.HermiT.Reasoner
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.