Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-04-2021 04:58 PM
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 *;
01-04-2021 06:52 PM
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.
01-04-2021 10:19 PM
thanks,
I change my query.
but, still difficult for me.
Anyway, I think the result is similar.
have a nice day.
All the sessions of the conference are now available online