Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rdf Fuseki索引(Lucene)文本搜索不返回任何结果_Rdf_Sparql_Jena_Owl_Fuseki - Fatal编程技术网

Rdf Fuseki索引(Lucene)文本搜索不返回任何结果

Rdf Fuseki索引(Lucene)文本搜索不返回任何结果,rdf,sparql,jena,owl,fuseki,Rdf,Sparql,Jena,Owl,Fuseki,我有一个非常大的本体RDF文件(近400万个实例),我目前正在通过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:

我有一个非常大的本体RDF文件(近400万个实例),我目前正在通过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 ]
         ) .
。。。及

$ 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 
}
前缀rdfs:
前缀owl:
前缀文本:
前缀rdf:
前缀myprefix:
选择?s?sci_名称
{s text:query(myprefix:foo'123test'10);
我的前缀:foo?sci_名称
}
我是不是漏掉了什么明显的东西?我在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")
}
前缀rdfs:
前缀owl:
前缀文本:
前缀rdf:
前缀myprefix:
选择
{s myprefix:foo?o。
过滤正则表达式(str(?o),“123test”,“i”)
}

任何帮助都将不胜感激,因为我是Fuseki/Jena的新手,我正走到一条死胡同

如果您使用

./fuseki-server -v --debug -loc=DB /dataset
那么它就不使用您的配置文件了。尝试:

./fuseki-server --desc text-config.ttl
或者最好使用带有服务和数据集描述的Fuseki配置文件(参见示例)并运行:


非常感谢,安迪。我(错误地)假设,由于TDB目录是在汇编文件中指定的,因此它将配置那里所需的一切。我将Fuseki服务合并到这个文件中,并使用它启动服务器,工作起来非常出色。
./fuseki-server --desc text-config.ttl
./fuseki-server --confg config.ttl