(使用GraphDB 8.1免费)。http://graphdb.ontotext.com/documentation/free/full-text-search.html说,通过嵌入接口com.ontotext.trree.plugin.lucene.AnalyzerFactory,我可以使用luc:analyzer param为GraphDB全文搜索启用自定义的com.ontotext.trree.plugin.lucene.AnalyzerFactory。然而,我在任何地方都找不到这个界面。它不在jar图形数据库-空闲运行时-8.1.0.jar中。
我在http://ontotext.com/products/graphdb/editions/#feature-comparison-table上查看了功能矩阵,似乎这个特性‘Connectors’是免费版的GraphDB。
com.ontotext.trree.plugin.lucene.AnalyzerFactory接口位于哪个jar中?在我的项目中需要导入什么来实现这个接口?
是否有预先存在的AnalyzerFactories包括在GraphDB中使用Lucene其他分析器?(我对使用FrenchAnalyzer感兴趣)。
谢谢!
发布于 2017-04-24 07:41:16
GraphDB提供了两个不同的基于Lucene的插件。
我鼓励你使用Lucene连接器,除非你没有RDF分子的特例。下面是一个简单的示例,说明如何使用法语分析器配置连接器,并为rdfs:label谓词的urn:MyClass类型的资源索引所有值。选择一个存储库,并从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"
}
''' .
}然后从Import > Text区域手动添加一些示例测试数据:
<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类。将自定义分析器JAR放在lib/plugins/lucene-connector/路径中。
https://stackoverflow.com/questions/43517064
复制相似问题