CIP2026-03-18: Temporal Graph Queries — AS OF Clause#584
CIP2026-03-18: Temporal Graph Queries — AS OF Clause#584ADunfield 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>
|
Hello Ashley, Thank you very much for this interesting proposal. As you can see on the openCypher website, "with ISO/IEC 39075 GQL, the purpose of openCypher is to pave the road to GQL for openCypher implementers. Changes to openCypher are made by adding GQL features to openCypher." Unfortunately, your CIP does not propose functionality standardized in GQL at this point. The route for adding functionality to openCypher is to contribute ISO/IEC 39075 GQL, which you can do by joining your national standards body. The ISO/IEC JTC1 SC32 WG3, the working group responsible for GQL, has an open Language Opportunity — think of a backlog item — for bi-temporal support. However, there is a significant amount of work required to make the happen, even with the SQL precedence, so that no one has picked it up yet. Thanks + Best |
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