What do I do if I have to see sequence of events and restrict time between relationship

12 views
Skip to first unread message

Varun Tahin

unread,
May 19, 2018, 7:17:55 AM5/19/18
to Neo4j

Can anybody please tell me if I have timestamps on contain relationship and the destination node of that can be call,sms,email and I want to see if a particular sequence (according to time) of call/sms/email exists in that and the time between two events is less than 24 hours. Can we do that?

I have a sample query here:



Match(le:lead{name:'Varun1'})-[:have]->(e:events)-[l:nextevent*]-(c) 
with le, collect(labels(c)[0]) as row1, ["email","sms","call"] as row2
where any(idx in range(0,length(row1) - length(row2)) where 
row1[idx..idx+length(row2)] = row2 ) return le


Match(le:lead{name:'Varun1'})-[:have]->(e:events)-[l:contains]->(c) 
with c,le match (c)-[er:have]->(e)
WHERE ALL(idx in range(0, size(type(er))) WHERE ((er[idx]).time - 
(er[idx+1]).time) < 3600 and 'call' in labels(e))  
RETURN le;

Thanks
Reply all
Reply to author
Forward
0 new messages