OWL中没有与DL查询有关的推论-API [英] no inferences with DL queries in OWL - API

查看:125
本文介绍了OWL中没有与DL查询有关的推论-API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写查询

医院和hasNameWithWords值中心" ^^字符串

Hospitals and hasNameWithWords value "center"^^string

此查询返回我的实例,这些实例的医院在Protege 4.2中使用FACT ++推理程序和隐士推理程序在其名称中具有中心"

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

但是当我在OWL-API的DL查询示例中输入相同的查询时,该查询在网站上可用 http://sourceforge.net/p/owlapi/code/ci/aef6981535f07a2d0d44c394b9f4d5415f36025a/tree/contract/src/test/java/org/coode/owlapi/examples/DLQueryExample.java

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

我没有任何结果.

但是当我编写诸如

医院

是因为代码中的推理程序无法进行推理吗?

Is it because the reasoner in the code is not able to make the inference?

还有什么其他的推理方法会更好?

What other reasoner would be better?

推荐答案

您用作示例(DLQueryExample.java)的类依赖于OWL-API内置的结构推理器(OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory(); ).

The class you use as example (DLQueryExample.java) relies on an OWL-API built-in structural reasoner (OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();).

这种类型的推理程序非常简单,不适合像您这样的复杂查询.但是,它可以提供有关类层次结构的答案:这就是为什么使用直接查询Hospitals会得到一些结果的原因.

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.

您需要做的是将代码设置为使用隐士或FACT ++.我用隐士给出示例:

What you need to do is to set your code to either use Hermit or FACT++. I give the example with Hermit:

  • 下载 HermiT jar文件并将其添加到项目的类路径中.
  • 在您的课堂上,将行OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();替换为:OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();.您必须导入org.semanticweb.HermiT.Reasoner才能使其正常工作.
  • 我们只是将默认推理机替换为HermiT.其余代码应保持不变,并且您的查询现在应该可以正常工作.
  • 您可以尝试 FaCT ++
  • Download HermiT jar file and add it to the class path of your project.
  • In your class, replace the line OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory(); by: OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();. You should have to import org.semanticweb.HermiT.Reasoner in order to make it work.
  • We just replaced the default reasoner by HermiT. The rest of the code should stay the same and your query should now work.
  • You could try FaCT++ and Pellet and compare speed, etc...

这篇关于OWL中没有与DL查询有关的推论-API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆