在 SIREN 中, 是否可以使用 SolrDocument 中的 N- Tuples 值( 按名称) 工作? 我想在不对响应字符串进行正则表达的情况下分析查询结果 。
类似 :
SolrDocument.getField("ntriple","name"); // get "Jim Maple" value for <http:/example.org/schema/name> predicate
更多详情:
//N-Tuple from the IndexQueryNTriple.java file
private final String[] doc1 =
{ "http:/example.org/person/jim",
"<http:/example.org/person/jim> <http:/example.org/schema/type> <http:/example.org
/schema/Person> .
" +
"<http:/example.org/person/jim> <http:/example.org/schema/name> "Jim Maple" .
"
};
final SolrInputDocument document1 = new SolrInputDocument();
document1.addField("url", doc1[0]);
document1.addField("ntriple", doc1[1]);
add(document1);
final SolrQuery query2 = new SolrQuery();
query2.setQueryType("siren");
query2.set(SirenParams.NQ, "* <name> john AND gartner "); // ntriple query
final QueryResponse response2 = server.query(query2);
for (SolrDocument d : response2.getResults()) {
///?????? want to get name value from the long N-Triple string with ALL values
d.getField("ntriple","name"); // get "Jim Maple" value
}