1
我想了解如何按照LearningNeo4j書的「導入使用加載CSV」一章中的說明,在Neo4j中導入csv文件。該代碼我執行I S如下:Neo4j加載csv文件
load csv with headers from
"file:C:/wamp/www/fantapappa/nodes.csv"
as nodes
create (n {id: nodes.Node, name: nodes.Name, type: nodes.Label})
return n
load csv with headers from
"file:C:/wamp/www/fantapappa/rels.csv"
as rels
match (from {id:rels.From}), (to {id: rels.To})
create from-[:REL {type: rels.'Relationship'}]->to
return from, to
match (m {type:"Male"}), (f {type:"Female"})
set m:Male, f:Female
return m,f
到目前爲止一切正常,但是當我試圖建立這樣的關係:
match (n)-[r1 {type:"MOTHER_OF"}]->(m), (s)-[r2 {type:"FATHER_OF"}]->(t)
create n-[:MOTHER_OF]->m, s-[:FATHER_OF]->t
return *;
match()-[r:REL]-() delete r;
我無法比擬的東西。我只是簡單地複製並過去了本書的代碼,但我無法建立關係。有人能幫我嗎?
P.S. CSV文件時:
nodes.csv
Node,Name,Label
1,Amada Emory,Female
2,Rana Seely,Female
3,Detra Thatcher,Female
4,Melda Reza,Female
5,Shana Willems,Female
6,Sharonda Peele,Female
7,Dagny Agee,Female
8,Tisa Woodman,Female
9,Shelba Mutcheler,Female
10,Anderson Spagnola,Male
11,Pamela Forward,Female
12,Melva Fairchild,Female
13,Antione Selman,Male
14,Carmela Cali,Female
15,Fairy Daughtery,Female
16,Stefany Mcamis,Female
17,Kermit Meaney,Male
18,Williemae Dossantos,Female
19,Marth Sparling,Female
20,Jarvis Noland,Male
rels.csv
From,Name,Relationship ,To,Name
1,Amada Emoroy,MOTHER_OF,11,Pamala Forward
1,Amada Emoroy,MOTHER_OF,12,Melva Fairchild
1,Amada Emoroy,MOTHER_OF,13,Antione Selman
2,Rana Seely,MOTHER_OF,14,Carmelia Cali
2,Rana Seely,MOTHER_OF,15,Fairy Daughtery
2,Rana Seely,MOTHER_OF,16,Stefany Mcamis
3,Detra Thatcher,MOTHER_OF,17,Kermit Meaney
3,Detra Thatcher,MOTHER_OF,18,Williemae Dossantos
3,Detra Thatcher,MOTHER_OF,19,Marth Sparling
10,Anderson Spagnola,FATHER_OF,20,Jarvis Noland
14,Carmelia Cali,MOTHER_OF,1,Amada Emory
11,Pamela Forward,MOTHER_OF,2,Rana Seely
11,Pamela Forward,MOTHER_OF,3,Detra Thatcher
12,Melva Fairchild,MOTHER_OF,4,Melda Reza
12,Melva Fairchild,MOTHER_OF,5,Shana Willems
12,Melva Fairchild,MOTHER_OF,6,Sharonda Peele
17,Kermit Meaney,FATHER_OF,7,Dagny Agee
13,Antione Selman,MOTHER_OF,8,Tisa Woodman
13,Antione Selman,MOTHER_OF,9,Shelba Mutchler
20,Jarvis Noland,FATHER_OF,1,Amada Emory
編輯剛剛複製的代碼
我很抱歉,但你的鏈接,我不能很明白wath你dooing 。
我刪除了csv文件和代碼中的空間,但commad似乎不工作...我有一個奇怪的灰色圖形背景。 –
我編輯了我的答案 –
複製並粘貼您的代碼我得到相同的灰色圖!我要瘋了!! :D –