Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » EMF compare does not work?
EMF compare does not work? [message #1777789] Mon, 04 December 2017 16:14 Go to next message
Jim 20100 is currently offline Jim 20100Friend
Messages: 69
Registered: June 2016
Member
Hi,

I have my own EMF model.
In my RCP application, I just created a model 1.
Copy Paste my model 1 to model 2.
Change one simple name property of my Building object in the model 2.

You can see the comparison result:
instead of finding the attribute modification, EMF Compare found an addition and a deletion of the building.
I suppose there is a solution?

Jim
Re: EMF compare does not work? [message #1777836 is a reply to message #1777789] Tue, 05 December 2017 08:41 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1857
Registered: July 2009
Senior Member
Hi,

If your model has no identifier, EMF Compare tries to match elements using metrics to compute the "similarity" between your elements. In this case, the two Building objects are too different to match, so EMF Compare doesn't see them as being "the same" and you get an add and delete differences.

You will have to either make sure your models use identifiers or customize the proximity engine for your needs if it doesn't work for you.

Laurent Goubet
Obeo
Re: EMF compare does not work? [message #1777842 is a reply to message #1777836] Tue, 05 December 2017 09:12 Go to previous messageGo to next message
Jim 20100 is currently offline Jim 20100Friend
Messages: 69
Registered: June 2016
Member
Thank you Laurent,

I finally used identifiers, but it is not very convenient for me. I would like to customize the comparison.

For the moment I used this:

public class XMIResourceImpl extends org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl {

public XMIResourceImpl() {
}

public XMIResourceImpl(URI uri) {
super(uri);
}

@Override
protected boolean useUUIDs() {
return true;
}
}


My 2 problems:
1. When I copy paste my building from one EMF File to another one, ID are not the same.

2. In some case I don't want to use unique ID.
Imagine my building has a child called BuildingDescription
such BuildingDescription node should be compared whatever the ID.

Maybe I could by myself generate the ID for each class? sometimes it could be generated automatically and sometimes it could be fixed in my code.

But how to achieve?
Do you have doc or?











Re: EMF compare does not work? [message #1777862 is a reply to message #1777842] Tue, 05 December 2017 13:07 Go to previous messageGo to next message
Jim 20100 is currently offline Jim 20100Friend
Messages: 69
Registered: June 2016
Member
Finally, if I undertand, there is an ID checkbox that can be used in the model for matching entities in the compare process.

Can you validate that the attribute checked as ID is used?
What about multiple checked ID?
What about subclass with another attribute checked as ID?


But I have another problem now.

When the order is not the same, the differences in the children are not detected.

Example
Quote 1
Building toto, quantity: 1
Beam beam 1, quantity: 1
Building titi

Quote 2
Building titi
Building toto, quantity: 2
Beam beam 1, quantity: 3


The compare result finds:
1. building toto has moved
2. building toto quantity has changed

It does not detect:
beam 1 quantity has changed.

When the order is not changed, then the compare detects correctly changes in the children.
Why?







Re: EMF compare does not work? [message #1779233 is a reply to message #1777862] Thu, 04 January 2018 09:07 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1857
Registered: July 2009
Senior Member
Hi,

The results you're describing here don't really make sense. The "move" detected by EMF Compare should be "titi" and not "toto". The quantity change should be detected nonetheless unless you have changed he feature filter somehow? Could you provide us with the models you're using so that we could try and check what's happening here?

Laurent Goubet
Obeo
Previous Topic:[EMF COMPARE] Apply diffs between two objects in a third one
Next Topic:Disable model resolver for certain file type
Goto Forum:
  


Current Time: Sun Jun 24 21:02:29 GMT 2018

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

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

Back to the top