cancel
Showing results for 
Search instead for 
Did you mean: 

Load csv Files

Novice
Node Link

Hello,
according to 'attack_no',
I want to connect 'from_id' 'to_id'.

2X_8_84ce70abeeebf8a85d2ce3b7c71675bc5089a53a.png

I want connect each other.

But, My Result is..

connect one by one.
what is wrong my query?

this is my query.

LOAD CSV WITH HEADERS FROM 'file:///test.csv' AS attackgraph
MERGE (e:Attack_From_Data {attack_no:attackgraph.attack_no, attack_seq:attackgraph.attack_seq, from_id: attackgraph.from_id, 
from_score:attackgraph.from_score})
MERGE (c:Attack_To_Data {attack_no:attackgraph.attack_no, attack_seq:attackgraph.attack_seq, to_id: attackgraph.to_id, to_score:attackgraph.to_score})
MERGE (e)-[:WORKS_FOR]->(c)
RETURN *;
2 REPLIES 2

terryfranklin82
Graph Voyager

Apart from the two NULLs, every row in your source data contains a unique value for from_score.

Your first merge statement:

MERGE (e:Attack_From_Data {attack_no:attackgraph.attack_no, attack_seq:attackgraph.attack_seq, from_id: attackgraph.from_id, from_score:attackgraph.from_score})

includes this property, which results in a new (e) node being created almost everytime. You also have the same problem with to_score in your second merge statement.

If you want to create one (e) node for each unique from_id, and one (c) node for each unique to_id, then you should remove the other properties from each merge statement.

thanks,
I change my query.
but, still difficult for me.

Anyway, I think the result is similar.
have a nice day.