CIP2026-03-18: Temporal Graph Queries — AS OF Clause#584
Open
ADunfield wants to merge 1 commit intoopencypher:mainfrom
Open
CIP2026-03-18: Temporal Graph Queries — AS OF Clause#584ADunfield wants to merge 1 commit intoopencypher:mainfrom
ADunfield wants to merge 1 commit intoopencypher:mainfrom
Conversation
Proposes FOR VALID_TIME AS OF / AS OF clause for MATCH patterns, enabling point-in-time queries over temporally-annotated relationships without verbose manual IS NULL OR predicate patterns. Aligned with SQL:2011 valid time semantics. Includes EBNF grammar additions, point-in-time predicate specification, six Cypher examples, comparison with SQL/SPARQL/graph systems, benefits, caveats, and a Phase 1 parse-time rewrite rule (no storage layer changes required). Reference implementation (3.1M+ relationships, production-validated): https://github.com/DIGITAL-FABRIC-AI/neo4j-temporal-graph Authored-by: Ashley Dunfield <ashley@digital-fabric.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This CIP proposes a
FOR VALID_TIME AS OFclause (shorthand:AS OF) for CypherMATCHpatterns, enabling point-in-time queries over relationships annotated with valid time periods.Motivation
Temporal data — ownership changes, organisational structures, regulatory assignments, contract periods — is ubiquitous in graph modelling. Cypher has no native syntax for querying a graph as it existed at a point in time. Today, developers must write manual
IS NULL ORpredicates on every relationship hop, producing verbose, error-prone, and optimiser-opaque queries.A three-hop temporal traversal today requires six predicates. This CIP reduces it to a single
AS OFclause.Proposed syntax
Full EBNF, semantics, six examples, SQL:2011 alignment, and a Phase 1 parse-time rewrite rule (no storage changes required) are in the CIP document.
Reference implementation
A working implementation demonstrating these semantics as Neo4j procedures and user functions, validated on a production graph with 3.1M+ temporally-annotated relationships:
https://github.com/DIGITAL-FABRIC-AI/neo4j-temporal-graph
Prior art
Aligned with SQL:2011
FOR VALID_TIME AS OFsemantics, adapted for Cypher's relationship-centric data model.Author: Ashley Dunfield ashley@digital-fabric.com