【发布时间】:2015-05-13 10:29:46
【问题描述】:
嗨,我对 gremlin 有点陌生,并试图通过查找两个节点之间的所有路径来解决一些问题。在 gremlin 控制台上的简单查询中,我可以使用此查询来做到这一点:
(Name of the first Node).loop(1){it.loops<100}{true}.has('name', (Name of the second node)).path{it.name}
但是当我试图从 java 方法中获取它时,我遇到了很多问题,比如:
-- 不知道将查询准确放在哪里? -- 什么样的数据结构适合接收行数组。 -- 如何从图中收集第一个节点和第二个节点。
这里我尝试过继续,但没有任何线索:
Graph g = new OrientGraph(AppConstants.GRAPH_LOCATION);
List<String> vertexList = new ArrayList<String>();
try{
for (Vertex v : g.getVertices()) {
String vertexName = v.getProperty("name");
vertexList.add(vertexName);
}
return vertexList;
} catch (final Exception ex) {
throw new AppSystemException(ex);
}finally{
g.shutdown();
谢谢, 萨吉尔
【问题讨论】:
标签: java graph-databases orientdb gremlin tinkerpop