Neo4j学习4:数据导入

数据导入

csv

官方文档: https://neo4j.com/docs/cypher-manual/current/clauses/load-csv/


支持云导入、以及固定位置文件目录的离线导入

前缀准备

数据准备: 自行使用国内各大厂商的免费AI帮你生成一批测试数据


提示词: 给一份 neo4j的 西游记 人物 关系 csv格式出来

西游记.csv

csv 复制代码
name1,name2,roleEn,roleName
金蝉子,唐僧,past life,前世
孙悟空,唐僧,apprentice,徒弟
猪八戒,唐僧,apprentice,徒弟
沙僧,唐僧,apprentice,徒弟
白龙马,唐僧,apprentice,徒弟
陈光蕊,唐僧,father,父亲
殷温娇,唐僧,mother,母亲
法明和尚,唐僧,master,师父
李世民,唐僧,elder sworn brother,义兄
殷开山,殷温娇,father,父亲
唐僧,孙悟空,master,师傅
菩提老祖,孙悟空,master,师傅
猪八戒,孙悟空,younger brother with the same master,师弟
沙僧,孙悟空,younger brother with the same master,师弟
白龙马,孙悟空,younger brother with the same master,师弟
镇元子,孙悟空,elder sworn brother,义兄
牛魔王,孙悟空,elder sworn brother,义兄
蛟魔王,孙悟空,elder sworn brother,义兄
鹏魔王,孙悟空,elder sworn brother,义兄
狮驼王,孙悟空,elder sworn brother,义兄
猕猴王,孙悟空,elder sworn brother,义兄
禺狨王,孙悟空,elder sworn brother,义兄
孙悟空,猪八戒,elder brother with the same master,师兄
沙僧,猪八戒,younger brother with the same master,师弟
白龙马,猪八戒,younger brother with the same master,师弟
唐僧,猪八戒,master,师傅
天蓬元帅,猪八戒,past life,前世
猪八戒,卵二姐,husband,夫
猪八戒,高翠兰,husband,夫
孙悟空,沙僧,elder brother with the same master,师兄
白龙马,沙僧,younger brother with the same master,师弟
唐僧,沙僧,master,师傅
卷帘大将,沙僧,past life,前世
西海龙王,白龙马,father,父亲
待导入文件存放位置

文件: 将上述待导入存放在 Neo4j安装目录/import 下面

执行命令Neo4j开始加载外部文件
java 复制代码
LOAD CSV  WITH HEADERS FROM 'file:///西游记.csv' AS row
MERGE (a:XyPerson {name: row.name1})
MERGE (b:XyPerson {name: row.name2})
MERGE (a)-[:XyRelate {remark: row.roleName}]->(b);
查看导入结果
java 复制代码
match(n:XyPerson) return n limit 20;
相关推荐
tyqtyq2210 分钟前
HarmonyOS AI 应用开发实战:简历项目经历改写系统
人工智能·学习·华为·生活·harmonyos
bush43 小时前
正点原子imx6ull-uboot,奇怪的问题
linux·学习
念雨思3 小时前
HarmonyOS AI 应用开发实战:短视频选题灵感 —— AI 驱动的内容创作引擎
人工智能·学习·华为·harmonyos·鸿蒙
2601_959383244 小时前
休学干预的“信任难题”,坤和静界·春藤计划怎么尝试破局
学习
tyqtyq226 小时前
HarmonyOS AI 应用开发实战:考研择校分析系统
人工智能·学习·考研·华为·生活·harmonyos
光影6277 小时前
MySQL基础入门
数据库·笔记·sql·学习·mysql·学习方法
海兰7 小时前
【实用程序】网页公开信息智能采集系统详细设计指南
人工智能·学习·自动化·采集信息
MartinYeung57 小时前
[论文学习]AgentDAM:自主Web Agent的隐私泄露评估
学习
光影6278 小时前
MySQL 进阶篇 —— 事务 / 外键 / 索引 / 高级查询
数据库·笔记·sql·学习·mysql
醉城夜风~9 小时前
MyBatis 基础CRUD全套实战学习笔记
笔记·学习·mybatis