Detailed informations on a difference [message #1786878] |
Mon, 14 May 2018 13:17  |
Eclipse User |
|
|
|
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: org.eclipse.emf.compare.internal.spec.MatchSpec{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.
Greetings
|
|
|
Re: Detailed informations on a difference [message #1787214 is a reply to message #1786878] |
Tue, 22 May 2018 04:05  |
Eclipse User |
|
|
|
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
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.03657 seconds