Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Compare - ADD / DELETE differences list(EMF Compare Differences List Unpredictable)
EMF Compare - ADD / DELETE differences list [message #1815968] Wed, 16 October 2019 11:05 Go to next message
Kirti Mahajan is currently offline Kirti MahajanFriend
Messages: 11
Registered: October 2019
Junior Member
We are comparing 2 versions of the same file using EMF compare.
The one version (current version) of the file have differences from other version (older) in terms of addition or deletion.
If we add specifications at the start of the file or in between, then EMF compare shows many differences than actual in "ADD" kind.
Whereas if we add specifications at the last, then EMF compare shows exact differences as actual.
Similarly for delete functionality.
If we delete specifications from the start of the file or from anywhere in between, then EMF compare shows many differences than actual and
those are also not in proper sequence. It is very difficult to analyse the exact deletion from the file.

Is this related to some existing bug in EMF Compare? All kind of suggestions/solutions are welcomed.
Re: EMF Compare - ADD / DELETE differences list [message #1815990 is a reply to message #1815968] Wed, 16 October 2019 15:24 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello,

I will assume that your "specification" elements have identifiers, and that you are not ensuring that the identifiers stay stable between the version of your models. In such a case, EMF Compare cannot match the elements from the left version with the elements from the right version, and every single one of them appears as "added" or "deleted".
You have to make sure that your identifiers are stable and not dependent on the index in their containing reference.

If this is not your issue, I will need more information about your models to know why your elements are not matched. In such a case, please try and share sample models with which we could reproduce.

Laurent Goubet
Obeo
Re: EMF Compare - ADD / DELETE differences list [message #1816022 is a reply to message #1815990] Thu, 17 October 2019 13:17 Go to previous messageGo to next message
Kirti Mahajan is currently offline Kirti MahajanFriend
Messages: 11
Registered: October 2019
Junior Member
Hello,

Thank you for your quick response.
I am not sure, if I have correctly understood the word "identifiers" you are referring to. I assume that identifiers are Ecore classes which are used/referred in resources while defining the specifications.
Here is the sample Ecore model and the resource file (runtime).


commands
{ set_gablo_8 8 [ hwId = 1 , cmdPkt = 2 , PrivilegeId= 2 , PrivilegeName= gab_engineer_write , PrivilegeId= 1 , PrivilegeName= lmc_engineer_write , long Lo_Freq_Ch_1 = 600000 , long Lo_Freq_Ch_2 = 600000 ]
set_gabconf_9 9 [ hwId = 101 , cmdPkt = 2 , PrivilegeId= 2 , PrivilegeName= gab_engineer_write , PrivilegeId= 1 , PrivilegeName= lmc_engineer_write , float Attn_Ch_1 = 10.0 , float Attn_Ch_2 = 10.0 ]
set_gabconf_10 10 [ hwId = 2 , cmdPkt = 1 , PrivilegeId= 2 , PrivilegeName= gab_engineer_write , PrivilegeId= 1 , PrivilegeName= lmc_engineer_write , long Lo_Freq_Ch_1 = 600000 , long Lo_Freq_Ch_2 = 600000 , float Attn_Ch_1 = 10.0 , float Attn_Ch_2 = 10.0 , short I_P_Mode1_Ch_1 = 0 ]
set_lo_51 51 [ hwId = 2 , cmdPkt = 1 , PrivilegeId= 2 , PrivilegeName= gab_engineer_write , PrivilegeId= 1 , PrivilegeName= lmc_engineer_write , long Lo_Freq_Ch_1 = 600000 , long Lo_Freq_Ch_2 = 600000 ]
set_noise_52 52 [ hwId = 2 , cmdPkt = 1 , PrivilegeId= 2 , PrivilegeName= gab_engineer_write , PrivilegeId= 1 , PrivilegeName= lmc_engineer_write , short I_P_Mode1_Ch_1 = 0 , short I_P_Mode1_Ch_2 = 0 ]
set_mixer_53 53 [ hwId = 2 , cmdPkt = 1 , PrivilegeId= 2 , PrivilegeName= gab_engineer_write , PrivilegeId= 1 , PrivilegeName= lmc_engineer_write , short Mixer_Direct_Path_Ch_1 = 0 , short Mixer_Direct_Path_Ch_2 = 0 ]
setShutdown_109 109 [ hwId = 0 , cmdPkt = 0 , PrivilegeId= 2 , PrivilegeName= gab_engineer_write ]
}


In the above code, if I add new command in between or at start then differences generated are more than actual. Similarly for delete as explained in above comment.
We are generating differences using below code snippet:
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("mpogo", new XMIResourceFactoryImpl());
		var Notifier note1 = modelInst;            / / current version of a file where we are adding or deleting the specifications
		var Notifier note2 = modelInstOld;    // older version of a same file 
		var IComparisonScope scope = new DefaultComparisonScope(note1, note2, note2); // EMFCompare.createDefaultScope(note1,note2)// 
		var Comparison comparison = EMFCompare.builder().build().compare(scope);
		var List<Diff> differences = comparison.getDifferences();


Hope this is giving clear idea of the issue we are facing.

  • Attachment: Ecore.JPG
    (Size: 61.56KB, Downloaded 59 times)

[Updated on: Thu, 17 October 2019 13:19]

Report message to a moderator

Re: EMF Compare - ADD / DELETE differences list [message #1816050 is a reply to message #1816022] Fri, 18 October 2019 06:57 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello,

Please share your metamodel file (mpogo.ecore) as well as the two files you're comparing (modelInst and modelInstOld in your code) so that I can try and compare them to reproduce this on my side.
Though I see an xtext file opened on your screenshot so I'll also mention that EMF Compare has a lot of trouble comparing xtext models so there is a chance this is the issue here.

Laurent Goubet
Obeo
Re: EMF Compare - ADD / DELETE differences list [message #1816057 is a reply to message #1816050] Fri, 18 October 2019 09:35 Go to previous messageGo to next message
Kirti Mahajan is currently offline Kirti MahajanFriend
Messages: 11
Registered: October 2019
Junior Member
Hello,

I can not share the Ecore model with you.
I have attached a sample file here. In this file, if I add a new command or delete in between command then compare results are more.
This attached file is taken as model instance and two model instances are compared.

I don't know if just this file is sufficient for your testing. Otherwise if you have any sample Ecore model and can reproduce similar scenario then that would be helpful.

[Updated on: Fri, 18 October 2019 10:50]

Report message to a moderator

Re: EMF Compare - ADD / DELETE differences list [message #1816094 is a reply to message #1816057] Mon, 21 October 2019 07:43 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello,

This is not sufficient for me to reproduce on my side, but it does confirm me that your models are xtext files. EMF Compare cannot compare xtext models properly as they do not have identifiers and the uris are dependent on the index of the objects in their containers and their names (or more accurately, their textual representation). Last year, we pushed changes to EMF Compare to enhance our handling of xtext resources a little (you have to use version 3.3.4 of EMF Compare at least for this to be effective), but you will still most likely have to implement specific matching rules for your objects.

Please look at the org.eclipse.emf.compare.match.eobject.EqualityHelperExtensionProvider class and its associated extension point org.eclipse.emf.compare.rcp.equalityHelperExtensionProvider .

Laurent Goubet
Obeo
Re: EMF Compare - ADD / DELETE differences list [message #1816188 is a reply to message #1816094] Wed, 23 October 2019 10:37 Go to previous messageGo to next message
Kirti Mahajan is currently offline Kirti MahajanFriend
Messages: 11
Registered: October 2019
Junior Member
Hi, I have created a sample Ecore model and Xtext for creating the similar scenario. I have attached the zip folder of the code.
Here differences are not generated in similar way that I am facing. But some null differences are occurring. So exact scenario I am not able to replicate as I am facing with my model. May be this is much simpler model than our model.
You can make the model more complex and try to generate differences.

Re: EMF Compare - ADD / DELETE differences list [message #1816227 is a reply to message #1816188] Thu, 24 October 2019 12:25 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

Please also provde the sample mydsl files with which you "don't generate differences in similar way" as I don't see them in this folder.

In any case, I believe you will have to look at the extension point I pointed at in my earlier message as comparing xtext files requires additional logic that EMF Compare cannot know as a generic tool. Depending on your project, you might be interested in contacting Obeo directly to get more advanced support on the details of comparing xtext files with EMF Compare.

Regards,

Laurent Goubet
Obeo
Re: EMF Compare - ADD / DELETE differences list [message #1816739 is a reply to message #1816227] Wed, 06 November 2019 06:59 Go to previous message
Kirti Mahajan is currently offline Kirti MahajanFriend
Messages: 11
Registered: October 2019
Junior Member
Hi,

I attached .mydsl file. This file is not more complex but we got extra differences in this file also.
  • Attachment: shop.mydsl
    (Size: 0.86KB, Downloaded 60 times)
Previous Topic:genmodel problems
Next Topic:Formatter2 - QualifiedName formatted with spaces between delimeter
Goto Forum:
  


Current Time: Thu Apr 18 09:36:06 GMT 2024

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

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

Back to the top