从indexQuery访问元素,通过titan-server

时间:2015-10-16 12:31:47

标签: titan gremlin

我希望通过titanServer远程执行indexQuery时得到顶点id。怎么能实现这一目标?该文档显示了如何通过gremlin直接执行此操作。

http://s3.thinkaurelius.com/docs/titan/1.0.0/server.html

ManagementSystem mgmt = graph.openManagement();
PropertyKey text = mgmt.makePropertyKey("text").dataType(String.class).make();
mgmt.buildIndex("vertexByText", Vertex.class).addKey(text).buildMixedIndex("search");
mgmt.commit();
// ... Load vertices ...
for (Result<Vertex> result : graph.indexQuery("vertexByText", "v.text:(farm uncle berry)").vertices()) {
   System.out.println(result.getElement() + ": " + result.getScore());
}

我怎么能通过gremlin-server远程执行此操作?

如何迭代这些并获取顶点ID?

gremlin> :> graph.indexQuery("user-description", "v.description:(BSc Hons Zoology. TEFL. Emotional)").vertices()
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@2a11abb7
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@27b5bcae
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@315e9e70
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@4f40c549
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@68ab8305
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@62f11272
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@2799ad42
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@6e3a5e75
==>com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder$ResultImpl@5abd4b1c

0 个答案:

没有答案