Sparql 带文本索引的命令行tdbquery

Sparql 带文本索引的命令行tdbquery,sparql,jena,apache-jena,tdb,Sparql,Jena,Apache Jena,Tdb,我试图通过命令行与Jena一起运行文本搜索查询 tdbquery --desc textsearch.ttl --query search.rq 查询返回空结果,并显示以下消息: 17:23:46 WARN TextQueryPF :: Failed to find the text index : tried context and as a text-enabled dataset 17:23:46 WARN TextQueryPF :

我试图通过命令行与Jena一起运行文本搜索查询

tdbquery  --desc textsearch.ttl  --query search.rq  
查询返回空结果,并显示以下消息:

17:23:46 WARN  TextQueryPF          :: Failed to find the text index :    tried context and as a text-enabled dataset
17:23:46 WARN  TextQueryPF          :: No text index - no text search performed
我的汇编程序文件是:

    @prefix :        <http://localhost/jena_example/#> .
  @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#> .

  ## Example of a TDB dataset and text index
  ## Initialize TDB
  [] ja:loadClass "org.apache.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 "DB2" ;
    tdb:unionDefaultGraph true ; # Optional
    .

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

  # Mapping in the index
  # URI stored in field "uri"
  # rdfs:label is mapped to field "text"
  <#entMap> a text:EntityMap ;
    text:entityField      "uri" ;
    text:defaultField     "text" ;
    text:map (
         [ text:field "text" ; text:predicate rdfs:label ]
         ) .
我的问题是:

  PREFIX text: <http://jena.apache.org/text#>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

  SELECT ?s
  { ?s text:query 'London' ; 
       rdfs:label ?label 
  }

我想知道我是否错过了任何配置,或者此查询只能在fuseki内部完成。

首先,您可以在fuseki外部执行文本搜索。您从中获取代码的示例演示了如何使用Java中的纯Jena数据集实现这一点

第二,建议如下:

SELECT (count(*) AS ?C) { ?x text:query .... }

为了在运行真正的查询之前触摸索引。

首先,您可以在Fuseki之外进行文本搜索。您从中获取代码的示例演示了如何使用Java中的纯Jena数据集实现这一点

第二,建议如下:

SELECT (count(*) AS ?C) { ?x text:query .... }

以便在运行真正的查询之前接触索引。

为什么不在Apache Jena邮件列表上寻求帮助?为什么不在Apache Jena邮件列表上寻求帮助?