0
私は様々な農場の樹木に由来するリンゴがあるとしましょう。木はリンゴを、農場は木を持っています。私はリンゴのリストも必要とします。これらのリンゴには、彼らが出た農場への参照が含まれています。Gremlin:トラバーサルパスで見つかった2つのオブジェクトの選択された属性をマージするには
g = new TinkerGraph();
// apples
a1 = g.addVertex("a1");
a1.setProperty("type", "apple");
a2 = g.addVertex("a2");
a2.setProperty("type", "apple");
a3 = g.addVertex("a3");
a3.setProperty("type", "apple");
// trees
t1 = g.addVertex("t1");
t1.setProperty("type", "tree");
t2 = g.addVertex("t2");
t2.setProperty("type", "tree");
// farms
f1 = g.addVertex("f1");
f1.setProperty("type", "farm");
f1.setProperty("uid", "f1");
f2 = g.addVertex("f2");
f2.setProperty("type", "farm");
f2.setProperty("uid", "f2");
g.addEdge(t1, a1, "bears");
g.addEdge(t1, a2, "bears");
g.addEdge(t2, a3, "bears");
g.addEdge(f1, t1, "has");
g.addEdge(f2, t2, "has");
私はトラバースしてグラフに各リンゴを報告し、その中にファームIDも含めます。私が手に出力され
g.V.has("type", "apple").copySplit(_().in("bears").in("has").map("uid"),
_().map()).fairMerge
:私はこのような何かを試してみました
==>{uid=f1}
==>{type=apple}
==>{uid=f1}
==>{type=apple}
==>{uid=f2}
==>{type=apple}
私は何をしたいことは次のとおりです。
TinkerPop 2.xのを想定し==>{uid=f1, type=apple}
==>{uid=f1, type=apple}
==>{uid=f2, type=apple}