SWRL and Virtuoso

牧云@^-^@ 提交于 2019-12-13 21:29:07

问题


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)

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
 }

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?


回答1:


Virtuoso 7.x does not support SWRL.

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

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

Your rough SWRL above translates roughly to --

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

-- or --

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

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

  1. Describe (with a collection of RDF statements in a Turtle doc) your Rule using SPIN terms
  2. EXEC ('SPARQL ' || SPARQL_SPIN_GRAPH_TO_DEFSPIN('{turtle-doc-with-rule-description-iri'))
  3. Test your Rule

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



来源:https://stackoverflow.com/questions/28468426/swrl-and-virtuoso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!