0
我知道在圖形DB中,插入後創建關係,而不是字段或字段關係,它們是記錄關係的記錄。如果我的理解是正確的,那麼當我從CSV文件中導入一百萬條記錄並需要將它們與另一個表中的記錄關聯時,我需要做些什麼?OrientDB - 如何在導入的數據上創建邊緣
在插入之前,在設計時不可能關係(邊緣),以便每當插入記錄時,它在那裏都有關係?
我的數據庫詳細如下。
create class Country extends V
create class Immigrant extends V
create class comesFrom extends E
create property Country.c_id integer
create property Country.c_name String
create property Immigrant.i_id integer
create property Immigrant.i_name String
create property Immigrant.i_country Integer
如果我手動創建邊緣,它將是這樣的。
insert into Country(c_id, c_name) values (1, 'USA')
insert into Country(c_id, c_name) values (2, 'UK')
insert into Country(c_id, c_name) values (3,'PAK')
insert into Immigrant(i_id, i_name,i_country) values (1, 'John',1)
insert into Immigrant(i_id, i_name,i_country) values (2, 'Graham',2)
insert into Immigrant(i_id, i_name,i_country) values (3, 'Ali',3)
create edge comesFrom from (select from Immigrant where i_country = 1) to (select from Country where c_id = 1)
create edge comesFrom from (select from Immigrant where i_country = 2) to (select from Country where c_id = 2)
create edge comesFrom from (select from Immigrant where i_country = 3) to (select from Country where c_id = 3)
謝謝,但問題是如何在導入時創建邊緣。 – phpMax
告訴我更多關於要導入的文件格式。 – Lvca
我有一個包含以下字段的CSV文件。 [ID,姓名,COUNTRY_ID。我在OrientDB有一個名爲Immigrant的類。 [i_id,i_name,i_country]。然後我用另外一個名字爲Country的課程,內容如下: [C_ID,c_name]。與此相關,移民類中的i_country與Country類中的c_id有關。所以現在我想要做的是,當我導入CSV文件時,其數據應該在Immigrant類中,但同時,應該在i_country和c_id之間建立關係。我也更新了我的問題來描述DB結構。 – phpMax