Reputation: 103
I first create this 2:
CREATE (user1:Person {name:"User1"})
CREATE (user2:Person {name:"User2"})
And when I try
CREATE (user1)-[:FOLLOWS]->(user2)
It creates 2 empty nodes with no name nor anything related by the FOLLOW, but both nodes "User1"and "User2" are never blessed by my simple intention of relating them.
Why is this simple thing not working?
Upvotes: 2
Views: 548
Reputation: 11216
You are processing the statements separately. The user1
and user2
are identifiers that apply to a specific cypher statement. By the time you execute the last statement cypher no longer has a reference for user1
and user2
.
You could write
match (u1:Person {name:"User1"}), (u2:Person {name:"User2"})
create (u1)-[:FOLLOWS]->(u2)
and that would find the nodes that you had previously created and join them with the :FOLLOWS
relationship.
So when you just specified the identifiers int eh create statement it would match every node and join them.
Upvotes: 2