[HOW TO] Neo4J Temporal querryies

Hello everyone,

I'm trying to build temporal query which I'd use for analysing incidences over time. This code fails, where I'd expect comparison of list against list to work as in usual languages:

with LocalDateTime("2018-01-01") as date, duration({months: 1}) AS duration
unwind range(0, 14) as range
with [collect(date + range*duration), collect(date + (range + 1)*duration)] as periods
return periods[1]<periods[2]

Let's say I have this graph:

(:Person{name})-[:WATCHED{when}]->(:Movie)-[:HAS_GENRE]->(:Genre)

I'd like to write query trend for what has person watched each month. Does anyone have an idea how to do it? I have code which uses driver and will do that query for every month separately, but I'd like to do it in "one shot". Is that possible?

Regards!

You don't need the collect.

with LocalDateTime("2018-01-01") as date, duration({months: 1}) AS duration
unwind range(0, 14) as range
with [date + range*duration, date + (range + 1)*duration] as periods
return periods[0]<periods[1], periods[0],periods[1]

You don't even need the array:

with LocalDateTime("2018-01-01") as date, duration({months: 1}) AS duration
unwind range(0, 14) as range
with date + range*duration as p1, date + (range + 1)*duration as p2
return p1, p2, p1 < p2