gpt4 book ai didi

elasticsearch - Jena使用ElasticSearch进行全文搜索

转载 作者:行者123 更新时间:2023-12-02 22:18:09 25 4
gpt4 key购买 nike

我在Jena-Fuseki中有一个Graph数据库,并且我正在尝试使用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: the root file:/apache-jena-fuseki-3.12.0/run/config.ttl#indexES has no most specific type that is a subclass of 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

最佳答案

耶拿(Jena)文本 flex 搜索代码不属于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

关于elasticsearch - Jena使用ElasticSearch进行全文搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59600043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com