Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Flock] copying vs. moving
[Flock] copying vs. moving [message #1066390] Tue, 02 July 2013 12:10 Go to next message
Alex G is currently offline Alex GFriend
Messages: 96
Registered: January 2012
Member
Hi!

In a migration with Flock I want to copy (EObject) elements, i.e.

migrated.x shall be a copy of original.y

It seems to me that Flock moves original.y instead of copying for the following EOL statement:

migrated.x = original.y

If I want to copy original.y and remain the y object in the original model (i.e. not moving y) I found a work around here.

Is it intended in Flock that elements are moved by using "="-assignment?
Or is it due to the fact that I'm using EMF and thus an EObject can have at most one container?

Best regards,
Alex.
Re: [Flock] copying vs. moving [message #1066524 is a reply to message #1066390] Tue, 02 July 2013 22:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

To copy original.y you should use migrated.x = original.y.equivalent(); instead (migrated.x ::= original.y; should also work, I think).

Cheers,
Dimitris
Re: [Flock] copying vs. moving [message #1066573 is a reply to message #1066390] Wed, 03 July 2013 08:48 Go to previous messageGo to next message
Alex G is currently offline Alex GFriend
Messages: 96
Registered: January 2012
Member
Hi Dimitris!

I tried with equivalent() before posting here. The problem is (I think, not sure), that equivalent() needs maybe other manually created migration rules for the equivalent object, i.e. does not "copy" the automatically migrated objects (here "y" shall be automatically migrated).

Best regards,
Alex.
Re: [Flock] copying vs. moving [message #1066575 is a reply to message #1066573] Wed, 03 July 2013 08:51 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

This doesn't sound right. Could you please put together a minimal example I can use to reproduce this?

Cheers,
Dimitris
Re: [Flock] copying vs. moving [message #1066584 is a reply to message #1066575] Wed, 03 July 2013 10:02 Go to previous messageGo to next message
Gaëtan Pruvost is currently offline Gaëtan PruvostFriend
Messages: 19
Registered: June 2013
Junior Member
Hi,

If I understand well, you want to do some operations on a model that you want to copy first in order to keep the original.
Am I wrong? Cause it seems related to this previous topic:
http://www.eclipse.org/forums/index.php/t/489620/

I do believe model copy (from within a script) is a very usefull feature (to keep intermediate traces for instance) but oddly, it seems to be an uncommon task...
Feels a bit like it's not the "good/mainstream way of doing", we're maybe missing the point here Confused
Re: [Flock] copying vs. moving [message #1066944 is a reply to message #1066390] Fri, 05 July 2013 08:28 Go to previous messageGo to next message
Alex G is currently offline Alex GFriend
Messages: 96
Registered: January 2012
Member
Hi!

I think I found my problem:
I want an object in the original model have twice in different containers in the migrated model. By calling original.y.equivalent() it is indeed copied from original into migrated and then moved to the assigned container migrated.x, i.e. y is not copied from migrated to migrated and thus I have it only once in the migrated model. The y object is not copied then from lets say original.y to migrated.y!

Btw. I checked the assignemnts "=", ":=" and "::=" (they all just move the objects, they don't behave like equivalent() in Flock in contrast to the ETL assignment "::=").


@Gaetan
Yes, I need to remain the original model (for unit testing).
Re: [Flock] copying vs. moving [message #1067272 is a reply to message #1066944] Mon, 08 July 2013 07:52 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Alex,

Flock only supports 1-to-1 mappings between original and migrated elements. To perform a 1-to-2 mapping (or indeed 1-to-N where N>1), the following might work:

migrate MyType {
   var emfTool : new Native("org.eclipse.epsilon.emc.emf.tools.EmfTool");
   
   migrated2 = emfTool.getECoreUtil().copy(migrated);
}


I've not tried this, but I presume that you would also need to place "migrated2" into an appropriate container.

If you've not resolved your problem and could put together a minimal example, I can investigate further.

Cheers,
Louis.
Re: [Flock] copying vs. moving [message #1067687 is a reply to message #1067272] Wed, 10 July 2013 06:50 Go to previous message
Alex G is currently offline Alex GFriend
Messages: 96
Registered: January 2012
Member
Hi Louis,

this is exactly how I solved it.

Best regards,
Alex.

Louis Rose wrote on Mon, 08 July 2013 03:52
Hi Alex,

Flock only supports 1-to-1 mappings between original and migrated elements. To perform a 1-to-2 mapping (or indeed 1-to-N where N>1), the following might work:

migrate MyType {
   var emfTool : new Native("org.eclipse.epsilon.emc.emf.tools.EmfTool");
   
   migrated2 = emfTool.getECoreUtil().copy(migrated);
}


I've not tried this, but I presume that you would also need to place "migrated2" into an appropriate container.

If you've not resolved your problem and could put together a minimal example, I can investigate further.

Cheers,
Louis.

Previous Topic:Create gmf tools, etc with Eugenia
Next Topic:Generate Emfatic Source Does Nothing
Goto Forum:
  


Current Time: Thu Apr 25 22:37:05 GMT 2024

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

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

Back to the top