I have the following dataset with headers I'm using neo4j to create a graph database:
context_id, item_type, category
u1, product, TVs
u1, THX, TVs
u2, THX, Receivers
u2, product, PS4
u2, product, Receivers
Code:
LOAD CSV WITH HEADERS FROM 'file:///Users/neo4j.csv' AS line
WITH line
MERGE (cust:Cust { c_id: line.context_id})
CREATE (cat:Cat {cat_nm: line.category})
CREATE (cust)-[r:ACTION{type:line.item_type}]->(cat);
This processes, but it has two issues I want to solve:
1) the relationship is just called ACTION, and I'd like two relationships, "product" and "THX" 2) the other, is right now the category are not nodes, and I believe they should be.
I want nodes of both context_id and category. That way I can see relationship between using values of item_type with other categories.
It is also not required I need to perform these functions on the load. Thanks.