|Re: EMF Compare Documentation [message #1008163 is a reply to message #1008143]
||Mon, 11 February 2013 08:39
|| Laurent Goubet
Registered: July 2009
If you are comparing models programmatically and wish to understand the differences between merging them, then indeed, the wiki is far from complete on this aspect. You will have to delve a little deeper within the code to understand what's going on. A very concise description of each concept can be found in the metamodel itself as annotations attached to the different elements (see org.eclipse.emf.compare/model/compare.ecore).
Basically, the Comparison object acts as the root of the comparison, it is created at the very beginning of the comparison process and will be further refined by the subsequent phases. It contains Match elements that act as the bridge between the compared models (A in left corresponds to A' in right). Under each Match are other Match elements to mimic the "tree" structure of the input models... but more importantly they contain Diff elements that represent the actual differences (A renamed to A'). These are the elements of the Comparison that are important for you.
Diff can be of three kind : ResourceAttachmentChange, ReferenceChange and AttributeChange. The latter two are self-describing, the first should be quite rare except if you're using fragmented models.
- ResourceAttachmentChange differences describe changes on the roots of Resources. Creating a new root, deleting a root, controlling an element (creating a fragment through the Right-click > Control... action in the ecore editor) or un-controlling an element will all result in differences of that kind. The element that changed is the parent Match of that diff.
- ReferenceChange differences are changes on elements' references. Adding (or removing) an element in (or from) a multi-valued reference, (un)setting a mono-valued reference, moving an element (the "reference" in this case is actually the containment reference...) all result in differences of that kind. The parent Match of the Diff is the object for which one of the references as changed, the value of the Diff represents the element that actually changed within that reference (it was added, deleted, or moved).
- AttributeChange differences are exactly the same as ReferenceChanges ... but for attributes instead of references.
Other than the differences, the Comparison object can contain a number of associations :
- A Conflict represents a conflict between two or more differences. For example, removing A from the left model, but renaming A to A' in the right (as compared to their common ancestor) results in a conflict. Conflicts can be of two kind : REAL conflicts are the conflicts that cannot be automatically resolved (such as the example given above) while PSEUDO conflicts can be automatically merged. An example of the latter is if you delete A from both left and right model (as compared to their common ancestor). Conflicts can only be detected when comparing three models.
- An Equivalence relation links together differences that will all be resolved when we merge one of them. This is mostly the case for Ecore's eOpposite references : if I merge a difference on one reference, its eOpposite will automatically be updated. That's what we call equivalences.
This is very concise, but should explain the basis of what information the Comparison model holds. I cannot take the time on the forum to detail much : you will have to wait for us to write the whole documentation and fill the wiki. Do not hesitate to ask more precise questions though.
Powered by FUDForum
. Page generated in 0.02411 seconds