Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-13-2020 04:09 AM
i have a csv file
name college
ABC clg1
BCD clg2
i want a relation from name->clg
how can i create that without using any nodes .
03-13-2020 06:38 AM
Impossible. Relationships can only connect nodes, they always have a start node and an end node, though it could be that they are the same node (a relationship from a node that points to itself).
In case I misunderstood, you might want to clarify what you're trying to do.
03-13-2020 10:56 AM
It may help to start out with an example based on your data. I'm guessing at what your data model might look like, but try these in an empty neo4j database. I used neo4j desktop to create an empty graph db.
// create the first relationship
create p=(:person {name:'ABC'})-[:ATTENDING]->(:college {name:'clg1'})
return p
// create the second relationship
create p=(:person {name:'BCD'})-[:ATTENDING]->(:college {name:'clg2'})
return p
// return all people and the college they are attending
match p=(a:person)-[:ATTENDING]->(b:college)
return p
// add another person 'me' ATTENDING clg2 (an existing college)
Match (b:college {name:'clg2'})
CREATE p=(a:person {name:'me'})-[:ATTENDING]->(b)
return p
// return all people and the college they are attending, again to see there are now two people attending clg2
match p=(a:person)-[:ATTENDING]->(b:college)
return p
notes
All the sessions of the conference are now available online