Creating a relationship from csv

I have created nodes and relationships from .csv files:

LOAD CSV WITH HEADERS FROM "file:///Ancestry_match.csv" AS matches 
CREATE (m1:DNAmatch {
matchid: matches.matchGuid, 
matchname: matches.matchTestDisplayName, 
matchadminname: matches.matchTestAdminDisplayName, 
matchcM: matches.sharedCentimorgans})


LOAD CSV WITH HEADERS FROM "file:///Ancestry_AncestorList.csv" AS thrulines 
CREATE (m2:thru {
pathfrommetoancestor: thrulines.KinshipPathToSampleId, 
ancestorsname: thrulines.AncestorDisplayName})


LOAD CSV WITH HEADERS FROM "file:///AncestryGreatGrandParents.csv" AS ggParent 
CREATE (m3:ggp {
pathfrommetomyggp: ggParent.ggpID, 
myggP: ggParent.ggpName})


CREATE INDEX match_index IF NOT EXISTS FOR (m1:DNAmatch) ON (m1.matchid)


MATCH (dnamatch:DNAmatch)
SET dnamatch.matchcM = toFloat(dnamatch.matchcM)


LOAD CSV WITH HEADERS FROM "file:///AncestryAncestorCouple.csv" AS thruline 
MATCH (a:ggp {pathfrommetomyggp: thruline.ggpID}) 
MATCH (b:thru {pathfrommetoancestor: thruline.KinshipPathToSampleId}) 
MERGE (a)-[:lineof]->(b)


LOAD CSV WITH HEADERS FROM "file:///Ancestry_Ancestor.csv" AS matchtoAncestor 
MATCH (a1:DNAmatch {matchid: matchtoAncestor.matchGuid}) 
MATCH (b1:thru {pathfrommetoancestor: matchtoAncestor.KinshipPathToSampleId}) 
MERGE (a1)-[:pathtoancestor]->(b1)

All of the nodes load, as well as, the index and float conversion. The first relationship (MERGE (a)-[:lineof]->(b)) works and when returning those nodes show properly. The second relationship responds with (no changes, no records). If I return a1 or b1 I get the proper node info.

I can't see where the difference is between the two relationships or why the second one won't work.

Thanks for any help
Dean

The code does look correct. Does the relationship already exist?

No, I have wiped the db, reloaded just the two node sets, then the relationship and get this. When I return the a1 or b1 (with limit like 5) I get the nodes. Then wipe the db again and it doesn't list eliminating relationships.

I take that back. Using MATCH (X) RETURN X putting a1, b1 or any of those it returns the same nodes. I apparently am using a misconception of how that works.

This is resolved. Look at data files. One file has ID's all caps the other all lower case.

Thank you for looking at this Gary.

1 Like