Lucas Aragón 7 min readMost retrieval systems treat knowledge as a collection of statements: a customer has a plan, an employee reports to a manager, a product carries a price. Yet many statements are not permanently true. They are true during an interval.
That distinction matters whenever an AI system answers questions about policies, contracts, ownership, organizational structure, inventory, or eligibility. If a retriever returns every relevant fact without considering time, the model may combine facts that were individually valid but never valid together.
A temporal knowledge graph addresses this problem by attaching time to relationships. It lets a system answer not merely what is connected, but what was connected when. The central design principle is simple: treat change as a first-class fact rather than overwriting yesterday with today.
The failure hidden inside an ordinary knowledge graph
Consider a support assistant for a software company. Its graph contains customers, subscription plans, and support policies. A conventional graph might store:
- Acme Labs has plan Pro
- Pro includes retention 90 days
- Acme Labs has plan Enterprise
- Enterprise includes retention 365 days
Asked, “What retention applied to Acme Labs in March?”, the graph exposes two plans and two retention periods. Similarity search cannot resolve the conflict because every statement is semantically relevant. A language model may choose the latest policy, infer that both applied, or produce an answer unsupported by any single historical state.
The missing information is validity. Acme may have used Pro until April and Enterprise afterward. The graph needs to preserve both relationships and their intervals.
Two clocks govern every changing fact
A robust temporal model distinguishes valid time from transaction time.
- Valid time describes when a fact was true in the world. A contract may apply from 1 January through 31 March.
- Transaction time describes when the system learned or recorded that fact. The contract may have been entered on 3 January and corrected on 10 April.
Tracking only valid time supports historical questions. Tracking both creates a bitemporal system, which can answer a more demanding question: “What did we believe on 5 April about the contract that applied in March?” This is valuable for audits, retroactive corrections, and reconstructing decisions.
| Question | Time required | Meaning |
|---|---|---|
| Which plan applies now? | Valid time | Select the relationship whose interval contains the present. |
| Which plan applied on 15 March? | Valid time | Select the interval containing 15 March. |
| What did the system show on 5 April? | Transaction time | Reconstruct records visible on 5 April. |
| What did we believe on 5 April about 15 March? | Both clocks | Filter by valid and transaction intervals. |
Not every product needs both clocks. Valid time is the sensible starting point. Add transaction time when correction history or decision reproducibility is a real requirement, because bitemporal storage and queries are materially more complex.
Model relationships as interval-bearing records
The most practical representation turns each changing relationship into its own record. Instead of storing a mutable edge saying “Acme has plan Enterprise,” create an assignment with four essential fields:
- Subject: Acme Labs
- Predicate: has plan
- Object: Enterprise
- Valid interval: start date and end date
Use a half-open interval: the start is inclusive and the end is exclusive. An assignment represented as 1 April to 1 July applies at midnight on 1 April but not at midnight on 1 July. This convention makes adjacent periods fit without overlap: one interval can end precisely when the next begins.
An absent end date means “open-ended,” not “eternal.” It states that no ending is currently known. That distinction allows the record to be closed later without pretending the original assertion promised permanence.
Some graph databases support properties directly on edges. Others make it easier to represent the relationship as a node, such as a PlanAssignment, connected to the customer and plan. Relationship nodes are often preferable when the fact also needs provenance, approval status, contract identifiers, or transaction-time history.
A worked example: answering an as-of question
Suppose the source records say Acme Labs used Pro from 1 January until 1 April, then Enterprise from 1 April onward. The plan policies also changed: Pro offered 90-day retention until 1 February, then 120 days.
| Fact | Valid from | Valid to |
|---|---|---|
| Acme has plan Pro | 1 January | 1 April |
| Acme has plan Enterprise | 1 April | Open |
| Pro retention is 90 days | 1 January | 1 February |
| Pro retention is 120 days | 1 February | Open |
| Enterprise retention is 365 days | 1 January | Open |
The user asks: “What retention applied to Acme Labs on 15 March?” The system should execute the reasoning as a sequence of interval-filtered traversals:
- Parse 15 March as the query’s effective date.
- Find Acme’s plan assignment where the start is on or before that date and the end is after it, or absent.
- The matching assignment is Pro.
- Traverse from Pro to its retention policy using the same effective date.
- The matching policy is 120 days.
- Return the result with its supporting intervals.
The answer can now be precise: “On 15 March, Acme Labs was on Pro, whose applicable retention policy was 120 days.” Crucially, Enterprise’s 365-day policy never enters the model context. Temporal filtering happens before generation, not as an instruction asking the model to reconcile contradictions.
Separate temporal retrieval from language generation
A reliable architecture gives deterministic components responsibility for dates and lets the language model explain the result.
1. Extract the effective time
Resolve phrases such as “last quarter,” “when the order shipped,” or “as of renewal” into a timestamp or interval. If the reference is genuinely ambiguous, ask for clarification rather than silently substituting the present.
2. Apply temporal predicates in the query
For a timestamp t, an interval matches when its start is no later than t and its end is later than t, with an absent end treated as open. For a requested period, define whether the product needs facts valid throughout the period or facts overlapping any part of it. Those are different questions.
3. Retrieve provenance with the fact
Pass the model the selected fact, validity interval, source, and retrieval timestamp. This enables a concise explanation and helps operators inspect surprising answers.
4. Refuse unsupported temporal precision
If the data records only a month but the user asks about a particular day, the system should expose that mismatch. Inventing a precise boundary converts incomplete data into false certainty.
Prevent overlaps, gaps, and silent retroactivity
Temporal data fails less often through exotic graph theory than through mundane ingestion errors. Three controls matter.
- Overlap rules: Decide whether two active relationships of the same type are permitted. A customer may hold multiple roles, but perhaps only one primary subscription. Enforce the domain rule during writes.
- Gap detection: If continuous coverage is expected, flag intervals with uncovered periods. A gap should yield “unknown,” not the nearest available state.
- Correction semantics: Decide whether an edit corrects a mistaken record or represents a real-world change. A correction may require transaction history; a change should close one valid interval and open another.
Time zones also belong in the schema, not in application folklore. Store timestamps in a consistent standard while preserving the business zone needed to interpret boundaries such as “the policy changed at midnight.” Date-only facts should remain date-based where possible; converting them casually into timestamps can create artificial shifts.
When temporal graphs are worth the complexity
Use this pattern when answers depend on chains of changing relationships: who owned an asset when an incident occurred, which policy governed a claim, which manager approved an expense, or which product configuration applied to an order. A graph is especially useful when the temporal question crosses several entities.
Do not reach for a temporal graph merely because records have timestamps. A versioned relational table may be simpler when queries concern one entity and joins are predictable. Event sourcing may be the better foundation when the primary requirement is replaying every state transition. A temporal graph earns its place when both relationships and historical traversal are central.
The revealing shift is conceptual: “current truth” is not the database with older rows removed. It is one projection of a larger history. Preserve that history, filter it deterministically, and an AI system can explain not only what is true, but what was true at the moment that mattered.
This post was drafted with AI assistance and reviewed against our editorial policy before publication. Corrections are made at the source, on the page, with the date shown.
From our own rounds
Measured on The Curator, from real sessions people played on this site — not a third-party dataset.
- Rounds played here
- 167
- Questions per round
- 1.7
Rate this article
Discussion
Comments are moderated. Read our editorial policy.