Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Problems with TupleType
[ATL] Problems with TupleType [message #50270] Mon, 02 July 2007 04:44 Go to next message
Eclipse User
Originally posted by: francopinchetti.yahoo.it

Hello everybody,

I'm writing an ATL transformation in which I'm using the TupleType data
type. I want to create a Sequence of TupleType(mpn : String, slot : Integer,
freeslot : Integer). I have a called rule like this:



rule SecondFunction(mcs : Sequence(TupleType(mpn : String, slot : Integer,
freeslot : Integer))) {

do {

for (cp in .) {

cp.multiplicityCoupleSerializzation().toString().concat('
debug row 1').println(); -- debug row n. 1

mcs->append(cp.multiplicityCoupleSerializzation());

mcs.toString().concat(' debug row 2').println(); -- debug row
n. 2

}

}

}



And that's the helper multiplicityCoupleSerializzation():



helper context ModelFragmentMM!Couple def :
multiplicityCoupleSerializzation() : TupleType(mpn : String, slot : Integer,
freeslot : Integer) =

if (.) then

let sl : Integer = . in

Tuple{mpn = self.propName, slot = sl, freeslot = sl}

else

Tuple{}

endif

;



When I lunch the transformation the console says:



Tuple {freeslot = 1, slot = 1, mpn = '.'} debug row 1

Sequence {} debug row 2

..



Why the append operation on mcs don't work? And why the Tuple returned by
multiplicityCoupleSerializzation() has a different component order compared
to the helper declaration?



Thank you very much

Franco
Re: [ATL] Problems with TupleType [message #50300 is a reply to message #50270] Mon, 02 July 2007 05:08 Go to previous messageGo to next message
Ã?ric Vépa is currently offline Ã?ric Vépa
Messages: 16
Registered: July 2009
Junior Member
Hi Franco,

Franco wrote:
> Hello everybody,
>
> I'm writing an ATL transformation in which I'm using the TupleType data
> type. I want to create a Sequence of TupleType(mpn : String, slot : Integer,
> freeslot : Integer). I have a called rule like this:
>
>
>
> rule SecondFunction(mcs : Sequence(TupleType(mpn : String, slot : Integer,
> freeslot : Integer))) {
>
> do {
>
> for (cp in .) {
>
> cp.multiplicityCoupleSerializzation().toString().concat('
> debug row 1').println(); -- debug row n. 1
>
> mcs->append(cp.multiplicityCoupleSerializzation());
>
> mcs.toString().concat(' debug row 2').println(); -- debug row
> n. 2
>
> }
>
> }
>
> }
>
>
>
> And that's the helper multiplicityCoupleSerializzation():
>
>
>
> helper context ModelFragmentMM!Couple def :
> multiplicityCoupleSerializzation() : TupleType(mpn : String, slot : Integer,
> freeslot : Integer) =
>
> if (.) then
>
> let sl : Integer = . in
>
> Tuple{mpn = self.propName, slot = sl, freeslot = sl}
>
> else
>
> Tuple{}
>
> endif
>
> ;
>
>
>
> When I lunch the transformation the console says:
>
>
>
> Tuple {freeslot = 1, slot = 1, mpn = '.'} debug row 1
>
> Sequence {} debug row 2
>
> .
>
>
>
> Why the append operation on mcs don't work? And why the Tuple returned by
> multiplicityCoupleSerializzation() has a different component order compared
> to the helper declaration?

The append operation has a return type (mcs <- mcs->append(...)).

And the Tuple type is not ordered.

See the ATL User Manual for more details on append() operation and Tuple
data type.

>
>
>
> Thank you very much
>
> Franco
>
>
>


--
Éric Vépa

SODIUS
6, rue de la Cornouaille - BP 91941
44319 Nantes, France
Email: evepa@sodius.com

www.mdworkbench.com
Draw more value from your models
Re: [ATL] Problems with TupleType [message #50329 is a reply to message #50300] Mon, 02 July 2007 05:22 Go to previous message
Eclipse User
Originally posted by: francopinchetti.yahoo.it

thank you very much, it was a realy newbie error :-(
thanks
Franco

"
Previous Topic:[ATL] KM3DOT
Next Topic:[ATL] Recognition of design pattern in UML class diagrams
Goto Forum:
  


Current Time: Tue Jul 29 04:54:46 EDT 2014

Powered by FUDForum. Page generated in 0.02342 seconds