csv导入数据

1.关闭Neo4j服务器进程

2.删除graph.db数据库文件  /data/databases/  rm -rf graph.db

3.重新启动Neo4j服务器

4.数据导入import

5.window界面输入neo4j语言

 

 

10-100-22-94:/data/soft/neo4j-community-not/import

student.csv:

organization.csv:

 

relation.csv:

 

#导入student表 

LOAD CSV WITH HEADERS FROM "file:///student.csv" as line

with line where line.id is not null
MERGE (s:Student{id:toInteger(line.id),name:line.name})

#导入organization表
LOAD CSV WITH HEADERS FROM "file:///organization.csv" as line
MERGE (s:Organization{id:toInteger(line.id),name:line.name})

 

#导入关系表relation

LOAD CSV WITH HEADERS FROM "file:///relation.csv" as line
match (from:Student{id:toInteger(line.mid)}),(to:Organization{id:toInteger(line.gid)})
merge(from)-[r:friends{start_id:toInteger(line.mid),end_id:toInteger(line.gid),re:toString(line.links)}]->(to)

 

 

 

posted on 2019-05-31 18:12  happygril3  阅读(461)  评论(0)    收藏  举报

导航