0

実行時にリレーションを更新するには助けが必要です。

私はこのユースケースを持っています:

次のコレクションでグラフを作成しました: - A (VertexCollection) - B (VertexCollection) - E (EdgeCollection) との関係 (A -> B)

runtme では、Foxx アプリを使用して、新しいコレクション (VertexCollection C) を作成する必要があり、EdgeCollection を次の関係 (A -> [B,C]) で更新する必要があります。

実行時にリレーションを更新する方法はありますか?

よろしくお願いします、ピーター

4

2 に答える 2

2

ArangoDB マニュアルの「実行時にグラフ定義を変更する」セクションに、実行時にエッジ定義を変更する次の方法が示されています。

新しいエッジ定義を既存のグラフに追加:

/* load graph module */
var graph_module = require("org/arangodb/general-graph");

/* load existing graph by name */
var graph = graph_module._graph("myGraph");

/* add a relation for edge collection myEC2, with vertices 
   between collections myVC1 and myVC3 */
var defs = graph_module._relation("myEC2", ["myVC1"], ["myVC3"]);

/* update the existing graph's definition */
graph._extendEdgeDefinitions(defs);

既存のグラフの既存のエッジ定義を変更する:

/* load graph module */
var graph_module = require("org/arangodb/general-graph");

/* load existing graph by name */
var graph = graph_module._graph("myGraph");

/* update the relation for edge collection myEC2, with vertices 
   between collections myVC23 and [ myVC42, myVC99 ] */
var defs = graph_module._relation("myEC2", ["myVC23"], ["myVC42", "myVC99"]);

/* update the existing graph's definition */
graph._editEdgeDefinitions(defs);
于 2016-01-04T18:55:06.263 に答える