Hi there,

Sorry to trouble you again. Last month I wrote to you to figure out the bug in text search for TDB. Given the following configuration, text search works with TDB:

@prefix :        <#> .
@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@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#> .

[] rdf:type fuseki:Server ;
   fuseki:services (
     <#service_text_tdb>
   ) .

# TDB
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

# Text
[] ja:loadClass "org.apache.jena.query.text.TextQuery" .
text:TextDataset      rdfs:subClassOf   ja:RDFDataset .
text:TextIndexLucene  rdfs:subClassOf   text:TextIndex .

<#service_text_tdb> rdf:type fuseki:Service ;
    rdfs:label                      "TDB/text service" ;
    fuseki:name                     "ds" ;
    fuseki:serviceQuery             "query" ;
    fuseki:serviceQuery             "sparql" ;
    fuseki:serviceUpdate            "update" ;
    fuseki:serviceUpload            "upload" ;
    fuseki:serviceReadGraphStore    "get" ;
    fuseki:serviceReadWriteGraphStore    "data" ;
    fuseki:dataset                  <#text_dataset> ;
    .

<#text_dataset> rdf:type     text:TextDataset ;
    text:dataset   <#dataset> ;
    text:index     <#indexLucene> ;
    .

<#dataset> rdf:type      tdb:DatasetTDB ;
    tdb:location "DB" ;
    ##tdb:unionDefaultGraph true ;
    .

<#indexLucene> a text:TextIndexLucene ;
    text:directory <file:Lucene> ;
    ##text:directory "mem" ;
    text:entityMap <#entMap> ;
    .

<#entMap> a text:EntityMap ;
    text:entityField      "uri" ;
text:defaultField "text" ; ## Should be defined in the text:map.
    text:map (
         # rdfs:label
         [ text:field "text" ; text:predicate rdfs:label ]
         ) .

Now we want to use text search for in-memory datasets, but we failed after some trials, the configuration file we use is as follows:

@prefix :        <#> .
@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@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 spatial:    <http://jena.apache.org/spatial#> .

[] a fuseki:Server ;
   fuseki:services (
     <#memory>
   ) .

<#memory> a fuseki:Service ;
    fuseki:name                     "memory" ;
    fuseki:serviceQuery             "sparql" ;
    fuseki:serviceQuery             "query" ;
fuseki:serviceUpdate "update" ; # SPARQL query service -- /memory/update fuseki:serviceUpload "upload" ; # Non-SPARQL upload service
    fuseki:serviceReadWriteGraphStore      "data" ;
fuseki:serviceReadGraphStore "get" ; # Graph store protocol (read only) -- /memory/get
    fuseki:dataset           :text_dataset ;
    .

<#dataset> rdf:type ja:RDFDataset ;
    ja:defaultGraph
          [
            a ja:MemoryModel ;
            ja:content [ja:externalContent <file:dcat-vl.ttl> ] ;
          ] .

# Text
[] ja:loadClass "org.apache.jena.query.text.TextQuery" .
text:TextDataset      rdfs:subClassOf   ja:RDFDataset .
text:TextIndexLucene  rdfs:subClassOf   text:TextIndex .

:text_dataset a text:TextDataset ;
    text:dataset   <#dataset> ;
    text:index     <#textIndexLucene> ;
    .

# Text index description
<#textIndexLucene> a text:TextIndexLucene ;
    text:directory <file:Lucene> ;
    ##text:directory "mem" ;
    text:entityMap <#entMap> ;
    .

<#entMap> a text:EntityMap ;
    text:entityField      "uri" ;
    text:defaultField     "text" ;
    text:map (
         [ text:field "text" ; text:predicate rdfs:label ]
         ) .


Additionally, if we enable RDFS reasoning for TDB, text search does not work any more, given the following configuration:

@prefix :        <#> .
@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@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 spatial:    <http://jena.apache.org/spatial#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

[] a fuseki:Server ;
   fuseki:services (
     <#tdb>
   ) .

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

# TDB
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

<#tdb> a fuseki:Service ;
    fuseki:name              "tdb" ;             # http://host/tdb
    fuseki:serviceQuery      "sparql" ;          # SPARQL query service
    fuseki:serviceQuery      "query" ;
    fuseki:serviceUpdate     "update" ;
fuseki:serviceUpload "upload" ; # Non-SPARQL upload service
    fuseki:serviceReadGraphStore    "get" ;
    fuseki:serviceReadWriteGraphStore    "data" ;
    fuseki:dataset           :text_dataset ;
    .

<#tdb_inf_ds> a ja:RDFDataset ;
    ja:defaultGraph       <#tdb_inf> ;
    .

<#tdb_inf> a ja:InfModel ;
    rdfs:label "RDFS Inference Model" ;
    ja:baseModel <#tdb_graph> ;
    ja:reasoner
[ ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> ]
    .

<#tdb_graph> a tdb:GraphTDB ;
    tdb:dataset <#tdb_ds> .

# A TDB datset used for RDF storage
<#tdb_ds> a tdb:DatasetTDB;
    tdb:location "Data";
    .

[] ja:loadClass       "org.apache.jena.query.text.TextQuery" .
text:TextDataset      rdfs:subClassOf   ja:RDFDataset .
text:TextIndexLucene  rdfs:subClassOf   text:TextIndex .

:text_dataset a text:TextDataset ;
    text:dataset   <#tdb_inf_ds> ;
    text:index     <#textIndexLucene> ;
    .

<#textIndexLucene> a text:TextIndexLucene ;
    text:directory <file:Text> ;
    ##text:directory "mem" ;
    text:entityMap <#entMap> ;
    .

<#entMap> a text:EntityMap ;
    text:entityField      "uri" ;
    text:defaultField     "text" ;
    text:map (
         [ text:field "text" ; text:predicate rdfs:label ]
         ) .

All the tests are based on the 2.0.1 SNAPSHOT built on April 8th. Any clue or any suggestion for this issue? Thank you very much and have a nice day.

Regards,
Yang

Reply via email to