Fuseki 索引 (Lucene) 文本搜索 returns 无结果

Fuseki indexed (Lucene) text search returns no results

我有一个非常大的 ontology RDF 文件(将近 4M 个实例),我目前正在通过 Fuseki v2.0.0 进行流式传输。我的汇编程序文件如下所示:

@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 ]
         ) .

为了在合理的响应时间内对特定元素执行文本搜索,我使用文本索引导入了 RDF 文件:

$ java -cp $FUSEKI_HOME/fuseki-server.jar tdb.tdbloader --tdb=run/text-config.ttl ontologies.rdf 

...和

$ java -cp $FUSEKI_HOME/fuseki-server.jar jena.textindexer --desc=run/text-config.ttl 

...然后 运行将 Fuseki 服务器设置为

./fuseki-server -v --debug -loc=DB /dataset

导入过程中没有错误,我可以运行针对这个新数据集进行各种 SPARQL 查询,没有任何问题。但是当我尝试执行全文查询时,我得到 0 个结果:

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 
}

我是不是遗漏了什么明显的东西?我在 Fuseki 服务器日志上看不到任何警告或错误,即使设置了详细和调试标志。我可以执行常规 SPARQL 查询来获得这些相同的结果,但它(可以理解)相当慢:

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")
}

如有任何帮助,我们将不胜感激,因为我是 Fuseki/Jena 的新手,而且我已经走到了死胡同。

如果您运行服务器

./fuseki-server -v --debug -loc=DB /dataset

那么它没有使用你的配置文件。尝试:

./fuseki-server --desc text-config.ttl

或者最好有一个包含服务和数据集描述的 Fuseki 配置文件(参见示例)和 运行:

./fuseki-server --confg config.ttl