I have been trying to create relationships between many nodes. The nodes are Video nodes which include a username(user that uploaded the video) and user which also includes username as a property. I have been trying to figure out how to iteratively create a relationship between Video and User by the username. I want to create a relationship User-UPLOADS-Video.
I did try to create an index for the username property on the video username.
This is what I was trying to run, but only the nodes are imported and the relationships are not created. Is there something that I am missing or should include? If there is a better way to do this, please let me know. I am new to Neo4j and I am sure there is a better way to do it.
CALL apoc.periodic.iterate("
CALL apoc.load.csv('user.csv',{
mapping:{
userID: {type:'string'},
views: {type:'int'},
friends: {type:'int'}
}
}) YIELD map as row RETURN row
","
CREATE (u:User) SET u = row
WITH u
MATCH (v:Video)
WHERE u.userID = v.user
CREATE (u)-[:UPLOADS]->(v)
", {batchSize:10000, parallel:false, iterateList:true});
- Version 1.3.8 (1.3.8.34) desktop
-plugins: APOC