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修改密码然后查看结果: