I am having a difficult time figure out how to add inference capabilities to an 
otherwise working Fuseki configuration with Lucene indexing. I'll start with my 
questions, and follow with the full details.

 

1. Does anyone have a working assembler file that has both reasoning and Lucene 
indexing?

2. Does anyone know where to find the valid list of reasoner URLs and an 
accurate description of the expected inference?

3. Is there a way to set an inferred graph over the union of named graphs as 
the default graph?

 

 

On the details: 

Here is my working assembler file, with Lucene but without reasoning:

 

 

@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .

@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .

@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .

@prefix text:    <http://jena.apache.org/text#> .

@prefix fuseki:  <http://jena.apache.org/fuseki#> .

@prefix foaf:    <http://xmlns.com/foaf/0.1/> .

@prefix fma:        <http://purl.org/sig/ont/fma/> .

@prefix :        <http://localhost/jena_example/#> .

 

[] rdf:type fuseki:Server ;

   fuseki:services (

     :service_text_tdb

   ) .

 

## Initialize TDB

[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .

tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .

tdb:GraphTDB    rdfs:subClassOf  ja:Model .

 

## Initialize text query

[] ja:loadClass       "org.apache.jena.query.text.TextQuery" .

# A TextDataset is a regular dataset with a text index.

text:TextDataset      rdfs:subClassOf   ja:RDFDataset .

# Lucene index

text:TextIndexLucene  rdfs:subClassOf   text:TextIndex .

 

## OCDM

 

# configure dataset with term indexing

:text_dataset2 rdf:type     text:TextDataset ;

    text:dataset   :dataset2 ;

   text:index     :indexLucene2 ;

    .

 

# A TDB datset used for RDF storage

:dataset2 rdf:type      tdb:DatasetTDB ;

    tdb:location "/usr/local/service/fuseki-tdb/run/databases/ocdm" ;

    tdb:unionDefaultGraph true ;

    .

 

# Text index description

:indexLucene2 a text:TextIndexLucene ;

    text:directory 
<file:///usr/local/service/fuseki-tdb/run/configuration/Lucene/ocdm> ;

    text:entityMap :entMap2 ;

    text:storeValues true ;

    text:analyzer [

        a text:LowerCaseKeywordAnalyzer 

    ] ;

    text:queryAnalyzer [

        a text:LowerCaseKeywordAnalyzer

    ] ;

    .

 

# Mapping in the index

# URI stored in field "uri"

# rdfs:label is mapped to field "text"

:entMap2 a text:EntityMap ;

    text:entityField     "uri" ;

    text:defaultField    "text" ;

    text:map (

        [ text:field "text"; 

                text:predicate rdfs:label;

        ]

        [ text:field "preferred" ; 

                text:predicate fma:preferred_name; 

        ]

        [ text:field "synonym" ; 

                text:predicate fma:synonym; 

        ]

        [ text:field "non-english" ; 

                text:predicate fma:non-English_equivalent;

        ]) ;

    .

 

 

:service_text_tdb2 rdf:type fuseki:Service ;

    rdfs:label                      "TDB/ocdm_service" ;

    fuseki:name                     "ocdm" ;

    fuseki:serviceQuery             "query" ;

    fuseki:serviceQuery             "sparql" ;

    #fuseki:serviceUpdate            "update" ;

    #fuseki:serviceUpload            "upload" ;

    fuseki:serviceReadGraphStore    "get" ;

    #fuseki:serviceReadWriteGraphStore    "data" ;

    fuseki:dataset                  :text_dataset2 ;

 

 

 

Now, this is what I tried (amongst several other trial configurations), in my 
attempt to add inference (simple RDFS):

 

I added the following, and changed the fusedki:dataset value, in :service to 
:rdf_dataset2

 

# Configure basic transitive reasoning

:rdf_dataset2 rdf:type ja:RDFDataset ;

    ja:defaultGraph :model2 .

 

:model2 rdf:type ja:InfModel ;

    ja:baseModel :tdb_graph2 ;

    ja:reasoner [

        ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner>] .

 

:tdb_graph2 rdf:type tdb:GraphTDB ;

    tdb:dataset :text_dataset2 .

 

 

With these changes, I get the error: 

 

org.apache.jena.assembler.exceptions.AssemblerException: caught: The object 
:text_dataset2 has no value for the required property 
<http://jena.hpl.hp.com/2008/tdb#location>

  doing:

    root: http://localhost/jena_example/#tdb_graph2 with type: 
http://jena.hpl.hp.com/2008/tdb#GraphTDB assembler class: class 
org.apache.jena.tdb.assembler.TDBGraphAssembler

    root: http://localhost/jena_example/#model2 with type: 
http://jena.hpl.hp.com/2005/11/Assembler#InfModel assembler class: class 
org.apache.jena.assembler.assemblers.InfModelAssembler

    root: http://localhost/jena_example/#rdf_dataset2 with type: 
http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset assembler class: class 
org.apache.jena.sparql.core.assembler.DatasetAssembler

 

Just as a test, even though I assumed that I'd lose the Lucene index, I kept 
the above addition but changed the fusedki:dataset value, in :service, to : 
dataset2 (i.e. went straight to the DatasetTDB instead of the TextDataset). In 
this case, it doesn't throw an error, but there is very little returned in the 
SPARQL results. Based on another thread I found, I think that this might have 
to do with using a reasoner over multiple named graphs unioned via 
tdb:unionDefaultGraph true. Which leads to my 3rd question above, is there a 
way to set an inferred graph over the union of named graphs as the default 
graph?

  

Thanks you,

Todd

 

Reply via email to