Project

General

Profile

CdmVersioning » History » Version 6

Markus Döring, 02/28/2008 10:46 AM

1 1 Markus Döring
{{>toc}}
2
3
4
5
6
# CDM Versioning
7
8 3 Markus Döring
The [[CdmLibrary]] is supposed to support versioning of CDM data. The simplest approach to create a new version would be to copy every _current_ object in the CDM and leave the old ones untouched. This would effectively mean a copy of the entire database for every single version, because nearly all objects in the CDM are related to each other in some ways. Obviously this is not a scalable solution. We will have to address versioning therefore on the atomic domain objects. The following graphic shows the complexity and dependencies of a single change to a Person in the CDM:
9 1 Markus Döring
10
11 2 Markus Döring
![](version_complex_objects.png)
12 1 Markus Döring
13
14 4 Markus Döring
## Version In Time. A View
15 1 Markus Döring
16 4 Markus Döring
For a single point in time a consistent complex object can be assembled based on the multiple versions stored. The following example shows different versions of a taxon made up of a name that in turn is based on an author. ????
17
18
19
tbd
20
21
22
23
## Versioning = Denormalisation?
24
25
A new version of an object will not automatically be applied to all other previously related objects. A modified name will therefore not be applied to all taxa using that name without manual interaction, i.e. agreement from the user that owns the other taxon.
26
27
28
Versioning and this non-automatic propagation of updated objects therefore leads to very similar effects as denormalisation. With the exception that there is a clear link between the versions so an automatic update _could_ be done at any time.
29
30
31
32
## Accessing versions. DAO Implementations
33
34
 **Just notes so far. Need to be cleaned.** 
35
36
37
It would be elegant to implement versioning entirely outside of the domain model, only in the Data Access Objects (DAOs).
38
39
40
Access to the latest version should be the default and as fast as possible.
41
42
43
Historic versions can and maybe even should be read-only.
44
45
46
Domain class methods like _getTaxonName()_ should not need to know (i.e. have a parameter) which view they are working on. If a taxon has different name versions in time, how does the taxon object know which to return? The method would have to accept a view parameter or store the view in the taxon object. But as the identical, persistent taxon object is used for several views, it cannot be stored in the persistent taxon object.
47
48
49 5 Markus Döring
It therefore seems best to create transient copies of historic versions and only allow the current view to be persistent, i.e updateable. The assembling of such _transient deep copies_ would have to be done in the DAO layer. As those copies are transient, the complex object boundaries have to be defined as part of the DAO method too, as no further lazy loading will be possible. Domain method calls to related objects which were not immediately loaded will get NULL!
50 4 Markus Döring
51
52
53
54
## Changes To Datamodel
55
56
57
### Many-Many Relations
58
59
This solution modifies the referencing side of a domain model and keeps a list of all versions for a certain property. That means converting all properties to lists or adding an additional list property for each existing property.
60
61
62
It allows for relatively fast database access to a complex object view.
63
64
65
It means a lot of extra coding, as all properties have to be duplicated and probably regular setter/getter methods have to be adapted.
66
67
68
69
### Linked Lists
70
71
72 1 Markus Döring
### Version Array
73 5 Markus Döring
74
75
76
## Unversioned CDM Classes
77
78 6 Markus Döring
Parts of the [[CommonDataModel]] would not need to be versioned. This probably applies to Cdm:common:DefinedTermBase and all relationship classes that currently do not inherit from a common superclass (but probalby should).