3

New to fuseki/jena here. I managed to get fuseki to run with OWLFBRuleReasoner using tdb1 no problem, but can't make it work with tdb2 (http://jena.apache.org/2016/tdb#). I could not find an explicit example of configuration that uses both TDB2 and OWLFBRuleReasoner, so I just converted this one (that works)

    @prefix :      <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

# fuseki configuration to have OWL entailment
# this is the configuration on s-stf-gin (fuseki data folder is on c:\)

:service_tdb_all  a                   fuseki:Service ;
        rdfs:label                    "TDB gsip" ;
        fuseki:dataset                :tdb_dataset_readwrite ;
        fuseki:name                   "gsip" ; 
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore
                "data" ; 
        fuseki:serviceUpdate          "update" ; 
        fuseki:serviceUpload          "upload" . 

        # above, remove data, update and upload in prod
:tdb_dataset_readwrite
        a             ja:RDFDataset;
        rdfs:label "GSIP";
        ja:defaultGraph       <#model_inf> ;
        tdb:location  "c:\\fuseki/databases/gsip" .

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

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

(this one works fine. I tested with a owl:inverseOf property)

into this one (that does not work)

@prefix :      <http://base/#> .
@prefix tdb2:   <http://jena.apache.org/2016/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

:service_tdb_all  a                   fuseki:Service ;
        fuseki:dataset                :dataset ;
        fuseki:name                   "gsip" ;
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore "data" ;
        fuseki:serviceUpdate          "update" ;
        fuseki:serviceUpload          "upload" .

:dataset a ja:RDFDataset ;
    ja:defaultGraph       <#model_inf> ;
    tdb2:location  "c:\\fuseki/databases/gsip"
     .

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

<#graph> rdf:type tdb2:GraphTDB ; # also tried tdb2:GraphTDB2
  tdb2:dataset :dataset .

As you can see, I basically just replace tdb with tdb2 (namespaces and all). Fuseki starts and runs fine, but OWL inference does not work.

Anyone can point me to relevant documentation / example ? or maybe I totally misunderstood TDB1 vs TDB2 deal.

Thanks you

EDIT: fixed my TDB2 configuration file (still does not work).

Eric Boisvert
  • 135
  • 3
  • 9
  • The Jena mailing list is for sure the better/faster way to get a useful answer. (although Andy Seaborne, the core developer, is also answering here sometimes) – UninformedUser Feb 14 '18 at 08:24
  • Dos the Fuseki log file contain any useful information? – AndyS Feb 14 '18 at 16:47
  • Does non-inferred data show up? I notice you are using the same file area for TDB1 and TDB2 databases. TDB2 does not work with TDB1 databases and does not read them. In fact, its database is held with a sublocation of the tdb2:location (so TDB1 data is not corrupted - it's just completely ignored). Data must be separately loaded into TDB2. – AndyS Feb 14 '18 at 16:48
  • Fuseki log folder us always empty (that's another issue I need to resolve) and , about imcompatible TDB1 and TDB2 - I wiped the database clear between tests. – Eric Boisvert Feb 15 '18 at 10:32
  • Will try the mailing list. thanks – Eric Boisvert Feb 15 '18 at 10:33
  • I notice that at the GraphTDB level you refer back to the original :tdb_dataset_readwrite dataset of the service, creating a loop. Why is that necessary? I always assumed these were two different datasets (one high level and the other low level). – Barry NL Feb 16 '18 at 12:17
  • @BarryNL - good point. There are two "default graphs" here, the inference one and the storage one. – AndyS Feb 18 '18 at 15:12
  • @BarryNL I don't know why I loop back. I think I got this from some example on the web and it works for TDB1. No thinking involved. – Eric Boisvert Feb 19 '18 at 22:14

2 Answers2

0

The following works for me:

@prefix :      <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

:service_tdb_all  a                   fuseki:Service ;
        rdfs:label                    "TDB [MyDatasetName]" ;
        fuseki:dataset                :inferred_dataset ;
        fuseki:name                   "[MyDatasetName]" ;
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore
                "data" ;
        fuseki:serviceUpdate          "update" ;
        fuseki:serviceUpload          "upload" .

:inferred_dataset a ja:RDFDataset ;
        ja:defaultGraph :inference_model .

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

:tdb_graph a tdb:GraphTDB ;
        tdb:dataset :tdb_dataset_readwrite .

:tdb_dataset_readwrite
        a             tdb:DatasetTDB ;
        tdb:location  "[MyDatasetLocationOnDisk]" .

Main differences with your version are a separate dataset without inference (instead of the loop back 'Barry NL' already noticed) and a different namespace for the tdb prefix. Note that namespace prefixes are free to choose (they have no semantic meaning), and changing a namespace prefix does not matter as long as it points to the same namespace URL.

Arnout Boks
  • 664
  • 3
  • 5
0

This is my work:

@prefix :      <http://base/#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix tdb2:  <http://jena.apache.org/2016/tdb#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

:service_tdb_all  a                   fuseki:Service ;
        rdfs:label                    "TDB2 food" ;
        fuseki:dataset                :tdb_dataset_readwrite ;
        fuseki:name                   "food" ;
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore
                "data" ;
        fuseki:serviceUpdate          "update" ;
        fuseki:serviceUpload          "upload" .

:tdb_dataset_readwrite a ja:RDFDataset;
  ja:defaultGraph :modelInf;
  .

:modelInf a ja:InfModel;
  ja:reasoner [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>] ;
  #ja:reasoner [ ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ; 
                     # ja:rulesFrom <file:///C:/Users/shaoj/Documents/IntelligentQA/apache-jena-fuseki-3.8.0/run/databases/rules.ttl> ] ;
  ja:baseModel :gra ;
  .
:gra a tdb2:GraphTDB;
        tdb2:location  "C:\\Users\\shaoj\\Documents\\IntelligentQA\\apache-jena-fuseki-3.8.0\\run/databases/food" ;
  tdb2:unionDefaultGraph true ; 
  .
Svpwm
  • 11
  • 1