Java 如何在GraphDB全文搜索中创建自定义AnalyzerFactory?
免费使用GraphDB 8.1。 表示我可以通过实现接口com.ontotext.trree.plugin.lucene.AnalyzerFactory,使用luc:analyzer参数为GraphDB全文搜索启用自定义AnalyzerFactory。但是我在任何地方都找不到这个接口。它不在jar图hdb-free-runtime-8.1.0.jar中 我在查看功能矩阵时发现,此功能的连接器Lucene似乎可用于GraphDB的免费版本 com.ontotext.trree.plugin.lucene.AnalyzerFactory接口位于哪个jar中?我需要在我的项目中导入什么来实现这个接口 GraphDB中是否包含使用Lucene其他分析仪的现有分析仪工厂?我对使用法语分析器感兴趣Java 如何在GraphDB全文搜索中创建自定义AnalyzerFactory?,java,lucene,sparql,graphdb,Java,Lucene,Sparql,Graphdb,免费使用GraphDB 8.1。 表示我可以通过实现接口com.ontotext.trree.plugin.lucene.AnalyzerFactory,使用luc:analyzer参数为GraphDB全文搜索启用自定义AnalyzerFactory。但是我在任何地方都找不到这个接口。它不在jar图hdb-free-runtime-8.1.0.jar中 我在查看功能矩阵时发现,此功能的连接器Lucene似乎可用于GraphDB的免费版本 com.ontotext.trree.plugin.luc
谢谢 GraphDB提供了两种不同的基于Lucene的插件 Lucene FTS插件索引RDF分子,正确的文档链接是: Lucene Connector使用诸如?subject propertyPath?object to id | fild value之类的配置序列在RDF和Lucene文档模型之间执行在线同步。正确的文档链接是: 我鼓励你使用Lucene连接器,除非你没有RDF分子的特殊情况。下面是一个简单的示例,说明如何使用French analyzer配置连接器,并为urn:MyClass类型的资源的rdfs:label谓词的所有值编制索引。选择存储库并从SPARQL查询视图中执行:
PREFIX :<http://www.ontotext.com/connectors/lucene#>
PREFIX inst:<http://www.ontotext.com/connectors/lucene/instance#>
INSERT DATA {
inst:labelFR-copy :createConnector '''
{
"fields": [
{
"indexed": true,
"stored": true,
"analyzed": true,
"multivalued": true,
"fieldName": "label",
"propertyChain": [
"http://www.w3.org/2000/01/rdf-schema#label"
],
"facet": true
}
],
"types": [
"urn:MyClass"
],
"stripMarkup": false,
"analyzer": "org.apache.lucene.analysis.fr.FrenchAnalyzer"
}
''' .
}
然后从导入>文本区域手动添加一些样本测试数据:
<urn:instance:test> <http://www.w3.org/2000/01/rdf-schema#label> "C'est une example".
<urn:instance:test> a <urn:MyClass>.
提交事务后,连接器将更新Lucene索引。现在,您可以运行如下搜索查询:
PREFIX : <http://www.ontotext.com/connectors/lucene#>
PREFIX inst: <http://www.ontotext.com/connectors/lucene/instance#>
SELECT ?entity ?snippetField ?snippetText {
?search a inst:labelFR ;
:query "label:*" ;
:entities ?entity .
?entity :snippets _:s .
_:s :snippetField ?snippetField ;
:snippetText ?snippetText .
}
要创建自定义分析器,请按照文档中的说明并扩展org.apache.lucene.analysis.analyzer类。将自定义analyzer JAR放在lib/plugins/lucene connector/path中。您应该使用Maven存储库,还是我错了?我不确定这就是它。要求我提供登录名/密码,而文档中说这些工件应该在没有凭据的情况下可用。