簡體   English   中英

OrientDB GraphED - 兩個(選擇頂點RID)之間的SQL插入邊緣? 或者非常大的導入的替代方法

[英]OrientDB GraphED - SQL insert edge between two (select vertex RID)s? Or alternative approach for very large import

例如,OrientDB圖中的兩個簡單頂點:

orientdb> CREATE DATABASE local:/databases/test admin admin local graph;       
Creating database [local:/databases/test] using the storage type [local]...
Database created successfully.
Current database is: local:/graph1/databases/test
orientdb> INSERT INTO V (label,in,out) VALUES ('vertexOne',[],[]);                                                                                                                 
Inserted record 'V#6:0{label:vertexOne,in:[0],out:[0]} v0' in 0.001000 sec(s).
orientdb> INSERT INTO V (label,in,out) VALUES ('vertexTwo',[],[]);
Inserted record 'V#6:1{label:vertexTwo,in:[0],out:[0]} v0' in 0.000000 sec(s).

有沒有辦法在這兩個頂點之間創建邊緣,只知道它們的'標簽',而不是它們的'RID'?

例如(不起作用):

orientdb> INSERT INTO E (label, in, out) VALUES ('is_connected_to', (SELECT @rid FROM V WHERE label = 'vertexOne'), (SELECT @rid FROM V WHERE label = 'vertexTwo'));
Inserted record 'E#7:0{label:is_connected_to,in:null,out:null} v0' in 0.001000 sec(s).

我試過'FLATTEN'作為潛在的解決方法。 沒運氣:

orientdb> INSERT INTO E (label, in, out) VALUES ('is_connected_to', (SELECT FLATTEN(@rid) FROM V WHERE label = 'vertexOne'), (SELECT FLATTEN(@rid) FROM V WHERE label = 'vertexTwo'));
Inserted record 'E#7:1{label:is_connected_to,in:null,out:null} v0' in 0.001000 sec(s).

創建的邊緣介於nullnull之間。 沒有骰子。

我希望使用OrientDB SQL,因為我有很大的連接導入,SQL方法似乎更快。

但是,如果這不可行,那么有關批量導入邊緣(大約2M)的替代方案的任何建議?

SQLCreateEdge可能就是你想要做的:

create edge from
(select from V where label = 'vertexOne')
to
(select from V where label = 'vertexTwo')
set label = 'is_connected_to'

但是,對於非常大的連接導入,我建議使用SQLCreateLink 這個寶石建議在這里

批量邊緣插入可以作為SQL Bath

begin;
  CREATE EDGE E FROM #34:3349  TO #32:3349;
  CREATE EDGE E FROM #41:10971 TO #33:3348;
commit retry 100;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM