Jena使用ElasticSearch问题进行全文搜索

问题描述 投票:0回答:1

我在耶拿-富塞基(Jena-Fuseki)中拥有一个图形数据库,并且我正在尝试使用ElasticSearch集群对该数据库进行索引,我正在跟踪该链接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
elasticsearch indexing jena fuseki tdb
1个回答
0
投票

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>

如果您决定通过重新包装广口瓶来构建特殊的Fusionki服务器,请参见:https://jena.apache.org/documentation/notes/jena-repack.html

© www.soinside.com 2019 - 2024. All rights reserved.