2012-06-07 50 views
3

例如,在一個OrientDB圖中,兩個簡單的頂點:OrientDB GraphED - 兩個插入邊之間的SQL(選擇頂點RID)s?或非常大的進口替代辦法

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)的任何建議?

謝謝!

回答

2

SQLCreateEdge可能是你想要做什麼:

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

然而,對於非常大的導入連接的,我建議SQLCreateLink。建議這個寶石here

0

散裝刃鑲刀是可能的,SQL Bath

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