简体   繁体   中英

SWRL and Virtuoso

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM