我正在使用 Gremlin 遍历 OrientDB,但我不太了解这里的演示代码OrientDB Gremlin Wiki
这是我的代码,这段代码有什么问题?
// create sample node and edge
graph = new OrientGraph("local:C:/temp/graph/db");
Vertex v1 = graph.addVertex(null);
v1.setProperty("name", "A");
Vertex v2 = graph.addVertex(null);
v2.setProperty("name", "B");
Vertex v3 = graph.addVertex(null);
v3.setProperty("name", "C");
graph.addEdge(null, v1, v2, "KNOWS");
graph.addEdge(null, v1, v3, "KNOWS");
OGremlinHelper.global().create();
OCommandGremlin command = new OCommandGremlin("g.v('#8:0').out('KNOWS').aggregate(x).has('name',name)");
Map<String, Object> params = new HashMap<String, Object>();
List agg = new ArrayList();
params.put("x", agg);
params.put("name", "B");
Vertex vertex = graph.getRawGraph().command(command).execute(params);
System.out.println(vertex);
System.out.println(agg);
我可以得到脚本的最终结果,但为什么我不能得到“聚合”结果?我怎么才能得到它?
我真的很陌生。提前致谢!