EMF Compare - two equivalent updateReference seen as different [message #1155088] |
Fri, 25 October 2013 17:32 |
d 627 Messages: 28 Registered: March 2013 |
Junior Member |
|
|
Hi
I got a question about the what is seen as an updatereference in emfCompare. I am comparing two different models and among other results, I am having some references indicated as a change but these have not been touched from one model to other.
The results look like this:
Reference classifier in ClassA changed from xxxx.EClassImpl@xxx (name: StringConstant) (instanceClassName: null) (abstract: false, interface: false) to xxxx.EClassImpl@xxx (name: StringConstant) (instanceClassName: null) (abstract: false, interface: false)
As you can see there is not, at least in this case, any change.
During the analysis there were 87 updatereferences indicated but some of them obviously were the same. So it was necessary to do this:
EObject compare;
.........
if(compare instance of UpdateReference){
UpdateReference obj = ((UpdateReference)compare);
if(!(obj.getLeftElement().equals(obj.getRightElement()))){
System.out.println("The real different updatereference are " obj);
}
In this way it was possible to reduce the number of updatereference to 26 and using the ECoreutil.equals method this number decreased to 7, 3 of these references are obviously different but the other 4 seem to be the same from the point of view of the attributes. The question is, what EMFCompare use to make the comparision between to references to indicate a change?, and how it is possible see this values in order to understand which ones among them are generating this output.
Regards
[Updated on: Tue, 29 October 2013 17:24] Report message to a moderator
|
|
|
Re: EMF Compare - two equivalent updateReference seen as different [message #1162320 is a reply to message #1155088] |
Wed, 30 October 2013 09:46 |
|
Hi,
As has been told before, "equals" cannot be used on EObjects to determine equality or inequality, especially between two models that are considered to contain differences. An EObject which name is "Magazine" might very well be the same as an EObject named "Book" but with a super-type "Periodical" added to it. This is only false when the EObjects have identifiers, in which case they can be used to determine mappings.
EMF Compare 1 "equality" between EObjects is determined through a number of metrics, and you'll have to look at them in order to determine what to change (see also the FAQ answer). You'll have to override the GenericDiffEngine's 'ReferenceCheck' if your method of computing differences is to be different (or if some features have to be ignored).
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.02108 seconds