Spread operator for map projections?

Just in case I've missed it in the docs: is there something like spread operators for map projections?

I have two related nodes, which I would get with MATCH (b:Building)--(a:Address).

Now I can project the address into the building with RETURN b{.*, id: ID(b), address: a} AS building;

But is it possible to flatten the map and add the properties of Address to the new map without referencing them one by one?

We could have apoc.create.virtual.fromNode(node :: NODE?, propertyNames :: LIST? OF STRING?) (from docs) for multiple nodes, maybe with some property configuration like it is supposed to work in nodes.collapse (which seems to live in a completely different domain).

Or we could have some spread operator like RETURN b{.*, id: ID(b), ..a} AS building;.

Sure, try:

RETURN b{.*, id: ID(b), address: properties(a)}

If that does not work for you, and you really want a flat map, apoc has some procedures:

Merge two maps (just merges the key/value pairs):

with b{.*, id: id(b)} as bMap, properties(a) as aMap
return apoc.map.merge( bMap,  aMap)

Flatten a map (uses dot notation to merge key/values):

with b{.*, id: id(b), address: properties(a)} as map
return apoc.map.flatten( map)

or, if you want each node to be prefixed:

with {id: id(b), building: properties(b),  address: properties(a)} as map
return apoc.map.flatten( map)

Ah, map.merge and map.flatten do look promising. Thanks!