Reputation: 215
I have 2 nodes: People and Friends with next structures: people: p_id; Friends: p_id, f_id
I need to build relation [:KNOWS] between them.
How can i do that? I'm new in Neo4J.
P.S. I'm using Cypher
Upvotes: 1
Views: 610
Reputation: 11216
I think this will do it for you. Basically, you need to explicitly match both of the nodes with which you want to create a relationship and then create the relationship with the direction you want between the the two referenced nodes.
MATCH (p:People), (f:Friend)
WHERE p.id = 'xx'
AND f.id = 'xy'
CREATE (p)-[:KNOWS]->(f)
The ref card - http://neo4j.com/docs/cypher-refcard/current/ - has been invaluable to me in working through the intricacies of cypher.
Upvotes: 3