OrientDB GraphED - SQL 在两个(选择顶点 RID)之间插入边?或者用于非常大的进口的替代方法

2024-01-15

例如,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).

有没有办法通过只知道它们的“标签”而不是它们的“骑行”来在这两个顶点之间创建边?

例如(不起作用):

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).

创建的边位于null and null。没有骰子。

我希望为此使用 OrientDB SQL,因为我有大量的连接导入,并且 SQL 方法似乎更快。

但是,如果这是不可能的,关于批量导入边(大约 2M)的替代方案有什么建议吗?


SQL创建边缘 http://code.google.com/p/orient/wiki/SQLCreateEdge可能是你想要做的:

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

但是,对于大量的连接导入,我建议SQL创建链接 http://code.google.com/p/orient/wiki/SQLCreateLink。建议使用此宝石here http://code.google.com/p/orient/wiki/ImportFromRDBMS.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

OrientDB GraphED - SQL 在两个(选择顶点 RID)之间插入边?或者用于非常大的进口的替代方法 的相关文章

随机推荐