Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » How to compare two "feature model" with EMF Compare(How to compare two "feature model" with EMF Compare)
How to compare two "feature model" with EMF Compare [message #1237065] Tue, 28 January 2014 19:32 Go to next message
Julio Sandobalin is currently offline Julio SandobalinFriend
Messages: 12
Registered: August 2013
Junior Member
Hi guys,

I done comparison of two models Ecore (m1.ecore and m2.ecore) successfully with EMF Compare 3.0. But, now I need compare two "feature model" (model.yafm - is generated with plugin from eclipse https://bitbucket.org/jpikl/yafmt/overview) with EMF Compare. I have this code:

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("yafm", new GenericXMLResourceFactoryImpl());
String string1 = "/path1/daigram.yafm";
String string2 = "/path2/daigram.yafm";
URI uri1 = URI.createFileURI(string1);
URI uri2 = URI.createFileURI(string2);
Resource resource1 = resourceSet.getResource(uri1, true);
Resource resource2 = resourceSet.getResource(uri2, true);
IComparisonScope scope = new DefaultComparisonScope(resource1, resource2, resource1);
Comparison comparison = EMFCompare.builder().build().compare(scope);
EMFComparePrettyPrinter.printComparison(comparison, System.out);


and I have this response:

Matched resources :
Left = file: /path1/daigram.yafm
Right = file:/path2/daigram.yafm

+----------------------------------------+----------------------------------------+----------------------------------------+
| Left | Right | Origin |
+----------------------------------------+----------------------------------------+----------------------------------------+
+----------------------------------------+----------------------------------------+----------------------------------------+

REFERENCE CHANGES

ATTRIBUTE CHANGES
value ecore.xml.type:text=
has been remotely deleted from attribute mixed of object
value group=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@2a13fd05 (mixed: [ecore.xml.type:text=
, feature=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@7bdb4020 (mixed: [], anyAttribute: [id=f_2056068678, name=son1, lower=0, upper=1]), ecore.xml.type:text=
, feature=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@70f951bb (mixed: [], anyAttribute: [id=f_1713913655, name=son2, lower=1, upper=1]), ecore.xml.type:text=
], anyAttribute: [lower=1, upper=1]) has been remotely deleted from attribute mixed of object
value ecore.xml.type:text=
has been remotely deleted from attribute mixed of object
value feature=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@64868d8 (mixed: [], anyAttribute: [id=f_1206774617, name=Hija, lower=1, upper=1]) has been remotely added to attribute mixed of object
value feature=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@68688e1c (mixed: [ecore.xml.type:text=
, feature=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@284a05d1 (mixed: [], anyAttribute: [id=f_849044402, name=New feature, lower=0, upper=1]), ecore.xml.type:text=
], anyAttribute: [id=f_1206774617, name=New feature, lower=1, upper=1]) has been remotely deleted from attribute mixed of object

CONFLICTS


I need to obtain the detail of the information with EMFComparePrettyPrinter.printMatch(comparison, stream). Is this possible? How I can do?
I don´t have any problem with ecore diagrams, but with other diagrams I can't obtain the correct answer.


Thanks in advance for your help.

Regards.
Re: How to compare two "feature model" with EMF Compare [message #1239921 is a reply to message #1237065] Wed, 05 February 2014 10:25 Go to previous message
Mikael Barbero is currently offline Mikael BarberoFriend
Messages: 55
Registered: July 2009
Member
Hi Julio,

Quote:
I need to obtain the detail of the information with EMFComparePrettyPrinter.printMatch(comparison, stream). Is this possible? How I can do?


I'm not sure I understand your question. I assume that the output of printMatch you got from the pretty printer does not satisfy you. Here is the explanation.

EMF Compare does not handle org.eclipse.emf.ecore.xml.type.AnyType very well. Also, I think that the GenericXMLResourceFactoryImpl creates models with Feature Maps which are not handled by EMF Compare.

To handle AnyType, you may have to create a custom equality helper as stated in the FAQ http://www.eclipse.org/emf/compare/doc/21/FAQ.html#Custom_data_types_are_always_marked_as_modified_by_EMF_Compare

For FeaturesMaps, it has to be implemented in the core engines. This is planned to be done after Luna.

Best.
Mikael
Previous Topic:How to compare UML models from code?
Next Topic:How to hide or combine Diffs in UI?
Goto Forum:
  


Current Time: Thu Mar 28 15:17:37 GMT 2024

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

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

Back to the top