MATCH (p:Person {name: "Tom Hanks"})
MATCH (m:Movie {title:"You've Got Mail"})
CALL apoc.create.relationship(p, "ACTED_IN", {roles:['Joe Fox']}, m)
YIELD rel
RETURN rel;
The example below shows ways of creating a node with the Person and Actor labels, with a name property of "Tom Hanks":
If we might want to create a relationship with a relationship type or properties passed in as parameters.
:param relType => ("ACTED_IN");
:param properties => ({roles: ["Joe Fox"]});
MATCH (p:Person {name: "Tom Hanks"})
MATCH (m:Movie {title:"You've Got Mail"})
CALL apoc.create.relationship(p, $relType, $properties, m)
YIELD rel
RETURN rel;
References:
https://neo4j.com/labs/apoc/4.1/overview/apoc.create/apoc.create.relationship/
No comments:
Post a Comment