I'm trying to figure out how to run a subquery and combine an edge property with the node property, but I can't figure out how. What I would like to do is something like:
MATCH (person:Person)
RETURN person {.id, .name, Homes: [(person)-[r:OWNS]-(p:Property) | <not sure what to do here>{p.address, r.purchaseDate}]}
I have tried any combination of p and r for the list comprehension and nothing seems to work. Is this possible, or do I need to return these values separately?
match(p:Person{id:100})
match(p)-[r:OWNS]->(h:Home)
with p, collect({address: h.address, purchaseDate: r.purchaseDate}) as homes
return p{.id, .name, homes: homes}
That I do not know. Your query is performing two queries, one in the initial match for the person, and then a second in the pattern match for the home when creating your collection of homes.