i have loaded the below mailer.csv file to neo4j using the below command and am able to see all the 10 nodes .
CSV:
SENDER|RECEIVER|SENDDATE
Chris|Dean|2016-01-03
Brian|Chris|2016-01-02
Mark|Noah|2016-01-09
George|Henry|2016-01-05
Albert|Brian|2016-01-01
Thomas|Sean|2016-01-07
Sean|Mark|2016-01-08
Edgar|George|2016-01-04
Noah|Olivia|2016-01-10
Henry|Thomas|2016-01-06
Command:
USING PERIODIC COMMIT 10000
LOAD CSV WITH HEADERS FROM "file:///C:\\Users\\Abacus\\mailer.csv" AS row
FIELDTERMINATOR '|'
CREATE (:Mailer {Sender: row.SENDER, Receiver: row.RECEIVER,Senddate:row.SENDDATE});
//select all nodes
MATCH (n:Mailer)
RETURN n;
//count of nodes
MATCH (n:Mailer)
RETURN count(*)
am trying to create the below relationship between senders and receivers to see the trail of mails
//create relationship
MATCH (n:Mailer)
CREATE (Sender)-[r:SENT_TO]->(Receiver);
But am unable to see the graphs in the below manner. Could you please help
send to send to send to
Albert------------Brian---------Chris-------------Dean
send to send to send to send to send to send to send to
Edgar-------------George-------Henry--------------Thomas-----------Sean--------Mark-------Noah----------Olivia
Something like this should work. The sender and receiver are both turned into Person
nodes, and each person's node is created just once.
MATCH (n:Mailer)
MERGE (p1:Person {name: n.Sender})
MERGE (p2:Person {name: n.Receiver})
CREATE (p1)-[r:SENT_TO {date:n.Senddate}]->(p2);
RETURN p1, r, p2;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.