Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Copying elements of EPackage to another EPackage
Copying elements of EPackage to another EPackage [message #1797935] Thu, 08 November 2018 20:12 Go to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi there,

How can I copy all elements of an EPakage to another EPackage in EOL?

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Thu, 08 November 2018 20:19]

Report message to a moderator

Re: Copying elements of EPackage to another EPackage [message #1798049 is a reply to message #1797935] Sun, 11 November 2018 21:09 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2182
Registered: July 2009
Location: York, UK
Senior Member

Hi Banafsheh,

https://www.eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.clone should help.

Cheers,
Dimitris
Re: Copying elements of EPackage to another EPackage [message #1798361 is a reply to message #1798049] Fri, 16 November 2018 08:01 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Thank you.

Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Copying elements of EPackage to another EPackage [message #1800095 is a reply to message #1798361] Wed, 19 December 2018 20:31 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi there,

I have not any problem with copying elements when I run my program with EOL engine. However, when I run my program in standalone, I have an error in the last line, `Called feature name on undefined object`.
var emfTool : new Native("org.eclipse.epsilon.emc.emf.tools.EmfTool");
var statement = ETL!ETLModule.all.first.preBlocks.body.statements.flatten.first;
var node = new Target!Node;
node.ref = emfTool.ecoreUtil.copy(statement);
node.ref.type().name.println;

This is to mention that when I change line 4 with the code bellow, I have not any error.
node.ref = new ETL!StringExpression;

I have `org.eclipse.epsilon.emc.emf` in my plugin dependencies. When I print `node.ref` it gives me `org.eclipse.epsilon.eol.metamodel.impl.ExpressionStatementImpl@1ed8d18c (uri: null)` . However, `node.ref.type()` gives null.

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Thu, 20 December 2018 07:27]

Report message to a moderator

Re: Copying elements of EPackage to another EPackage [message #1800119 is a reply to message #1800095] Thu, 20 December 2018 08:47 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2182
Registered: July 2009
Location: York, UK
Senior Member

Hi Banafsheh,

This sounds like a Haetae issue.

Cheers,
Dimitris
Re: Copying elements of EPackage to another EPackage [message #1800134 is a reply to message #1800119] Thu, 20 December 2018 10:55 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi Dimitris,

what shall I do?

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Thu, 20 December 2018 10:55]

Report message to a moderator

Re: Copying elements of EPackage to another EPackage [message #1800135 is a reply to message #1800134] Thu, 20 December 2018 11:01 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2182
Registered: July 2009
Location: York, UK
Senior Member

Hi Banafsheh,

My recommendation would be to try reproduce this using Haetae's Java API. If it works well through the Java API but not through Epsilon, please post copy of the working Java code and I'll have a look.

Cheers,
Dimitris
Re: Copying elements of EPackage to another EPackage [message #1800140 is a reply to message #1800135] Thu, 20 December 2018 11:42 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi Dimitris,

On the contrary, it works well through Epsilon but not through Java API.
To clarify, in case that I import all plugins of Haetae to eclipse and use its api in my plugin to generate the model then I run my EOL program in a standalone mode, I have the error.
Anyway, I do not think its related to haetae as the model is generated correctly and I have not any problem with eol statements other than the copy statements. I am trying to provide a minimal example.

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Thu, 20 December 2018 11:47]

Report message to a moderator

Re: Copying elements of EPackage to another EPackage [message #1800158 is a reply to message #1800140] Thu, 20 December 2018 15:02 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi Dimitris,

I use Epsilon 1.3. I have added a ETLCodetoModel method to AbstractAST2ExLAction class of Haetae. To reproduce my problem you might want to do these steps.

1. importing files of the `first eclipse` folder to eclipse.
2. run it as an eclipse application
3. In the new eclipse, import the files of the `second eclipse` folder
4. right click on the `Families2Persons.etl` file and select `test` from the popup menu.

Then, you can see the error in the console of your first eclipse.

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Thu, 20 December 2018 15:09]

Report message to a moderator

Re: Copying elements of EPackage to another EPackage [message #1800177 is a reply to message #1800158] Thu, 20 December 2018 23:16 Go to previous messageGo to next message
Ran Wei is currently offline Ran WeiFriend
Messages: 119
Registered: September 2012
Location: York, UK
Senior Member
Hi,

This is due to the fact that Haetae does not support inferring types returned from Java calls, can you maybe let me know what you are trying to do so that maybe I can think of a work-around?

Cheers,
Ran Wei


Research Associate
Department of Computer Science
University of York
Re: Copying elements of EPackage to another EPackage [message #1800196 is a reply to message #1800177] Fri, 21 December 2018 08:34 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi,

I am constructing a graph. Each node of this graph has a reference to an ETLElement. In my program, e.g., I need to know if the type of the ETLElement of a node is "Return Statement" something be done.

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Copying elements of EPackage to another EPackage [message #1800316 is a reply to message #1800196] Mon, 24 December 2018 11:59 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi there,

Haven't you got any idea about it?

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Copying elements of EPackage to another EPackage [message #1800317 is a reply to message #1800196] Mon, 24 December 2018 12:32 Go to previous messageGo to next message
Ran Wei is currently offline Ran WeiFriend
Messages: 119
Registered: September 2012
Location: York, UK
Senior Member
Hi there,

Thanks for your patience, apologies - I am on holidays so access to emails is disrupted.

I would try the clone() operation in Epsilon, which is applicable on collections first. For example, in your code below:

var emfTool : new Native("org.eclipse.epsilon.emc.emf.tools.EmfTool");
var statement = ETL!ETLModule.all.first.preBlocks.body.statements.flatten.first;
var node = new Target!Node;
node.ref = emfTool.ecoreUtil.copy(statement);
node.ref.type().name.println;


You could easily do :

var statement = ETL!ETLModule.all.clone().first.***


but my question is if you are constructing a graph model with reference to ETLElements, why use a clone instead of the original ETLElements?

Cheers,
Will


Research Associate
Department of Computer Science
University of York
Re: Copying elements of EPackage to another EPackage [message #1800334 is a reply to message #1800317] Mon, 24 December 2018 20:10 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi Will,

Don't mention it. Thanks for your support.
The reason is I call an operation. I use this statement as a context and access it via self in the operation. Then, in the operation I need to create node, clone self to its ref and access its type.

Best Regards,
Banafsheh


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Copying elements of EPackage to another EPackage [message #1800342 is a reply to message #1800334] Tue, 25 December 2018 08:21 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
I need to clone `self` but `self` is not a collection. What shall I do?

Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Tue, 25 December 2018 12:09]

Report message to a moderator

Re: Copying elements of EPackage to another EPackage [message #1800360 is a reply to message #1800342] Tue, 25 December 2018 21:34 Go to previous messageGo to next message
Ran Wei is currently offline Ran WeiFriend
Messages: 119
Registered: September 2012
Location: York, UK
Senior Member
In Epsilon you can always create a collection and put self in it

Research Associate
Department of Computer Science
University of York
Re: Copying elements of EPackage to another EPackage [message #1800397 is a reply to message #1800360] Wed, 26 December 2018 15:20 Go to previous message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Surprisingly, after one week my first code runs without error. I don't know what has happened. Thanks for your time.

Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Wed, 26 December 2018 15:21]

Report message to a moderator

Previous Topic:model instances (.xmi)
Next Topic:Problem with call by reference in EOL
Goto Forum:
  


Current Time: Mon Sep 23 17:42:07 GMT 2024

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

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

Back to the top