I need to get all nodes and relationships related to a given node.
For example, I have a node "Person", and it's related to node "Family", node "City", node "Car" and node "Bank":
Person [PartOf]-> Family
Person [BornIn]-> City
Person [Own]-> Car
Person [CustomerOf]-> Bank
How can I get in a query the Person and all its relationships and related nodes?
Hello @elad and welcome to the Neo4j community
Thank you @Cobra
I guess I didn't explain myself clearly.
Your query will give me multiple results for each Person, right?
I'm aiming for 1 result for each person.
Let's say I have 5 persons with those links, so I want a query that will return a list of results, each result will be a unique person and its relationships and nodes.
So if I query in my case for a Person and all the relationships and related nodes, I want to get 5 result, and each result will contain all the other nodes.
This query will return for each Person a list of relations and a list of nodes
RETURN p, collect(r) AS relations, collect(n) AS nodes