4

I am using Jena Fuseki to load a Jena TDB file to construct a SPARQL service. The fuseki reasoner config has the following:

<#inf_model> a ja:InfModel ;
    ja:baseModel <#union_model>;
    ja:reasoner [ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLMicroFBRuleReasoner>] ;

Now,I also want to write some rules and set a generic rule reasoner for the Fuseki server. How should I configure Fuseki to combine both the OWL reasoner and the generic rule reasoner?

I have tried the following config:

<#inf_model> a ja:InfModel ;
    ja:baseModel <#union_model>;
    ja:reasoner [ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLMicroFBRuleReasoner>] ;

    ja:reasoner [
        ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ; 
        ja:rulesFrom <file://D:/Program%20Files/apache-jena-fuseki-3.13.1/run/rule.ttl>; ]

But it fails with

...multiple values for the unique property http://jena.hpl.hp.com/2005/11/Assembler#reasoner

Can the Fuseki have more than one reasoner?

xrds
  • 61
  • 3

2 Answers2

1

The inference documentation has a section called "Combining RDFS/OWL with custom rules". The first suggestion they make is "construct one InfModel using another InfModel as the base data."

They don't give an example but based on that I was able to get the following to work:

config:dataset a ja:RDFDataset ;
    ja:defaultGraph       <#model_inf2> ;
     .

<#model_inf2> a ja:InfModel ;
     ja:baseModel <#model_inf1> ;

     ja:reasoner [
        ja:rulesFrom <file:/my-rules.rules> ;
        ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner>
     ] .

<#model_inf1> a ja:InfModel ;
     ja:baseModel <#graph> ;
     ja:reasoner [
        ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
     ] .

<#graph> rdf:type tdb:GraphTDB ;
  tdb:dataset config:tdb_dataset_readwrite .

config:tdb_dataset_readwrite
        a             tdb:DatasetTDB ;
        tdb:location  "<path-to-tbd-dataset>"
        .
0

You can use your rules from a file using the GenericRuleReasoner and include other reasoners inside your rules' file with (@include), for instance (using OWLMicroFBRuleReasoner):

@prefix ex: http://ex.org/
@prefix foaf: http://xmlns.com/foaf/0.1/
@include <owlmicro>

# Some rule:
(?s ?p ?o) -> (?o ?p ?s) .
Marcelo Machado
  • 1,179
  • 2
  • 13
  • 33