Recipe: Temporal Queries
Query the graph at a specific point in time.
Snapshot query (AS OF)#
// Query the graph as it was at a specific sequence checkpoint
const result = db.query("MATCH (n:Person) AS OF seq 100 RETURN n.name, n.age")Temporal decay#
Apply exponential decay to rank recent data higher:
const decayed = db.query("CALL temporal.decay(7, 0.01)")
// halfLife=7 days, floor=0.01Velocity (rate of change)#
How fast is the graph changing?
const v = db.query("CALL temporal.velocity(7)") // last 7 days
console.log(v.rows[0].get('totalNodes'))Trajectory#
Track an entity's changes over time:
const trajectory = db.query("CALL temporal.trajectory()")Changes since checkpoint#
const changes = db.query("CALL db.changesSince")See Also#
- Temporal Queries —
AS OF,db.changesSince(), and time-travel in depth - Event Sourcing — every mutation as a temporal fact
- Sync — delta sync built on the same temporal log
Try it
Open ↗⌘↵ to run
Loading engine…