Temporal Knowledge Graphs: Mapping 180k Words of Narrative

DeepWhiz Intermediate 3h ago Updated Jul 26, 2026 63 views 4 likes 1 min read

Turning a massive novel series into a temporal knowledge graph reveals patterns that are nearly impossible to spot through manual reading. By processing 180k words from the Oz series, it's possible to track 232 entities and 1,852 edges, treating the story as a set of source-verifiable facts rather than just a sequence of text.

The data reveals some wild contradictions: the Tin Woodman actually has the highest kill count in the series, despite being the character most prone to crying over a crushed beetle. Similarly, the system can track "state" edges—like a debt the Scarecrow owes a stork—that remain active across 92 chapters, something a standard LLM context window would likely lose track of.

The AI Workflow and Architecture

Building this required more than a single prompt; it took five distinct multi-agent pipelines combining LLMs and NLP:
1. A global prescan and ontology construction.
2. Chapter-by-chapter graph extraction.
3. Retrospective validation across long spans of text.
4. A linguistic prescan for speech profiles.

To make this work as a real-world LLM agent deployment, the system uses three specific edge types to handle the dimension of time:

  • Event: Instantaneous actions.
  • Identity: Fixed facts.
  • State: Persistent actions that require a specific quote from the text to be marked as "terminated."

Overcoming LLM Extraction Issues

A major hurdle in prompt engineering for knowledge graphs is "schema drift." If you let an LLM extract entities freely, it will invent new aliases and inconsistent fields for every chapter. The solution here is a mandatory ontology scan of the entire story first, which defines the entity and edge types before any extraction begins.

The system also introduces "epistemic nodes." Since stories rely on who knows what, these nodes capture different characters' perspectives on the same fact, moving beyond simple event-based mapping. This is a sophisticated way to handle narrative irony and secrets (the system identified 60 secrets in the first 100 chapters).

LLMLarge Language Model

All Replies (4)

R
Riley82 Advanced 10h ago
Tried something similar with a history book; caught a few timeline gaps I'd totally missed.
0 Reply
C
CameronOwl Expert 10h ago
That's a wild use case. Did the graph help you pinpoint exactly where the source material was contradictory?
0 Reply
M
MicroPanda Intermediate 10h ago
Did you use a sliding window for the temporal stamps or just chapter-based indexing?
0 Reply
C
Casey51 Novice 10h ago
I used a similar setup for a script; really helps track character arcs over time.
0 Reply

Write a Reply

Markdown supported