本文介绍了SWRL和Virtuoso的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种明确的方法,以便在virtuoso服务器中清楚地使用SWRL.例如,我使用Protege 4.3设计了一个本体,并使用Protege中的规则"选项卡编写了SWRL规则.

I'm looking for a clear approach to use SWRL clearly in virtuoso server. For example, I designed an ontology using Protege 4.3 and I wrote the SWRL rules using Rules tab in Protege.

Product(?P),hasName(?P,?N),inGroupB(?P,?B)->hasBug(?P)

我将我的RDF数据(约3GB)连同本体架构一起上传到了Virtuoso服务器.我试图回忆起应该根据本体中的规则推断出的数据,但是查询返回空结果. SPARQL查询的示例,它应清楚地从上述规则返回推断的关系,如下所示:

I uploaded my RDF data (~3GB) into Virtuoso server, along with the Ontology schema. I tried to recall the data that is supposed to be inferred based on the Rules in the ontology but the query return empty results. Example of the SPARQL query that it should clearly return the inferred relation form the rule above as follow:

DEFINE input:inference <http://example.com/2/owl>  
PREFIX e:<http://example.com/e/>
SELECT * 
FROM <http://example.com/2/data> 
WHERE 
 { 
     ?P a e:Product ; 
      e:hasBug ?B
 }

我认为在将事物集成在一起(RDF数据,OWL模式和SWRL规则)方面存在问题.我使用了Jena和Virtuoso Jena驱动程序来加载数据,本体并运行SPARQL查询.关于如何使推理部分正常工作的任何建议?

I believe that I have problem on integrating the things together (RDF data ,OWL schema and SWRL rules). I used Jena and Virtuoso Jena driver in order to load data, ontology and run the SPARQL queries. Any advice on how to let the reasoning part work properly?

推荐答案

Virtuoso 7.x不支持SWRL.

Virtuoso 7.x does not support SWRL.

Virtuoso 8.x实现了SPIN,可以将SWRL转换为SPIN,以及其他复杂的推理.

Virtuoso 8.x implements SPIN, into which SWRL can be translated, among other complex reasoning.

请参见使用SPIN词汇表和Virtuoso 8.0 创建自定义推理规则.

See Creating Custom Inference Rules using the SPIN Vocabulary and Virtuoso 8.0 for one walk-through.

您上面的粗略SWRL大致翻译为-

Your rough SWRL above translates roughly to --

CONSTRUCT { ?P <hasBug> ?B }
WHERE
  {
    ?P  a           <Product> ;
        <hasName>   ?N ;
        <inGroupB>  ?B .    
  }

-或-

CONSTRUCT { ?P a <BuggyProduct> }
WHERE 
  {
    ?P  a           <Product> ;
        <hasName>   ?N ;
        <inGroupB>  ?B .    
  }

拥有SPARQL CONSTRUCT后,制定自定义推理规则可归结为以下几个步骤:

Once you have a SPARQL CONSTRUCT, making a Custom Inference Rule boils down to a few steps:

  1. 使用SPIN术语(在Turtle文档中包含RDF语句的集合)描述您的规则
  2. EXEC ('SPARQL ' || SPARQL_SPIN_GRAPH_TO_DEFSPIN('{turtle-doc-with-rule-description-iri'))
  3. 测试您的规则

更多完整的用户文档正在进行中;您可以通过 Virtuoso用户邮件列表 OpenLink支持案例系统.

More complete user documentation is in progress; you can get assistance via the Virtuoso Users mailing list or the OpenLink Support Case System.

这篇关于SWRL和Virtuoso的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 23:19