Think of a process flow or a precedence/successor network. There are many activities in the overall process flow performed by many different groups. Given a certain group, if they have rework to do, they will impact many of the downstream activities and thus the groups that perform those activities. I can easily write a query similar to the one shown below:
MATCH p = (g:Group {id:'XXX'})-[:PERFORMS]->(a1:Activity)-[:PRECEDES*]->(a2:Activity {id:'Finish'})
RETURN p
When I do this, I get the graph that is expected showing all the activities that initial group is responsible for and how those activity nodes terminate along a variable path to the terminus a2
node. In my example, 50 or so total activities are returned including three "first level" activities and the final activity (which were already known).
What I want is to somehow collect the intermediate 46 activities that were "hidden" and query which (g2:Group)-[:PERFORMS]->
those (hidden:Activity)
to RETURN g2.name, hidden.id
.
Can someone help with the additional cypher or recommend an APOC procedure to help me out? I feel like this should be pretty simple but the solution escapes me.