Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Detailed informations on a difference(get programmatically location of difference reffered to the models)
Detailed informations on a difference [message #1786878] Mon, 14 May 2018 17:17 Go to next message
Viktoria Fink is currently offline Viktoria FinkFriend
Messages: 12
Registered: May 2016
Junior Member
I probably know the answer already but to make sure I still need to ask.

I have three models:

Model_1: Origin (petri like metamodel)
Model_2: M2M Transformation of the origin (structure text metamodel)
Model_3: Changed Model_2

I compare Model_2 and Model_3 programmatically to get the differences so I can update Model_1. I don't have any identifiers I can compare or relate to. The structured text model is very fragmental and many differences might be only one according to the petri like metamodel. To gain the information for the update I need to know where the difference is e.g. neighbours, parents, root.

With eContainer I get at least the objects above but in this manner:{left=While@3540d5e3,right=While@5ddd3150,origin=<null>,#differences=0,#submatches=12}

Now to get to my question: Is there a possible way to get more information programmatically on the location of the difference referred to the compared models? As I can see the emf compare editor must have access to those informations too else the representations would be a failure.


Re: Detailed informations on a difference [message #1787214 is a reply to message #1786878] Tue, 22 May 2018 08:05 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1900
Registered: July 2009
Senior Member
Hello Viktoria,

All information should be available to you from the Comparison model, but how to exploit it will really depend on your use case. The "Diff" elements wil usually point to the changed element, in the changed model. for example a diff of kind "ADD" and source "LEFT" will point as its "value" to the new element that was added in the left model (however, a diff of kind "REMOVE" and source "LEFT" will point as its value to the old value that was removed from the left, and that "old value" is located in the origin model, which will be the common ancestor in three way comparisons and the right model otherwise).

The "Match" elements you get with "eContainer" on differences are the matches between right, left and ancestor that we've been comparing. The containing "Match" of a difference is the element inside which something changed : if the value of a reference has been changed, then the Match is the element holding the reference... but for ADD and REMOVE on containment references, you have to remember that the containing match is the element "containing" the added or removed element.

I can point you towards the right way of finding location information if you have specific questions, but you'll have to start experimenting to see what exactly you're missing so that I can help you.

Laurent Goubet
Previous Topic:Unsettable Features
Next Topic:Model compare with files in SVN - RCP Application
Goto Forum:

Current Time: Tue Aug 09 11:47:42 GMT 2022

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

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

Back to the top