Let us considered
- Drone (Parent)
- Quadcropter (Child)
- Pixel (Grand Child)
- Quadcropter (Child)
with [:SUB_CATEGORY] as relationship node
below Cypher query to fetch along with its parts tagged with each nodes
MATCH p=(n:Category)-[:SUB_CATEGORY*]->(m)<-[:TAGGED_TO]-(part:Part)
WHERE NOT ()-[:SUB_CATEGORY]->(n) AND toLower(part.name) STARTS WITH toLower('atm')
WITH COLLECT(p) AS ps
RETURN ps
above cypher query returns actual result set i.e., its showing all relationship both SUB_CATEGORY and TAGGED_TO
Now if I used to convert this into Tree structure using APOC procedure then it skip TAGGED_TO relationship node of Parent Node i.e., Drone
MATCH p=(n:Category)-[:SUB_CATEGORY*]->(m)<-[:TAGGED_TO]-(part:Part)
WHERE NOT ()-[:SUB_CATEGORY]->(n) AND toLower(part.name) STARTS WITH toLower('atm')
WITH COLLECT(p) AS ps
CALL apoc.convert.toTree(ps) YIELD value
RETURN value
Can you give me suggestion for getting the TAGGED_TO node of all nodes along with parent node using APOC