Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316819 - Computing matches for scope-external references fails if ID or XMI_ID based comparison is used.
Summary: Computing matches for scope-external references fails if ID or XMI_ID based c...
Status: CLOSED FIXED
Alias: None
Product: EMFCompare
Classification: Modeling
Component: Core (show other bugs)
Version: 1.1   Edit
Hardware: All All
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: EMF Compare CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-14 16:04 EDT by Alexander Nyßen CLA
Modified: 2011-08-09 04:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nyßen CLA 2010-06-14 16:04:11 EDT
EcoreIDSimilarityChecker and XMIIDSimilarityChecker are based on proper initialization to return correct results within their isSimilar and absoluteMetric methods. That is, these methods can only match EObjects properly, if they have been initialized with the containing resource (or an ancestor object).

When comparing two resources within GenericMatchEngine, the checker is thus initialized within the doMatch method, passing in the two local resources that are to be compared. This is pretty fine when computing matches for the EObject contained in these resources. 

However, it does not suffice when computing scope-external reference within GenericMatchEngine#recursiveMappings. That is, all EObjects contained within current1ScopeExternalReferences and current2ScopeExternalReferences, which are not directly contained in the two compared resources, will not be matched properly by the delegating call to the checker if ID or XMI_ID based comparison is used. As such, a lot of dummy changes are reported for those references to outside the compared resources in this case.

To fix this issue, the checker could alternatively be initialized with the containing resource sets of the two resources to be compared.
Comment 1 Tatiana Fesenko CLA 2010-08-06 10:20:12 EDT
I am investigating features of EMF Compare to use it in my works. Thank you the work done in this project and for good developer guides.

However, I faced the following problem:
Create a UML model, create a Class in it.
Apply any profile and stereotype. Say, Standard profile and Standard::Metaclass stereotype to the root package and the Class respectively. Make any other change - e.g. add a new elemene. Compare the model in local history - the following diff will always be displayed in addition to actual changes: 
-"standard has been added to reference references: EObject in UML"
-"standard has been removed from reference references: EObject in UML"
I tries both comparison options - "Selected resource only" and "Complete resource set"

As I understand I have the same problem as described in this bug.
If so, could you tell me what are chances that this bug will be fixed soon?
Possibility to correctly process models contaning stereotypes is crucial for me. 
Thank you.
Comment 2 Laurent Goubet CLA 2010-08-09 04:22:29 EDT
Hi Tatiana,

Our working time on EMF Compare is pretty scarce, and fixing this bug isn't a priority for us. If it is critical to you, you can always write a patch according to Alexander's comment in order to fix the issue and attach it to this bug; we'll be more than happy to review and commit the patch for the next build.
Comment 3 Laurent Goubet CLA 2011-06-15 10:29:28 EDT
Alexander,

Could you provide us with a small unit test (or minimal ecore files with which I can reproduce this) so that I can debug and see (and fix :p) what's happening here?

Tatiana,

we now provide an UML-specific comparison engine that should take care of the issue you describe here.
Comment 4 Laurent Goubet CLA 2011-08-09 04:31:58 EDT
The match, diff and merge process have seen a great deal of improvement in the past weeks, with the addition of unit tests for most of the different use cases (one use case = one possible "diff" between models) we could think of.

The particular issue of dummy changes with scope-external EObjects is one of the things that has been tested and fixed; without further info about the models on which you had comparison problems, I'll assume the problem is resolved.

These changes have been pushed on both master and the 1.2 maintenance stream. They are available in the builds
 - 1.2 integration : I201108090404
 - 1.3 integration : I201108090415