Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Containment reference ETL
Containment reference ETL [message #1835045] Mon, 23 November 2020 22:42 Go to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi all,

I am writing a M2M transformation with ETL. This is my source model:
index.php/fa/39402/0/
And this is the transformation I wrote:

rule WorldMap2Worldmap
transform g: coronagraphical!WorldMap
to t: coronatextual!WorldMap
{
t.name = g.name;
}

// transformation rule for object country

rule Country2Country
transform g: coronagraphical!Country
to t: coronatextual!Country

{
t.name = g.name;
t.population = g.population;
t.zone = g.zone.getzone();
} 

//operation for enumeration zonelabel

operation Any getzone() {
if (self == coronagraphical!zonelabel#green) {
return coronatextual!zonelabelcolour#green;
}
else if (self = coronagraphical!zonelabel#red) {
return coronatextual!zonelabelcolour#red;
}
else {
return coronatextual!zonelabelcolour#yellow;
}
}


The target model that I get is this:
index.php/fa/39403/0/


So in the source model, countries are children of worldmap, while after the transformation they are siblings. How can I do it so they the countries will be children of worldmap after the transformation?

Thank you!
Re: Containment reference ETL [message #1835065 is a reply to message #1835045] Tue, 24 November 2020 08:38 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,

[1] should help. Unfortunately, screenshots are not ideal for sharing models/metamodels (for example I can't tell if your World class in the target metamodel has a containment reference for countries). Going forward, you may want to consider sharing minimal running examples instead [2].

Thanks,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/etl/#source-elements-resolution
[2] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: Containment reference ETL [message #1835071 is a reply to message #1835065] Tue, 24 November 2020 10:12 Go to previous messageGo to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi Dimitris, thank you for your answer!

The WorldMap in the target metamodel, does have a containment reference for countries.

I will provide some more detailed screenshots in the following.
This is the source metamodel.

index.php/fa/39406/0/

And this is the target metamodel.

index.php/fa/39407/0/

As you can see, the containment reference is in both of them. I believe the issue is in how I write the transformations.

With the transformation that I uploaded in the previous message, in the target model countries are shown as siblings of the world map, and not children.
Re: Containment reference ETL [message #1835076 is a reply to message #1835071] Tue, 24 November 2020 11:40 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Adding the following line to your WorldMap2Worldmap rule should do the trick.

t.country ::= g.country;


Thanks,
Dimitris
Previous Topic:M2M transformation for ENUM
Next Topic:Do I need install Excel driver
Goto Forum:
  


Current Time: Thu Apr 25 15:17:48 GMT 2024

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

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

Back to the top