WorldCypher: Temporal Queries
ArcFlow natively supports time-aware queries — snapshot the graph at any point in time, track trajectories, and compute temporal metrics.
AS OF seq N — time travel queries#
Query the graph as it existed at a specific mutation sequence number. The engine replays the WAL onto a clean snapshot at that sequence.
-- What did the graph look like at sequence 42?
MATCH (n:Person) AS OF seq 42 RETURN n.name, n.age// Get current sequence, then query an earlier snapshot
const clock = db.query("CALL db.clock()")
const currentSeq = Number(clock.rows[0].get('tick'))
// Query state from 100 mutations ago
const snapshot = db.query(`MATCH (n:Person) AS OF seq ${currentSeq - 100} RETURN n.name`)Deprecated:
AS OF <unix_timestamp>emits a deprecation warning. UseAS OF seq Nfor correctness.
Temporal procedures#
temporal.velocity — 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'))
console.log(v.rows[0].get('totalRelationships'))temporal.decay — exponential decay#
Rank recent data higher with exponential decay:
const decayed = db.query("CALL temporal.decay(7, 0.01)")
// halfLife=7 days, floor=0.01temporal.trajectory — entity history#
Track an entity's changes over time:
const trajectory = db.query("CALL temporal.trajectory()")Temporal database operations#
-- Changes since last checkpoint
CALL db.changesSince
-- Compare two temporal versions
CALL db.temporalCompare
-- Replay temporal events
CALL db.temporalReplay
-- Nodes at a specific point in time
CALL db.nodesAsOfTemporal live queries#
Combine temporal with live queries for continuous monitoring:
-- Continuously watch for new high-value nodes
LIVE MATCH (n:Person) WHERE n.score > 0.9 RETURN n.name, n.scoreUse cases#
- Audit trails — "What was the state of entity X on March 1st?"
- Temporal analytics — "How has the network evolved over time?"
- Event sourcing — replay graph mutations for debugging
- Regulatory compliance — point-in-time reporting
See Also#
- Temporal Queries — temporal capability overview with patterns and examples
- Event Sourcing — WAL-backed mutation history
- Persistence & WAL — how the WAL stores every mutation
- Use Case: Autonomous Systems — temporal reasoning in autonomous agents
Try it
Open ↗⌘↵ to run
Loading engine…