SIREn N-Tuples结果

时间:2012-05-26 13:55:01

标签: solr lucene n-triples siren

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> .\n" + 

  "<http:/example.org/person/jim> <http:/example.org/schema/name> \"Jim Maple\" .\n" 
 };

 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

}

2 个答案:

答案 0 :(得分:1)

我找到了NxParser库来解析所需的N-Tuples。

答案 1 :(得分:0)

不幸的是,NxParser对它可以解析的三元组的格式有一些限制