I have this graph model country -> State--> District--> Tahasil
and I am using neo4j python driver along with apoc I want to reduce the tahasil nodes to one single node by intacting properties and relationships while reading to show case to end user like below
Country -> State-> District -> GroupTahasil,
I am trying to use below cypher query but its not working getting syntax error also its grouping all nodes.
MATCH p=(c:Country)-[:CONTAINS]-(s:State)-[:CONTAINS]-(d:District)-[:CONTAINS]-(t:Tahasil)
WITH apoc.nodes.collapse(nodes(p), {Label: "Type"}) AS groupedNodes
RETURN groupedNodes
which contains all tahasil nodes details, later I can allow user to explore more on this, what will be the best way to achieve this using cypher and apoc