nodestream-proj / nodestream

A Declarative framework for Building, Maintaining, and Analyzing Graph Data
https://nodestream-proj.github.io/docs/
Apache License 2.0
36 stars 11 forks source link

Support Temporal Versioning #282

Open zprobst opened 5 months ago

zprobst commented 5 months ago

Is your feature request related to a problem? Please describe.

Versioning allows us to keep track of change by querying over a range of time and assess the database's current state at various points in time. This allows for useful operations such as what-if analysis.

Describe the solution you'd like

Ideally, nodestream can introduce a change that allows for versioning of nodes and relationships to happen. From a developer perspective, you could do something like this:

Relationship Versioning Nodestream Temporal Versioning Schema (1)

Relationship versioning can be accomplished by changing the relationship type of from RELATED_TO to OLD_RELATED_TO. Each relationship established can be assigned with a from property that represents the point in time that the relationship was established. When a relationship is expired, we can add the OLD_ prefix and set a to timestamp that established the point the relationship was desolved. NOTE this varies from other versioning schemes by establishing the OLD_ prefix, which allows "current state" queries to remain unchanged.

Node (Property) Versioning Node versioning can be obtained easily on top of relationship versioning. Each state change is represented as a new version node where the current state is both on the actual entity node as well as the latest version. This allows you to match an entity and then retrieve its current state at that time. Similarly, nodes that are expired can be via the Old prefix such as OldNodeType.

Nodestream Temporal Versioning Schema

Describe alternatives you've considered

There are several other possible alternatives to the temporal versioning itself.

Prior Art