Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare] Detecting supertype changes for the purpose of creating a common Ecore model
[EMF Compare] Detecting supertype changes for the purpose of creating a common Ecore model [message #667385] Thu, 28 April 2011 13:13 Go to next message
leonard.krpan is currently offline leonard.krpanFriend
Messages: 20
Registered: March 2011
Junior Member
Hello,

I'm processing a Diff of n Ecore models (I have extended EMF Compare so I can compare more than 2 or 3 and display results of all pairwise comparisons under the original model element). The idea behind this is to create a model which will contain data that is common to all compared models.

The classes of the common model are copies (EcoreUtil.copy) of classes from the oldest model, stripped of any class contents. The supertypes are references to the "real" classes in the oldest model and then later exchanged through classes from the common model, so that the common model has no references to any other models.

Right now processing superclasses of a class is giving me some headache. From what I figured out so far, three things can happen.

1) A superclass has been added if the supertypes list of the class from the old model is a subset of the supertype list of the class from the new model. Since in this case new information is added later than in the oldest model, I can just use the oldest models class' supertypes as the common ones.

2) A superclass has been deleted if the supertypes list of the new model class is a subset of the supertypes list of the old model class. In this case, if this change has occured later than in the second oldest model, I cannot directly take the rightTarget, which is the superclass in question, but I have to match the class from this model all the way back to the same class in the oldest model and then delete it from it's superclass list (I have implemented a mechanism that does that, otherwise the references don't match because eventhough the same class is meant semantically, they are in two different models and hence two different objects).

3) Now the one causing some trouble. Say a class only has one supertype. If this supertype is deleted and at the same time another supertype is added, this can be seen as a supertype change. In this case, instead of stripping the class from it's original supertype, I could use the nearest common supertype as the new one. So far so good.

But, what if I have a whole bunch of new classes that are not present in the other one? If I have a situation like this:

ST1 (X, C, B, A)
ST2 (Y, Z, C, B, A)

or

ST1 (X, W, C, B, A)
ST2 (Y, Z, C, B, A)

how can I tell if X/W has changed to Y/Z (latter example) or if Y or Z has been added (former example)? One possible solution I thought of is to count the supertype depth between all classes that don't appear in both models and then say for the closest pair they have "changed", and that the further one was "added".

Thanks for any thoughts and suggestions on this!
Re: [EMF Compare] Detecting supertype changes for the purpose of creating a common Ecore model [message #667825 is a reply to message #667385] Mon, 02 May 2011 11:05 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Seems to me like you're going on quite unsteady ground ...

Were I in your case, I don't think I'd consider "supertype change" : a supertype is either added or removed. If you have Class A implements B in model 1, and class A implements C in model 2, then you consider two changes : "B has been removed from supertypes" and "C has been added to supertypes". I believe that would simplify your problem.

The only case in which I would consider a "change" to a supertype ... is if the supertype itself holds the change : if you have renamed "B" to "C" from one version to the next, then the actual change is not in the supertypes, but in the Class "B" : "name has changed from B to C". and class "A" in this case holds no change whatsoever : it still has the same supertype, even if the supertype changed name.

Laurent Goubet
Obeo

Previous Topic:[EMF compare] ignore the comparison of an attribute by its value
Next Topic:[Teneo/Hibernate] Logging configuration not working
Goto Forum:
  


Current Time: Thu Apr 18 12:49:55 GMT 2024

Powered by FUDForum. Page generated in 0.01962 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top