cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Relate multiple columns to single column also naming relationship against associated column name

Hi,

I have some data in the following format,

1.There are n columns with different locations.
2. Each row is associated with a unique token.

loc 1           loc 2          .....         loc n                Token
Mumbai          Maharashtra                   Dubai               qwendnj1232
Delhi           Assam                         Goa                 lkfdmglm00d
Hyderabad       Orissa                        Chennai             98ufhwjbsfhd
Pune            Kashmir                       Vizag               aisdjidsanajk89

Task

Create a relationship between Token values and remaining loc values such that, the relationship should be named after their respect loc column names.

What I tried

From little knowledge, I have about Neo4J(Still learning), I used the following code but it associates all rows to all token values via a single relationship

LOAD CSV WITH HEADERS FROM 'file:///locations.csv' as row WITH row 
WHERE row IS NOT NULL

CREATE (l:locations {name:row.name})
CREATE (t:tokens {name:row.Token})
SET l+={name:row.name}
CREATE (l) -[:RELATED_TO]->(t)
1 REPLY 1

Solved here: