Home » Modeling » EMF » EMF Compare - ADD / DELETE differences list(EMF Compare Differences List Unpredictable)
|
Re: EMF Compare - ADD / DELETE differences list [message #1815990 is a reply to message #1815968] |
Wed, 16 October 2019 15:24 |
|
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 |
Kirti Mahajan 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 74 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 |
|
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 |
Kirti Mahajan 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 |
|
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 #1816227 is a reply to message #1816188] |
Thu, 24 October 2019 12:25 |
|
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
|
|
| |
Goto Forum:
Current Time: Mon Sep 23 13:37:48 GMT 2024
Powered by FUDForum. Page generated in 0.04354 seconds
|