1neo4j三種數(shù)據(jù)導(dǎo)入工作
- create 語(yǔ)句
- load CSV 語(yǔ)句
- neo4j import 批量導(dǎo)入
對(duì)于大數(shù)據(jù)集的導(dǎo)入首選neo4j import恳邀,響應(yīng)快
2 neo4j import
導(dǎo)入數(shù)據(jù)之前先清空已有的graph.db文件夾內(nèi)容
2.1 數(shù)據(jù)集(CSV)準(zhǔn)備
node(節(jié)點(diǎn))數(shù)據(jù)集準(zhǔn)備
- header格式 "node_id:ID","name",":LABEL"
personId:ID,name,:LABEL
keanu,"Keanu Reeves",Actor
laurence,"Laurence Fishburne",Actor
carrieanne,"Carrie-Anne Moss",Actor
laurence,"Laurence Harvey",Actor
- ID列唯一取值(不重復(fù))
- LABEL屬于標(biāo)簽于样,代表這類(lèi)節(jié)點(diǎn)的類(lèi)別
edge(邊格式) - header格式":START_ID","name",":END_ID",":TYPE"
"4565904","homepage","0","Predicate"
"4654000","homepage","0","Predicate"
"2254843","homepage","0","Predicate"
"2346995","homepage","0","Predicate"
"3535680","homepage","0","Predicate"
"2090446","homepage","0","Predicate"
2.2 數(shù)據(jù)導(dǎo)入
- 節(jié)點(diǎn)文件applyer.csv address.csv
- 邊文件relation.csv
進(jìn)入neo4j的安裝文件bin文件夾(終端進(jìn)入),輸入如下命令
.\bin> neo4j-admin import --database graph.db --id-type string --nodes:applyer C:\Users\DELL\Desktop\neo4j\applyer.csv --nodes:address C:\Users\DELL\Desktop\neo4j\address.csv --relationships C:\Users\DELL\Desktop\neo4j\relation.csv --ignore-duplicate-nodes
3 常見(jiàn)錯(cuò)誤
- 節(jié)點(diǎn)文件存在重復(fù)
- 文件header不規(guī)范
- 數(shù)據(jù)中存在未知變量(CSV格式對(duì)長(zhǎng)類(lèi)型整數(shù)會(huì)進(jìn)行科學(xué)計(jì)數(shù)修己,造成錯(cuò)誤)
- 數(shù)據(jù)大小超過(guò)內(nèi)存
- 其他錯(cuò)誤(見(jiàn)終端log尾部報(bào)錯(cuò))
#社區(qū)版Neo4j免費(fèi)資源大小
Available resources:
Total machine memory: 15.89 GB
Free machine memory: 6.72 GB
Max heap memory : 3.53 GB
Processors: 4
Configured max memory: 11.12 GB
High-IO: false
4 查看效果
- neo4j.bat console 打開(kāi)圖數(shù)據(jù)庫(kù)的前端可視化界面
- 打開(kāi)本地?cái)?shù)據(jù)庫(kù),可以看到是否成功導(dǎo)入數(shù)據(jù)集