EMF Compare/API MetamodelRequiresLink

From Eclipsepedia

Jump to: navigation, search

A reference 0..n has been added in the "diff" meta-model to manage dependencies between difference elements (DiffElement). This reference is named "requires". There is an opposite one which is named "requiredBy".

This reference may be used from different levels.

- The "requires" link is automatically filled in the generic EMF Compare core, deducing these dependencies from the dependencies between the model objects referenced by the difference elements.

It is considered that object 'A' depends on object 'B' if 'A' owns a reference to 'B' at least. The aim is to keep the integrity of the dependencies between model objects, after any partial merge process. So, if 'A' has to be copied during a merge action, its references to 'B' have to be copied too and, consequently, if 'B' does not exist in the target model, it has to be copied. In this case, the difference on 'A' will own a dependency to the difference on 'B', through the 'requires' link and the related A's merger will interpret this dependence to respect this "technical" rule.

Only two kinds of difference are concerned by the filling of this link: - The model element changes: It is the previous example. 'A' does not exist in one side of the comparison. - The reference changes: 'A' exists in the both sides but it is one of its references which changed (for example: from 'C' to 'B'). If 'A' is copied, 'B' must be copied too. The differences referenced by the "requires" link will always be a model element change of course (the presence of the related model objects condition the references integrity).

Below, a scheme to clarify these two cases: