Hello guys,
I'm trying to load a data from a CSV file containing the following fields (header), as shown in the figure below:
This CSV contains sales information of a specific store (CODIGOFILIAL). A person (CPF) can buy some products (CODIGOPRODUTO) that can be attached to the same basket (NUMEROUNICOCUPOM), which was bought in a specific date (DATAMOVIMENTO); as you can see on the highlighted text.
I'm trying to create the graph using the following cypher command:
LOAD CSV WITH HEADERS FROM 'file:///subset_vendas_cupom.csv' AS line
MERGE (n:Cliente {cpf:line.CPF})
MERGE (m:Cupom {codigoCupom:line.NUMEROUNICOCUPOM, dataMovimento:line.DATAMOVIMENTO})
MERGE (o:Produto {codigoProduto:line.CODIGOPRODUTO})
MERGE (p:Filial {filial:line.CODIGOFILIAL})
MERGE (n)-[:FEZ_PEDIDO]->(m)-[:CONTEM]->(o)-[:VENDIDO]->(p)
The problem is that it creates multiple relationships from a client to the same basket, because the basket contained several items which appear in different rows of my CSV file; as follows:
How can I make the highlighted relationships unique? Thanks in advance.