Tuesday, April 22, 2008

DAG, versioning and an opportunity

Got a new task at hand.
Suppose I have evolving entities E1, E2 ... En in my system, each having assets from a group of A1, A2 ... An. Each of these entities can mutate but the historical relationships with the assets need to be preserved.
Each entity's assets can be determined by the has_many relationships.
E.g. E1 has a has_many relationship with A1, A2
Thus, when E1 1.0 mutated into E1 1.1, all related A1, A2 assets are copied over for E1 1.1
After copying over the inheritance, one can can add/subtract/update the assets.
E.g. E1 1.0 had attached A1 1.0 but had no item from the asset group A2. Now E1 1.1 was created, with parent as E1 1.0, therefore E1 1.1 now also inherits A1 1.0. Now, one should be able to add any available item from asset group A2, say A2 1.4
In other words, each of the entities (assets can also be generically be categorized as an entity for versioning), can be represented on a DAG or Directed Acyclic Graph. The DAG is how the entity evolves.
Lets see how I am able to deal with this situation.
Will I write something like act_as_dag? If I can that will be quite an achievement...

No comments: