【问题标题】:Jena Full-text search using ElasticSearch problemJena 使用 ElasticSearch 的全文搜索问题
【发布时间】:2020-04-23 06:50:27
【问题描述】:

我在 Jena-Fuseki 有一个 Graph DB,我正在尝试使用 ElasticSearch 集群来索引这个 DB,我正在关注那个链接 https://jena.apache.org/documentation/query/text-query.html,当我运行这个命令时:

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

我收到了这个错误:

org.apache.jena.assembler.exceptions.NoSpecificTypeException: 根文件:/apache-jena-fuseki-3.12.0/run/config.ttl#indexES 没有 最具体的类型,它是 ja:Object 的子类

这是我的 config.ttl

######## Example of a TDB dataset and text index#########################
# The main doc sources are:
#  - https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html
#  - https://jena.apache.org/documentation/assembler/assembler-howto.html
#  - https://jena.apache.org/documentation/assembler/assembler.ttl
# See https://jena.apache.org/documentation/fuseki2/fuseki-layout.html for the destination of this file.
#########################################################################

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

[] rdf:type fuseki:Server ;
   fuseki:services (
     :myservice
   ) .

:myservice rdf:type fuseki:Service ;
    fuseki:name                       "bfpd" ;     # e.g : `s-query --service=http://localhost:3030/myds "select * ..."`
    fuseki:serviceQuery               "query" ;    # SPARQL query service
    fuseki:serviceUpdate              "update" ;   # SPARQL update service
    fuseki:serviceUpload              "upload" ;   # Non-SPARQL upload service
    fuseki:serviceReadWriteGraphStore "data" ;     # SPARQL Graph store protocol (read and write)
    fuseki:dataset                    :text_dataset ;
    .

## ---------------------------------------------------------------

# A TextDataset is a regular dataset with a text index.
:text_dataset rdf:type     text:TextDataset ;
    text:dataset   :mydataset ; # <-- replace `:my_dataset` with the desired URI
    text:index     <#indexES> ;
.

# A TDB dataset used for RDF storage
:mydataset rdf:type      tdb:DatasetTDB ; # <-- replace `:my_dataset` with the desired URI - as above
    tdb:location "DB" ;
    tdb:unionDefaultGraph true ; # Optional
.

# Text index description
<#indexES> a text:TextIndexES ;
    text:serverList "127.0.0.1:9200" ; # A comma-separated list of Host:Port values of the ElasticSearch Cluster nodes.
    text:clusterName "elasticsearch" ; # Name of the ElasticSearch Cluster. If not specified defaults to 'elasticsearch'
    text:shards "1" ;                  # The number of shards for the index. Defaults to 1
    text:replicas "1" ;                # The number of replicas for the index. Defaults to 1
    text:indexName "jena-text" ;       # Name of the Index. defaults to jena-text
    text:entityMap <#entMap> ;
.

# Entity map (see documentation for other options)
<#entMap> a text:EntityMap ;
    text:defaultField     "label" ;
    text:entityField      "uri" ;
    text:uidField         "uid" ;
    text:langField        "lang" ;
    text:graphField       "graph" ;
    text:map (
        [ text:field "label" ; 
          text:predicate skos:prefLabel ]
    ) . ```


Could anyone please help ????
Thanks

【问题讨论】:

  • 耶拿文本弹性搜索代码不是 fuseki-server.jar 的一部分。它使 Fuseki jar 非常大,因为 ElasticSearch 有很多依赖项。找到所有需要的 jars 的最好方法是建立一个依赖 jena-text-es 的 maven/gradle 项目,也

标签: elasticsearch indexing jena fuseki tdb


【解决方案1】:

Jena 文本弹性搜索代码不是 fuseki-server.jar 的一部分。它使 Fuseki jar 变得更大,因为 ElasticSearch 有很多依赖项。为方便起见,您可能希望构建自己的 fuseki-server 版本 - 将其从代码库添加到 POM:

    <!-- Illustration: include the Jena Text ElasticSearch code -->
    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-text-es</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.hdrhistogram</groupId>
          <artifactId>HdrHistogram</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

如果你决定通过重新打包 jar 来构建一个特殊的 fuseki-server,另请参阅: https://jena.apache.org/documentation/notes/jena-repack.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-04
    • 2020-03-10
    • 2011-01-28
    • 2021-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多