我尝试使用 load CSV with headers 命令将以下节点加载到 Neo4j 中:
id label name
0 Person Dave
1 Person Boris
2 Person Rita
3 Person Daniel
4 Person Papa
5 Person Mama
我将 Excel 表另存为:
CSV UTF-8 (Comma delimited) (*.csv)
文件位置是:
C:\Users\FY197T (2076902)\Documents\Neo4j\default.graphdb\import\nodes.csv
在编辑器中打开看起来像这样:
id;label;name
0;Person;Dave
1;Person;Boris
2;Person;Rita
3;Person;Daniel
4;Person;Papa
5;Person;Mama
要将节点加载到 Neo4j 中,我使用:
load csv with headers from "file:///nodes.csv" as persons create (p1:Person {nodeID:persons.id, label: persons.label, name: persons.name})
但我得到的是:
Added 6 labels, created 6 nodes, completed after 105 ms.
所以有 6 个节点(因为我有 6 行),但它们都没有任何属性
我已经尝试使用不同的分隔符保存文件,或者手动添加引号。后者给出:
there's a field starting with a quote and whereas it ends that quote
there seems to be characters in that field after that ending quote. That
isn't supported. This is what I read: '"id"";"'
PS:我在stackoverflow上阅读了有关此主题的所有其他帖子,但还没有为我解决
编辑
1.
load csv with headers from "file:///nodes.csv" as persons FIELDTERMINATOR ';' return persons.label
给出:
persons.label
(empty)
(empty)
(empty)
(empty)
(empty)
(empty)
2.
load csv with headers from "file:///nodes.csv" as persons FIELDTERMINATOR ';' return persons
给出:
persons
{
"id": "0",
"label": "Person",
"name": "Dave"
}
{
"id": "1",
"label": "Person",
"name": "Boris"
}
an so on....