Hi,

I have also built some versioning concept on Neo before.

Essentially, my solution is based on two kinds of objects:

- VersionedObject represents the identity of something. It references
ObjectVersions.
- ObjectVersion represents a version of the object, there can be many
and they point to their previous version for easier lookup
- an ObjectVersion contains the properties. If there are relationships,
they always point from an ObjectVersion to the target VersionedObject
- ObjectVersions belong to Revisions, each revision has a revision
counter and additional information (who changed what when and why).
- there is a global object that holds the current revision counter

In my system, revisions are created automatically with every transaction
commit, so the actual versioning is completely hidden from the developer
that works with the domain objects.

Using the revision counter, you can easily select arbitrary versions:
- for latest version, take the ObjectVersion with the maximum counter
- for some historic version, take the ObjectVersion with the maximum
counter that is smaller or equal the wanted revision counter.

New object version are created on every change of a versioned object,
e.g. by setting a property or by creating a relationship. If the object
had an existing version before, the properties and relationships will be
copied to the new version.

I have used this concept to build both a linear history of objects and a
more complex versioning system with branches. If you need branches, you
need some more things to consider, but it can be done as well.


HTH,
Peter


> Anyone have an idea on how to model the history management in a case
> like this? You don't need to put too much focus on the actual
> structure, I just want to get at a structure for capturing the change
> history for the relationships in between entities.
> 
> Thanks,
> --
> Tobias Ivarsson <[email protected]>
> Hacker, Neo Technology
> www.neotechnology.com
> Cellphone: +46 706 534857
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to