Chain Relationship from CSV

I am trying to display a chained relationship from a CSV file that has a procedure in Column 1 and its called procedures in Column 2.
Example
ProcedureName,CalledProcedureName
A,B
B,C
C,D

I am able to create the relationships and display A->B & B->C & C->D but I want to to be able to display the chained relationship such that we see A->B->C->D as one long chain. Any help would be appreciated, thank you!

1 Like

Are you using ‘Create’ or ‘Merge’ to an the nodes and relationships? Can you share your script?

Did you ever figure out how to do this? It's really not obvious. The problem comes in with the need to base creation of a new relation, relative to an operation that you just performed to create the previous one. I.e., you need to preserve state as you're walking your data. No clue how to do that with Cypher.

Going back to the original author's example, I have procedures that look like:

ProcedureName,Procedure
ProcedureOne,"Step A, Step B, Step C, Step D, ..."
ProcedureTwo,"Step A, Step C, Step F, Step H, ..."

Making chains in this way, using CSV import, is the use-case. I can split and unwind the procedure but it's unclear how to create something and then immediately use that thing you created to chain more items. Hoping someone has some ideas.

For anyone else who comes looking for a solution to this same problem: I gave up on Cypher for this and just wrote a program to talk to the DB. It was easier.

I think part of the challenge is in your question itself.

You have already in essense created A->B->C->D. So If I understand you correctly. You want to somehow note that B->C only occured because A->B happened. Is there a time element to you data? Could you have another instance that might be A->B->D ?

I"m not sure what is missing here.