I have a very large ontology RDF file (almost 4M instances) that I'm currently streaming via Fuseki v2.0.0. My assembler file looks like this:
@prefix : <#> .
@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 myprefix: <http://www.example.org/some/path/myprefix#> .
## Example of a TDB dataset and text index
## 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 .
# Solr index
text:TextIndexSolr rdfs:subClassOf text:TextIndex .
## ---------------------------------------------------------------
## This URI must be fixed - it's used to assemble the text dataset.
:text_dataset rdf:type text:TextDataset ;
text:dataset <#dataset> ;
text:index <#indexLucene> ;
.
# A TDB datset used for RDF storage
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;
tdb:unionDefaultGraph true ; # Optional
.
# Text index description
<#indexLucene> a text:TextIndexLucene ;
text:directory <file:Lucene> ;
##text:directory "mem" ;
text:entityMap <#entMap> ;
.
# Mapping in the index
# URI stored in field "uri"
# myprefix:foo is mapped to field "text"
<#entMap> a text:EntityMap ;
text:entityField "uri" ;
text:defaultField "text" ;
text:map (
[ text:field "text" ; text:predicate myprefix:foo ]
) .
In order to perform text searches on a particular element within a reasonable response time, I imported the RDF file using text indexing:
$ java -cp $FUSEKI_HOME/fuseki-server.jar tdb.tdbloader --tdb=run/text-config.ttl ontologies.rdf
... and
$ java -cp $FUSEKI_HOME/fuseki-server.jar jena.textindexer --desc=run/text-config.ttl
... then running the Fuseki server as
./fuseki-server -v --debug -loc=DB /dataset
No errors during the import, and I can run various SPARQL queries against this new dataset with no issues. But when I try to perform a full-text query, I get 0 results:
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
PREFIX text: <http://jena.apache.org/text#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix myprefix: <http://www.example.org/some/path/myprefix#>
SELECT ?s ?sci_name
{ ?s text:query (myprefix:foo '123test' 10) ;
myprefix:foo ?sci_name
}
Am I missing something obvious here? I see no warnings or errors on the Fuseki server logs, even with the verbose and debug flags set. I can perform a regular SPARQL query to get these same results, but it's (understandably) quite slow:
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
PREFIX text: <http://jena.apache.org/text#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix myprefix: <http://www.example.org/some/path/myprefix#>
SELECT ?s
{ ?s myprefix:foo ?o .
FILTER regex(str(?o), "123test", "i")
}
Any help with this would be appreciated, as I'm new to Fuseki/Jena and I'm hitting a dead end.