Re: EMF Compare -- Compare two model instances [message #127168] |
Tue, 15 July 2008 13:53 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------040802080501030202000305
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Thomas,
Please use the EMFT newsgroup for questions about compare. I've added
it to the "to" list of the reply, so no need to repost.
Thomas Rheker wrote:
> Hi,
>
> for a research project I am trying to automatically compare two
> resources containing instances of the same meta model. These are the
> input and output of a bidirectional transformation and should be the
> same. The problem is to test them for equality in a junit test.
>
> My current approach does not work as expected, it looks as the following
> code snippet:
>
>>>> snip>>>
>>>>
> Resource compareInstance1 = loadEMFInstanceFromFile(emfInput);
> Resource compareInstance2 = loadEMFInstanceFromFile(emfOutput);
>
> MatchModel match = null;
> IMatchEngine matchEngine = new GenericMatchEngine();
> try {
> Map compareOptions = new HashMap();
> match = matchEngine.resourceMatch(compareInstance1,
> compareInstance2, compareOptions);
> } catch (InterruptedException e1) {
> e1.printStackTrace();
> }
> IDiffEngine diffEngine = new GenericDiffEngine();
> DiffModel diff = diffEngine.doDiff(match);
> <<<snap<<<
>
> For two exactly identical files the comparison still returns a DiffModel
> containing an Addition.
>
> If I compare the files by hand in the Eclipse GUI, Compare states that
> there are no differences, as is the case. See the attached files for the
> compared models and the meta model.
>
> What am I doing wrong? Also, is there an easy way to check two models
> for semantic equality, which is all I need for my tests right now?
>
> Greetings,
> Thomas Rheker
>
--------------040802080501030202000305
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thomas,<br>
<br>
Please use the EMFT newsgroup for questions about compare.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: EMF Compare -- Compare two model instances [message #127317 is a reply to message #127168] |
Sat, 19 July 2008 10:24 |
|
This is a multi-part message in MIME format.
--------------050006020802040709080702
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Thomas,
This snippet seems fine as is. Are you sure the two models you're
comparing by code are the same as those you compare from the GUI? If so,
did you check that all the compare options are set to their default
value when comparing from GUI (Window => Preferences => EMF Compare)?
You'll need to set them programmatically if needed (see
org.eclipse.emf.compare.util.MatchOptions).
As a side note, you shouldn't use the GenericMatchEngine and
GenericDiffEngine directly.
org.eclipse.emf.compare.match.service.MatchService and
org.eclipse.emf.compare.diff.service.DiffService both provide the
necessary API.
Cheers,
Laurent Goubet
Obeo
Ed Merks a
|
|
|
|
|
Re: EMF Compare -- Compare two model instances [message #127577 is a reply to message #127551] |
Sat, 26 July 2008 21:04 |
|
This is a multi-part message in MIME format.
--------------080905080900010607050309
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Thomas,
Well we use pretty much the same thing to load our models. You can take
a look at org.eclipse.utils.ModelUtils, it can be used standalone so you
can try delegating the model loading to it.
I fail to see what could cause the differences you get when comparing
from code. Could you provide us with the models you are comparing?
Preferably through a new bugzilla entry against emft/compare.
Cheers
Laurent Goubet
Obeo
Thomas Rheker a
|
|
|
Re: EMF Compare -- Compare two model instances [message #620128 is a reply to message #127168] |
Sat, 19 July 2008 10:24 |
|
This is a multi-part message in MIME format.
--------------050006020802040709080702
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Thomas,
This snippet seems fine as is. Are you sure the two models you're
comparing by code are the same as those you compare from the GUI? If so,
did you check that all the compare options are set to their default
value when comparing from GUI (Window => Preferences => EMF Compare)?
You'll need to set them programmatically if needed (see
org.eclipse.emf.compare.util.MatchOptions).
As a side note, you shouldn't use the GenericMatchEngine and
GenericDiffEngine directly.
org.eclipse.emf.compare.match.service.MatchService and
org.eclipse.emf.compare.diff.service.DiffService both provide the
necessary API.
Cheers,
Laurent Goubet
Obeo
Ed Merks a
|
|
|
|
|
Re: EMF Compare -- Compare two model instances [message #620150 is a reply to message #127551] |
Sat, 26 July 2008 21:04 |
|
This is a multi-part message in MIME format.
--------------080905080900010607050309
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Thomas,
Well we use pretty much the same thing to load our models. You can take
a look at org.eclipse.utils.ModelUtils, it can be used standalone so you
can try delegating the model loading to it.
I fail to see what could cause the differences you get when comparing
from code. Could you provide us with the models you are comparing?
Preferably through a new bugzilla entry against emft/compare.
Cheers
Laurent Goubet
Obeo
Thomas Rheker a
|
|
|
Powered by
FUDForum. Page generated in 0.04783 seconds