For example, two simple vertices in an OrientDB Graph:
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).
Is there a way to create an edge between these two vertexes by only knowing their 'label's, not their 'RID's?
For example (doesn't work):
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).
I've tried 'FLATTEN' as a potential workaround. No luck:
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).
The edges created are between null
and null
. No dice.
I was hoping to use OrientDB SQL for this since I have a very large import of connections and the SQL approach seems to be faster.
However, if this isn't possible, any suggestions about an alternative for batch importing edges (roughly 2M)?
Thanks!