I have the below graph in Neo4j. In the below graph Subscriber
are the entities who has performed different actions at different time. Actions are the relationships in the graph (Complained
, Recharged
, Enquired
, Clicked
).
My requirement is to write the Cypher query to get all the next action of all the Subscriber
(example: I want the query to find what is the next action performed by all the Subscriber
who has done Recharged
action with RechargeType=TT
. I need to fetch the next action based on the time (ActionTime)
I am also providing the link to get the entire data of my graph in the .xls returned after writing the below query.
match(n)-[r]->(k)
return n, r, type(r), k
Below query return the details of all the Subscriber whose RechargeType='TT'. What I need is the cypher query to get the immediate next action taken by these Subscriber based on the 'ActionTime' and grouping them as per the action taken(Recharged,Clicked,Complained,Enquired).
Query: match(n:Subscriber)-[r:Recharged]->(k) where r.RechargeType='TT' return n, r, type(r), k;
Please let me know if any further details/explanation is required for my question to be answered..
Edit: Graph data has been modified making the Action time as same for all actions performed (relationships in this case) and also the modified graph image has been uploaded.
Time
instead ofRechargeTime
,CallTime
, etc? I think it can be simplify your queries... Also, the "action type" is stored in the relationship (Recharged, Clicked, etc). – Bruno Peres