Novice
(Novice)
January 5, 2021, 12:58am
1
Hello,
according to 'attack_no',
I want to connect 'from_id' 'to_id'.
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 *;
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.
Novice
(Novice)
January 5, 2021, 6:19am
3
thanks,
I change my query.
but, still difficult for me.
Anyway, I think the result is similar.
have a nice day.