Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare](Matching algorithm)
[EMF Compare] [message #541765] Tue, 22 June 2010 13:20 Go to next message
El Arbi Aboussoror is currently offline El Arbi AboussororFriend
Messages: 90
Registered: June 2010
Member
Hello,

I'm new to EMF Compare.
May you tell me how can I see the matching algorithm ?
And how can I write my own matching and also merging algorithms ?

Thanks
Re: [EMF Compare] [message #541912 is a reply to message #541765] Wed, 23 June 2010 07:22 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
Hi,

In 1.1.0 version (which will be released in a few hours) the Eclipse Online
doc you'll have a tutorial explaining how to write your own match algorithm.
If you want more information about the generic algorithm, a paper has been
published http://www.upgrade-cepis.org/issues/2008/2/upg9-2Brun.pdf and the
FAQ
( http://wiki.eclipse.org/EMF_Compare_FAQ#What_kind_of_.22stra tegies.22_use_EMF_compare_.3F)
contains more influences.

Cheers,

Cédric

aboussoror@gmail.com wrote:

> Hello,
>
> I'm new to EMF Compare.
> May you tell me how can I see the matching algorithm ?
> And how can I write my own matching and also merging algorithms ?
>
> Thanks


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare] [message #544716 is a reply to message #541765] Mon, 05 July 2010 10:54 Go to previous messageGo to next message
Beti Missing name is currently offline Beti Missing nameFriend
Messages: 6
Registered: July 2010
Junior Member
Hi, I am also discovering EMF compare features. I would like to know how can I compare models with extension .emx.

Thanks in advance
Re: [EMF Compare] [message #544960 is a reply to message #544716] Tue, 06 July 2010 07:43 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020705050202020608030304
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Beti,

Please take a look at the EMF Compare FAQ
http://wiki.eclipse.org/EMF_Compare_FAQ#Which_files_should_b e_compared_via_EMF_Compare_.3F
and let us know if we need to simplify or elaborate on these explanations.

Laurent Goubet
Obeo

Beti wrote:
> Hi, I am also discovering EMF compare features. I would like to know
> how can I compare models with extension .emx.
>
> Thanks in advance


--------------020705050202020608030304
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------020705050202020608030304--
Re: [EMF Compare] [message #545619 is a reply to message #544960] Thu, 08 July 2010 13:07 Go to previous messageGo to next message
Beti Missing name is currently offline Beti Missing nameFriend
Messages: 6
Registered: July 2010
Junior Member
Hi,

Thanks a lot for your message. But, even after some time spent on the problem, I have still questions about how to use this or that object.
I am working on comparing UML/OCL models. My goal is for example to find the variable definitions or uses that changed into the OCL code. My question is maybe naive, but how can I get my object variable (from my metamodel) which use is changed into the OCL code ( in a operation of my Class Diagram, for instance), once I have called the DiffService.doDiff() operation? Can I just say :

if (diff instance of Variable) {return diff;}

In addition, here is a part of my code :

	protected static int getSubchanges(DiffGroup d)
	{
		int res = 0;
	
		for (DiffElement diff : d.getSubDiffElements()) {
			if (diff instanceof DiffGroup) {
				System.out.println("diff group : "+((DiffGroup)diff).getRightParent());
				res += getSubchanges((DiffGroup)diff);
			} else {
		
				System.out.println("nb : "+diff.eClass());
				res += 1;
			}
		}
		
		return res;
		
	}
	protected static int getSubchanges(DiffModel self) {
		int subChanges = 0;
		System.out.println("totot");
		for (DiffElement diff : self.getOwnedElements()) {
			if (diff instanceof DiffGroup) {
				System.out.println("diff group First: "+((DiffGroup)diff));
				subChanges += getSubchanges((DiffGroup)diff);
			} else {
				System.out.println("diff unit sub"+diff.eContents());
				subChanges += 1;
			}
		}
		return subChanges;
	}


ann in my main :
// Computing differences
			DiffModel diff = DiffService.doDiff(match, false);
			
	
			int nb = getSubchanges(diff);


Sorry, if my question is not very clear.
Thanks in advance!

Best regards,
Beti

[Updated on: Thu, 08 July 2010 13:08]

Report message to a moderator

Re: [EMF Compare] [message #545697 is a reply to message #545619] Thu, 08 July 2010 16:10 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Beti

For EMF Compare to give you an intelligent OCL difference you would need
to have your OCL represented by its AST. I suspect that most tools are
currently persisting the OCL as a string.

If you are working within the context of your own Java code, you could
try traversing your model and replacing each String-based expression
with its parsed equivalent.

Regards

Ed Willink

On 08/07/2010 14:07, Beti wrote:
> Hi,
>
> Thanks a lot for your message. But, even after some time spent on the
> problem, I have still questions about how to use this or that object.
> I am working on comparing UML/OCL models. My goal is for example to find
> the variable definitions or uses that changed into the OCL code. My
> question is maybe naive, but how can I get my object variable (from my
> metamodel) which use is changed into the OCL code ( in a operation of my
> Class Diagram, for instance), once I have called the
> DiffService.doDiff() operation? Can I just say :
>
> if (diff instance of Variable) {return diff;}
> In addition, here is a part of my code :
> protected static int getSubchanges(DiffGroup d)
> {
> int res = 0;
>
> for (DiffElement diff : d.getSubDiffElements()) {
> if (diff instanceof DiffGroup) {
> System.out.println("diff group : "+((DiffGroup)diff).getRightParent());
> res += getSubchanges((DiffGroup)diff);
> } else {
>
> System.out.println("nb : "+diff.eClass());
> res += 1;
> }
> }
>
> return res;
>
> }
> protected static int getSubchanges(DiffModel self) {
> int subChanges = 0;
> System.out.println("totot");
> for (DiffElement diff : self.getOwnedElements()) {
> if (diff instanceof DiffGroup) {
> System.out.println("diff group First: "+((DiffGroup)diff));
> subChanges += getSubchanges((DiffGroup)diff);
> } else {
> System.out.println("diff unit sub"+diff.eContents());
> subChanges += 1;
> }
> }
> return subChanges;
> }
>
> ann in my main :
> // Computing differences
> DiffModel diff = DiffService.doDiff(match, false);
>
>
> int nb = getSubchanges(diff);
Re: [EMF Compare] [message #623004 is a reply to message #541765] Wed, 23 June 2010 07:22 Go to previous message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
Hi,

In 1.1.0 version (which will be released in a few hours) the Eclipse Online
doc you'll have a tutorial explaining how to write your own match algorithm.
If you want more information about the generic algorithm, a paper has been
published http://www.upgrade-cepis.org/issues/2008/2/upg9-2Brun.pdf and the
FAQ
( http://wiki.eclipse.org/EMF_Compare_FAQ#What_kind_of_.22stra tegies.22_use_EMF_compare_.3F)
contains more influences.

Cheers,

Cédric

aboussoror@gmail.com wrote:

> Hello,
>
> I'm new to EMF Compare.
> May you tell me how can I see the matching algorithm ?
> And how can I write my own matching and also merging algorithms ?
>
> Thanks


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare] [message #623039 is a reply to message #541765] Mon, 05 July 2010 10:54 Go to previous message
Beti Missing name is currently offline Beti Missing nameFriend
Messages: 6
Registered: July 2010
Junior Member
Hi, I am also discovering EMF compare features. I would like to know how can I compare models with extension .emx.

Thanks in advance
Re: [EMF Compare] [message #623040 is a reply to message #623039] Tue, 06 July 2010 07:43 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020705050202020608030304
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Beti,

Please take a look at the EMF Compare FAQ
http://wiki.eclipse.org/EMF_Compare_FAQ#Which_files_should_b e_compared_via_EMF_Compare_.3F
and let us know if we need to simplify or elaborate on these explanations.

Laurent Goubet
Obeo

Beti wrote:
> Hi, I am also discovering EMF compare features. I would like to know
> how can I compare models with extension .emx.
>
> Thanks in advance


--------------020705050202020608030304
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------020705050202020608030304--
Re: [EMF Compare] [message #623049 is a reply to message #544960] Thu, 08 July 2010 13:07 Go to previous message
Beti Missing name is currently offline Beti Missing nameFriend
Messages: 6
Registered: July 2010
Junior Member
Hi,

Thanks a lot for your message. But, even after some time spent on the problem, I have still questions about how to use this or that object.
I am working on comparing UML/OCL models. My goal is for example to find the variable definitions or uses that changed into the OCL code. My question is maybe naive, but how can I get my object variable (from my metamodel) which use is changed into the OCL code ( in a operation of my Class Diagram, for instance), once I have called the DiffService.doDiff() operation? Can I just say :

if (diff instance of Variable) {return diff;}
In addition, here is a part of my code :

protected static int getSubchanges(DiffGroup d)
{
int res = 0;

for (DiffElement diff : d.getSubDiffElements()) {
if (diff instanceof DiffGroup) {
System.out.println("diff group : "+((DiffGroup)diff).getRightParent());
res += getSubchanges((DiffGroup)diff);
} else {

System.out.println("nb : "+diff.eClass());
res += 1;
}
}

return res;

}
protected static int getSubchanges(DiffModel self) {
int subChanges = 0;
System.out.println("totot");
for (DiffElement diff : self.getOwnedElements()) {
if (diff instanceof DiffGroup) {
System.out.println("diff group First: "+((DiffGroup)diff));
subChanges += getSubchanges((DiffGroup)diff);
} else {
System.out.println("diff unit sub"+diff.eContents());
subChanges += 1;
}
}
return subChanges;
}

ann in my main :
// Computing differences
DiffModel diff = DiffService.doDiff(match, false);


int nb = getSubchanges(diff);
Re: [EMF Compare] [message #623050 is a reply to message #623049] Thu, 08 July 2010 16:10 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Beti

For EMF Compare to give you an intelligent OCL difference you would need
to have your OCL represented by its AST. I suspect that most tools are
currently persisting the OCL as a string.

If you are working within the context of your own Java code, you could
try traversing your model and replacing each String-based expression
with its parsed equivalent.

Regards

Ed Willink

On 08/07/2010 14:07, Beti wrote:
> Hi,
>
> Thanks a lot for your message. But, even after some time spent on the
> problem, I have still questions about how to use this or that object.
> I am working on comparing UML/OCL models. My goal is for example to find
> the variable definitions or uses that changed into the OCL code. My
> question is maybe naive, but how can I get my object variable (from my
> metamodel) which use is changed into the OCL code ( in a operation of my
> Class Diagram, for instance), once I have called the
> DiffService.doDiff() operation? Can I just say :
>
> if (diff instance of Variable) {return diff;}
> In addition, here is a part of my code :
> protected static int getSubchanges(DiffGroup d)
> {
> int res = 0;
>
> for (DiffElement diff : d.getSubDiffElements()) {
> if (diff instanceof DiffGroup) {
> System.out.println("diff group : "+((DiffGroup)diff).getRightParent());
> res += getSubchanges((DiffGroup)diff);
> } else {
>
> System.out.println("nb : "+diff.eClass());
> res += 1;
> }
> }
>
> return res;
>
> }
> protected static int getSubchanges(DiffModel self) {
> int subChanges = 0;
> System.out.println("totot");
> for (DiffElement diff : self.getOwnedElements()) {
> if (diff instanceof DiffGroup) {
> System.out.println("diff group First: "+((DiffGroup)diff));
> subChanges += getSubchanges((DiffGroup)diff);
> } else {
> System.out.println("diff unit sub"+diff.eContents());
> subChanges += 1;
> }
> }
> return subChanges;
> }
>
> ann in my main :
> // Computing differences
> DiffModel diff = DiffService.doDiff(match, false);
>
>
> int nb = getSubchanges(diff);
Previous Topic:[EEF] Using Ecore consisting of subpackages fails
Next Topic:Ubuntu 9 + problem when create artefact
Goto Forum:
  


Current Time: Sun May 05 02:17:01 GMT 2024

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

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

Back to the top