My situation is as follows. I have a dataset of companies and employess.
Only nodes exists in 2 different labels; person and company. The relationships have not been created. I need to create the relationships across the entire dataset.
person object:
name: blah
org_lookup_id: 1234
company object
comp: etc
org_id: 1234
I want to create a relationship for the node. For 1 node this is easy.
MATCH (a:person {name: "blah"}),
(c:company {comp: "etc"})
MERGE (a)-[r:WORKS_FOR]->(b)
However, I am trying to cartisean join them and do it across the entire set..
MATCH (p:person),(c:company)
WHERE p.org_lookup_id=c.org_id
MERGE (p)-[r:WORKS_AT]->(c)
RETURN type(r)
This returns no results...
My goal is to have X amount of relationships created in one query.
The query works as expected, there is a Cartesian join between the objects.
MATCH (p:person),(d:company)
WHERE p.org_lookup_id=d.org_id
merge (p)-[r:WORKS_FOR]->(d)
RETURN type(r)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.