Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » ATL:How to add Sequence of TupleType?
ATL:How to add Sequence of TupleType? [message #413955] Thu, 30 July 2009 09:26 Go to next message
venkatesh  is currently offline venkatesh Friend
Messages: 41
Registered: July 2009
Member
Hi ,

I have declared a tuple type in which i want to add multiple tuple


can you please tell me the syntax for adding tuple data type

I have declared like this but it's not correct

helper def: descriptor : Sequence(TupleType(emp : String,f:String, s :
String)) =Tuple{( emp= 'a', f = 'b',s='c'),(emp= 'c', f = 'd',s='f')};



2.How to add String[] in Map data type

In Map we have Key value pair.if the value is a String then we can add
like this
helper def : modelKind : Map(String,String) =
Map {('KM3','KM3'),
('UML2','UML2')};

but if the value is a String[] ?

How to define helper for this

Map<String,String[]>
here A & B a key

Map{('A',('generalizedTimeMatch','0.0.17.1218.127.13.27')
('B',('booleanMatch','0.0.17.1218.127.13.13'))}


Thanks,
venky
Re: ATL:How to add Sequence of TupleType? [message #432142 is a reply to message #413955] Thu, 30 July 2009 16:04 Go to previous messageGo to next message
venkatesh  is currently offline venkatesh Friend
Messages: 41
Registered: July 2009
Member
Hi,

I have defined a helper for tuple type

helper def: names : Set(TupleType(emp:String, s : String)) =
Set{ Tuple { emp ='v1',s='ss'},Tuple { emp='v2',s='sd'}};


now i have defined another helper to get the tuple according to the emp

helper def :gettuple(emp :String) :TupleType(emp:String, s : String)=
thisModule.names->select(t |
t.emp)->collect(t|Tuple {emp =emp ,s = t.s } );

but this is throwing an error

can u tell me what is wrong in gettuple(emp :String) helper

thanks
venky
Re: ATL:How to add Sequence of TupleType? [message #439021 is a reply to message #432142] Fri, 31 July 2009 05:30 Go to previous message
venkatesh  is currently offline venkatesh Friend
Messages: 41
Registered: July 2009
Member
Hi ,

I got it.

this is the syntax for iterating the TupleType.It'll be useful for
beginners i guess.

helper def: names : Sequence(TupleType(emp:String, s : String)) =
Sequence{ Tuple { emp ='self.x',s='ss'},Tuple {emp='sss',s='sssssssssss'}};

helper def: getnames() :TupleType(emp:String, s : String)=
thisModule.names->iterate(e;acc:TupleType(emp:String, s :
String)=Tuple{emp='oo', s =''}|
if(e.emp= 'sss') then
Tuple{ emp =e.emp,s=e.s}
else
acc
endif
);

regards
venky
Previous Topic:[QVTo] run configuration requirements for input model
Next Topic:Problem in Tuple type
Goto Forum:
  


Current Time: Fri Apr 26 00:53:51 GMT 2024

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

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

Back to the top