I have a set of nodes which look like this :
dalle { "ident": "A-1-1-1", "networkId": 1, "numberId": 1, "floor": 1, "room": 1, "building": "A", "buildingId": 1 }
I want to group my nodes so I do this command :
CALL apoc.nodes.group(['dalle'], ['building', 'floor', 'room'])
YIELD nodes, relationships
RETURN nodes, relationships
The result I got is really nice except one detail, I loose some properties, my nodes are now :
{ "floor": 3, "count_*": 1, "building": "C", "room": 1 }
Why do I loose properties ?
I tried to update the nodes to set somes properties back like this :
CALL apoc.nodes.group(['dalle'], ['building', 'floor', 'room'])
YIELD nodes, relationships
FOREACH(n IN nodes | SET n.ident=n.building+n.floor)
RETURN nodes, relationships
but it changes nothing to my query result.
thanks !
You should read the documentation for the apoc.nodes.group procedure to see if it is actually the right thing for you to be using.
That procedure returns virtual nodes and relationships. Since virtual nodes and relationships are not actually in the DB, the SET clause does not work on them.
If you want more properties to show up in the virtual nodes, then you'd have to add them to the properties list you pass to the procedure. For example: ['building', 'floor', 'room', 'ident']
.