I need some help matching data from csv to create relations. I've a csv of all products and a csv containing products that are often bought together.
I've made nodes based on this csv:
slug,name
_f8rgem,Garlic/Lassan
_p0umd0,Garlic (Lehsan)
_vqwgm8,Onion/Piyaz
_vkuk3g,Ginger/Adrak
now my other csv contains items that re frequently bought together in a single row, as follows:
product_0,product_1,product_2,product_3,product_4,product_5
_2bmj0w,_45otin
_2bmj0w,_6x3xbs
_2bmj0w,_bycewe
_2bmj0w,_imv5rb
_f8rgem,_vqwgm8,_p57hf3,_vkuk3g,_y1181l
_f8rgem,_vqwgm8,_vkuk3g,_y1181l,_djn7gn,_6gmqz1
Now I want to create relations for above created nodes using this csv, where all products in a row have a relation with each other, but I can't figure out how to do it.
Below is the code I tried:
LOAD CSV WITH HEADERS FROM "file:///product_assocations.csv" as csv
MATCH (p0:Product {slug:csv.product_0}), (p1:Product {slug:csv.product_1}), (p2:Product {slug:csv.product_2}), (p3:Product {slug:csv.product_3}), (p4:Product {slug:csv.product_4}), (p5:Product {slug:csv.product_5})
MERGE (p0)-[:BOUGHT_WITH]->(p1)-[:BOUGHT_WITH]->(p2)-[:BOUGHT_WITH]->(p3)-[:BOUGHT_WITH]->(p4)-[:BOUGHT_WITH]->(p5)
I've stored nodes in [:Product] field and they are visible there.
Can someone please help me out with making connections. I'm totally new to neo4j and can't seem to figure it out.