Why do I have same node1 and node2? How do I merge them into one?

Can you share the query that created these nodes?
It is duplicating each node with both labels you're using.
Give more details so we can help more precisely.

1 Like

LOAD CSV WITH HEADERS FROM "file:/emp_wellbeing.csv" AS csvLine RETURN csvLine

MERGE (construct1: construct1 {name1:csvLine.Node1 , Construct1Level1:csvLine.Node1Property_ConstructLevel1 , Construct1Level2:csvLine.Node1Property_ConstructLevel2})

MERGE (construct2: construct2 {name2:csvLine.Node2 , Construct2Level1:csvLine.Node2Property_ConstructLevel1 , Construct2Level2:csvLine.Node2Property_ConstructLevel2})

MERGE (construct1) - [:causes {PublicationTitle:csvLine.EdgeProperty_PublicationTitle , Reference:csvLine.EdgeProperty_Reference , TheoryDetails:csvLine.EdgeProperty_TheoryDetails , Theory:csvLine.EdgeProperty_Theory , HypothesisNoInPaper:csvLine.EdgeProperty_HypothesisNoInPaper , Hypothesis:csvLine.EdgeProperty_Hypothesis , Direction:csvLine.EdgeProperty_Direction , Moderator:csvLine.EdgeProperty_Moderator , SampleSize:csvLine.EdgeProperty_SampleSize , SampleIndustries:csvLine.EdgeProperty_SampleIndustries , SampleCountries:csvLine.EdgeProperty_SampleCountries}]-> (construct2)

I suspect the .csv file has same name for csvLine.Node1 and csvLine.Node2, but different values for Node1Property_ConstructLevel1 and Node2Property_ConstructLevel1.

Thank you, they actually have the same name and the same ConstructLevel1.

You may be mixing up how the data should be represented from the role that the data is meant to play in these import queries. Whether the node is the source or target of a relationship, if it's essentially the same type of thing, don't use different labels, it's causing problems in your graph.

You have a :construct1 labeled node, and a :construct2 labeled node, but is there any meaningful difference between nodes of these labels? Wouldn't it make more sense to just have :construct nodes? If these are essentially the same type of node, then use the same label for both, that way it won't matter if the node is the source or target node of the relationships being merged, it will still refer to the same construct node in either case. The variables you use for these nodes will define their role, for whether they are the source or target. You don't need to use different labels.