how to query by vertex id in Datastax DSE 5.0 Graph in a concise way?

狂风中的少年 提交于 2019-12-06 06:30:59

Actually I found it:

ids can be written in this String form: "vertexLabel:community_id:member_id"

So for the example above id="User:1488246528:512":

v = g.V().hasId("User:1488246528:512").next()
v = g.V("User:1488246528:512").next()

returns the specific Vertex

Till now I don't know of a good way how to print concisely the id (as a string) of a Vertex so it can be used in V() or in hasId() .. what I currently do is:

LinkedHashMap id = ((LinkedHashMap)v.id());
String idStr = v.label()+":"+id.get("community_id")+":"+id.get("member_id");

Michail, you can also supply your own ids to help simplify this item. There are trade offs in doing so, but there are also advantages. Please see here for more details - http://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/createCustVertexId.html?hl=custom%2Cid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!