Skip to content
Kazunobu Yamaguchi edited this page Aug 16, 2014 · 9 revisions

このコマンドはデータベースからリレーションを削除します. このコマンドはグラフに対して使用します. "Delete edge" は"in" and "out" verticesの両方の頂点の相互参照している全てを削除することに注意してください.

構文

    DELETE EDGE <rid>|FROM <rid>|TO <rid>|[<class>] [WHERE <conditions>]> [LIMIT <MaxRecords>]

WHERE 句は他のSQLと同じものが使用できます.

更新履歴と互換性

  • 1.1: 最初のバージョン
  • starting from v.1.4 the command uses the Blueprints API under the hood, so if you're working in Java using the OGraphDatabase API you could experience in some difference how edges are managed. To force the command to work with the "old" API change the GraphDB settings described in Graph backward compatibility

二つのノードの間で 日付のプロパティをもつリレーションを削除:

    DELETE EDGE from #11:101 TO #11:117 Where date >= "2012-01-15"

リレーションのクラスでフィルタリングしたリレーションを削除:

    DELETE EDGE FROM #11:101 TO #11:117 WHERE @class = 'owns' and comment like "regex of forbidden words"

これは DELETE EDGE WHERE @class = 'owns' and date < "2011-11" より高速な代替方法です:

    DELETE EDGE Owns WHERE date < "2011-11"

in.price が 'to vertex' のリレーションの条件となっているリレーションを削除

    DELETE EDGE Owns WHERE date < "2011-11" and in.price >= 202.43      

#Java によるリレーションの削除:

User が company をフォローする場合はUser と companyの間にfollowCompany と CompanyFollowedByクラスを作成します

node1 is User node,
node2 is company node

OGraphDatabase rawGraph = orientGraph.getRawGraph();
String[] arg={"followCompany,"CompanyFollowedBy"};
Set<OIdentifiable> edges=rawGraph.getEdgesBetweenVertexes(node1, node2,null,arg);
for (OIdentifiable oIdentifiable : edges) {
	**rawGraph.removeEdge(oIdentifiable);
}
Clone this wiki locally