Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] How to to generate xml code for the compartments of a define node.
[ETL] How to to generate xml code for the compartments of a define node. [message #636754] Tue, 02 November 2010 16:38 Go to next message
Syed Imran is currently offline Syed ImranFriend
Messages: 12
Registered: July 2009
Location: Cork, Ireland
Junior Member
Hi All,

I am trying to generate code using ETL, I get into the problem in specifying ETL for the compartments of specified node.
For example in:
@gmf.node(label="name")
class House {
   attr String name;
   
  @gmf.compartment(layout="list")
 val Room [*] rooms;
		   
  @gmf.link(label="To_House")
 ref House[*] To_House ;
}

@gmf.node(label="name")
class Room {
 attr String name;
}

The ETL sytax I wrote :
Quote:

pre {
var map = new Target!t_Map;
Target.document.appendChild(map);
}

rule HouseNode
transform s : Source!House
to t : Target!t_House {

t.a_name := s.name;
t.a_rooms ::= s.rooms;

//For link
if ( s.To_House.isDefined()) {map.appendChild(t); }

// For Compartment ??
}

rule RoomNode
transform s : Source!Room
to t : Target!t_Room {

t.a_name := s.name;
}


For links I don't have problems but how to define compartments. The output is simple xml code.
Re: [ETL] How to to generate xml code for the compartments of a define node. [message #636781 is a reply to message #636754] Tue, 02 November 2010 18:27 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Syed,

Off the top of my head,

t.a_rooms ::= s.rooms

should be instead

for (r in s.rooms) {
t.appendChild(r.equivalent());
}

Please let me know if this doesn't work and I'll have a closer look at this.

Cheers,
Dimitris

On 02/11/2010 16:38, Syed Imran wrote:
> Hi All,
>
> I am trying to generate code using ETL, I get into the problem in
> specifying ETL for the compartments of specified node.
> For example in:
>
> @gmf.node(label="name")
> class House {
> attr String name;
> @gmf.compartment(layout="list")
> val Room [*] rooms;
> @gmf.link(label="To_House")
> ref House[*] To_House ;
> }
>
> @gmf.node(label="name")
> class Room {
> attr String name;
> }
>
> The ETL sytax I wrote :
> Quote:
>> pre {
>> var map = new Target!t_Map;
>> Target.document.appendChild(map);
>> }
>>
>> rule HouseNode
>> transform s : Source!House
>> to t : Target!t_House {
>>
>> t.a_name := s.name;
>> t.a_rooms ::= s.rooms;
>>
>> //For link
>> if ( s.To_House.isDefined()) {map.appendChild(t); }
>> // For Compartment ??
>> }
>>
>> rule RoomNode
>> transform s : Source!Room
>> to t : Target!t_Room {
>>
>> t.a_name := s.name;
>> }
>
>
> For links I don't have problems but how to define compartments. The
> output is simple xml code.
Re: [ETL] How to to generate xml code for the compartments of a define node. [message #636813 is a reply to message #636781] Tue, 02 November 2010 21:56 Go to previous message
Syed Imran is currently offline Syed ImranFriend
Messages: 12
Registered: July 2009
Location: Cork, Ireland
Junior Member
Yes Dimitris,
It did the magic. Very Happy

Actually I have found ETL much simpler and easier to write as compare to any other model to text transformation tech.

Syed Imran
Previous Topic:Xtext editor for the E*L languages
Next Topic:Create view linking with editor
Goto Forum:
  


Current Time: Fri Apr 26 17:40:51 GMT 2024

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

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

Back to the top