Neo4j Admin Import 匯入多個node和relationship
阿新 • • 發佈:2021-07-25
Neo4j Admin Import 匯入多個node和relationship
前提條件
必須是未使用過的或者是重新初始化(刪除data下所有檔案)的Neo4j資料庫
CSV
關係一
a.csv
aId:ID(AID),name,:LABEL
1,xiaoa,A
b.csv
bId:ID(BID),name,:LABEL
1,xiaob,B
a_b.csv
":START_ID(AID)",":END_ID(BID)",:TYPE
1,1,A_B
關係二
actors.csv
personId:ID(Actor-ID),name,:LABEL keanu,"Keanu Reeves",Actor laurence,"Laurence Fishburne",Actor carrieanne,"Carrie-Anne Moss",Actor
movies.csv
movieId:ID(Movie-ID),title,year:int,:LABEL
tt0133093,"The Matrix",1999,Movie
tt0234215,"The Matrix Reloaded",2003,Movie;Sequel
tt0242653,"The Matrix Revolutions",2003,Movie;Sequel
roles.csv
:START_ID(Actor-ID),role,:END_ID(Movie-ID),:TYPE keanu,"Neo",tt0133093,ACTED_IN keanu,"Neo",tt0234215,ACTED_IN keanu,"Neo",tt0242653,ACTED_IN laurence,"Morpheus",tt0133093,ACTED_IN laurence,"Morpheus",tt0234215,ACTED_IN laurence,"Morpheus",tt0242653,ACTED_IN carrieanne,"Trinity",tt0133093,ACTED_IN carrieanne,"Trinity",tt0234215,ACTED_IN carrieanne,"Trinity",tt0242653,ACTED_IN
匯入命令:
./neo4j-admin import --database=neo4j --nodes=csv/movies.csv --nodes=csv/actors.csv --nodes=csv/a.csv --nodes=csv/b.csv --relationships=csv/roles.csv --relationships=csv/a_b.csv
啟動neo4j修改密碼然後檢視結果: