0
votes

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
I don't see anything related to Jena in the question.AndyS
I used Jena to automatically upload RDF data and ontology into virtuoso.Programmer
Does Virtuoso support SWRL? I thought it was limited to only some OWL reasoningMichael

1 Answers

0
votes

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.