cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

How connect a graph with nodes appearing in different cells of a csv file? Multiple labels?

I am trying to create a graph in neo4j using the following query:

LOAD CSV WITH HEADERS FROM 'file:///MyData.csv' AS row

MATCH (conta:Conta {nome: row.`Conta Origem`})
MATCH (contad:ContaD {nome: row.`Conta Destino`})
MERGE (conta)-[op:Movimentação]->(contad)
  ON CREATE SET op.Valor = toFloat(row.Valor), op.`Tipo de Gasto` = row.`Tipo de Gasto`, op.`Tipo de movimentacao`=row.`Tipo de movimentacao`;

And the output is:

But this is not exactly what I want since the output is showing two graphs with the node 1 not connected; I mean, what I want is nodes 10 and 11 being connected to the red-centered node 1.

The problem is that they are representing transactions through bank accounts, and accounts 11 and 10 are origin accounts to account 1 which, in its turn, is an origin account for all the others.

How can I proceed and change the query so I can get it right? I am new to cypher, so I am sorry if it is obvious.

A sample of the data is shown below:

0 REPLIES 0