Skip to main content

Module temporal

Module temporal 

Source
Expand description

Temporal knowledge graph — edges with validity periods.

Provides bi-temporal edge tracking: each edge carries a valid_from / valid_to validity interval. Adding a new edge for the same (from_id, to_id, relation) triple automatically closes the previous open interval so the graph stays consistent.

Structs§

GraphDiff
Summary of how the graph changed between two timestamps.
TemporalEdge
A directed edge in the temporal knowledge graph.

Constants§

CREATE_TEMPORAL_EDGES_TABLE
SQL that creates the temporal_edges table and its supporting indexes.

Functions§

add_edge
Add a new temporal edge.
detect_contradictions
Detect edges that share the same (from_id, to_id, relation) triple and have overlapping validity periods — which should not exist under normal operation.
diff
Compare the graph state at two different timestamps.
invalidate_edge
Set the valid_to timestamp on an existing edge, effectively closing it.
relationship_timeline
Return the complete edit history for a (from_id, to_id) pair, ordered chronologically (valid_from ASC, then created_at ASC).
snapshot_at
Return all edges that were valid at timestamp.