Following scenario:
Node Person
person | boss
Peter | Bob
Bob | Karl
Peter | Karl
Karl |
...
Node Team
team| boss
ABC | Bob
CDE | Bob
XZY | Karl
...
What I'd like to create Relationships between all(!) persons and teams.
- Create relationships between person (=boss) and team boss. That is simple and works
match(p:Person),(t:Team) where p.person= t.boss create (p)-[:IS_BOSS]->(t)
Result:
Node Person Node Team
person | boss
Peter | Bob
Bob | Karl -[IS_BOSS]->ABC,CDE
Peter | Karl
Karl | -[IS_BOSS]->XZY
...
- I would now like to assign all other persons to their respective team/boss as well. That is simple and works as well:
match(p:Person),(t:Team) where p.boss= t.boss create (p)-[:MEMBER]->(t)
Result:
Node Person -[REL]-> Node Team
person | boss | team
Peter | Bob -[IS_MEMBER]->ABC,CDE
Bob | Karl -[IS_BOSS]->ABC,CDE
Peter | Karl -[IS_MEMBER]->ABC,CDE
Karl | -[IS_BOSS]->XZY
- I would also like to create [IS_BOSS] inside the People node to delete the Boss property. So that in the end, only persons are connected.
Any ideas?