cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Seeking model design suggestions to ensure immutability, full record of changes

snellad1
Node Link

Hi,
I require the archival/immutable record in neo4j of all changes to nodes and relationships between nodes.
For example: 1) when properties of existing node(s) need modifying, and 2) when relationship(s) between existing nodes are changed

Here is what I've thought of so far, would love to hear any feedback / suggestions you may have;

Case 1 - node property change
Consider this: A House has a Room with windows and doors. (House)-[:HAS]->(Room)
In this example I need to change the number of doors from 1 to 2, and to have a record of the change.
My idea:
2X_8_8b8831719283a758a5a61ed5ac6c48e4523f7e54.png

I would create a new node with updated properties; include MODIFIED_BY and PRECEDED_BY relationships; replace HAS to HAD; create HAS to new node.

How would you do it?

Next case - When you need to replace an object node with another, existing node

Let's say we have 2 houses, and both owners decide to swap and sell their houses to each other:
2X_f_f525cfd15271f24d2772643247d03bf425b8926f.png

Therefore I would need to change house 10 OWNED_BY Bob, and 12 by Fred.
What's the best way to include the history of the change in this case?

Many thanks for your feedback!

2 REPLIES 2

Thank you! I had not seen this blog post before.