Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] How to transform the owner relationship between model and classes
[ETL] How to transform the owner relationship between model and classes [message #1113869] Sat, 21 September 2013 21:43 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi there,

I am quite new in the area of Epsilon and ETL. I would like to know how I can transform the "owner" relationship between a model and the owned classes. Hence, the example is quite simple, see:

Source model
|_Source class 1
|_Source class 2
|_...

Target model
|_Target class 1
|_Target class 2
|_...

I have problems and cannot see from the documentation (neither from the forum nor examples) how I can refer to the "owner" relationship between the model and contained classes.

In the following, I show my code. The relationship between the model and the classes are still missing. It seems that it is not possible to use a global variable to store the model that can be reused in the second transformation.

rule RenameModel
	transform sm : DomainSpecificProblemContextModel!Model
	to tm : XDomainProblemContextPatternModel!Model{
	tm.name = 'XDomain ProblemContext Pattern Model';
}
rule CopyAndRenameClasses
	transform sc : Source!Class
	to tc : Target!Class 
    extends RenameModel{
// Copy classes into this model next:
    tc.name = '1Class';
}


I appreciate very much any hints how to do this.

Thanks and kind regards, Alexander
Re: [ETL] How to transform the owner relationship between model and classes [message #1113890 is a reply to message #1113869] Sat, 21 September 2013 22:32 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 Alexander,

Could you please put together a minimal example [1] that includes copies of your source/target metamodels, a sample source model and the expected target model so that I can advise?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [ETL] How to transform the owner relationship between model and classes [message #1114173 is a reply to message #1113890] Sun, 22 September 2013 09:38 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks for your quick answer and appreciated support. I provided the needed information in an email sent to epsilon.devs@gmail.com.

In case you need further information or have any further questions, please do not hesitate to contact me. I am also available today.

Kind regards, Alexander
Re: [ETL] How to transform the owner relationship between model and classes [message #1114203 is a reply to message #1114173] Sun, 22 September 2013 10:44 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 Alexander,

I've scribbled two possible solutions below:

---
pre {
var targetModel : XDomainProblemContextPatternModel!Model; // Solution 1
}

rule RenameModel
transform sm : DomainSpecificProblemContextModel!Model
to tm : XDomainProblemContextPatternModel!Model{
tm.name = 'XDomain ProblemContext Pattern Model';
targetModel = tm; // Solution 1
}

rule CopyAndRenameClasses
transform sc : Source!Class
to tc : Target!Class{
// Copy classes into this model next:
tc.name = '1Class';
targetModel.packagedElements.add(tc); // Solution 1
//sc.eContainer().equivalent().packagedElements.add(tc); // Solution 2
}
---

Regarding your launch configuration, I suspect that you'll need to disable "Store on disposal" and "Include external references" for your input model, and "Read on load" for your target model.

Cheers,
Dimitris
Re: [ETL] How to transform the owner relationship between model and classes [message #1114299 is a reply to message #1114203] Sun, 22 September 2013 14:14 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks a lot - it works fine with both solution 1 as well a solution 2! Concerning my question that I put into the email: Is it possible to generate a new model in a transformation, too?

Thanks and kind regards, Alexander
Re: [ETL] How to transform the owner relationship between model and classes [message #1114316 is a reply to message #1114299] Sun, 22 September 2013 14:52 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alexander,

You're welcome. Yes - the file of your target model doesn't need to exist before the transformation is executed (in this case you'll need to turn "Read on load" off and configure the metamodel that it should conform to manually).

Cheers,
Dimitris
Previous Topic:org.eclipse.epsilon.emc.emf.virtual.VirtualPackage java.lang.Class Error!
Next Topic:[Solved][EVL 1.1 editor ] : Conflict between ParameterDirectionKind#return and return keyword
Goto Forum:
  


Current Time: Thu Apr 25 21:27:30 GMT 2024

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

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

Back to the top