在the instructions之后,我设置了一个涵盖多个(文字 - )谓词的索引:
PREFIX luc: <http://www.ontotext.com/owlim/lucene#>
INSERT DATA {
luc:index luc:setParam "uris" .
luc:include luc:setParam "literals" .
luc:moleculeSize luc:setParam "1" .
luc:includePredicates luc:setParam "http://purl.org/dc/terms/title http://www.w3.org/2000/01/rdf-schema#label http://www.w3.org/2004/02/skos/core#prefLabel http://www.w3.org/2004/02/skos/core#altLabel" .
}
和
PREFIX luc: <http://www.ontotext.com/owlim/lucene#>
INSERT DATA {
luc:${Cfg.literalIndex} luc:createIndex "true" .
}
这部分似乎工作得很好 . 我现在的问题是, is there some way to get the matched predicate or literal in my SPARQL query ?
所以假设以下数据:
:exA rdfs:label 'label' ;
dct:title 'title' .
我想做这样的事情
SELECT *
WHERE {
?needle luc:labelIndex "title" ;
luc:predicate ?predicate ;
?predicate ?label .
}
如果像这样的东西存在,这可以给我实际匹配的谓词和匹配值 . 但是,我甚至不确定Lucene索引谓词,这是启用这样一个函数所必需的 .
1 回答
使用传统的FTS Lucene插件无法有效地执行此操作 . 但是,Lucene Connectors很容易支持您的用例 . 以下是包含一些模拟数据的示例案例:
Sample data
注意:连接器索引单个
rdf:type
的数据 . 在你的例子中,我相信你应该有skos:Concept
.Create Lucene Connector
连接器将所选类型的每个属性或属性链索引到单独的Lucene字段中 .
Return the matching fields and snippet
预测中的位置:
?entities是属性或属性链匹配的RDF资源,即
?snippetField是与全文查询匹配的字段名称
?snippetText是匹配的代码段值