Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Call an operation
[ATL] Call an operation [message #106892] Fri, 19 June 2009 08:54 Go to next message
Eclipse UserFriend
Hello,

I'm working on a higher order transformation, with the following scenario:

*** (T1 - HOT): M1 -> ATL ***
- from M1 I get the string of the operations I need to call in the
generated T2 transformation, on the input types of T2.

*** (T2): M2 -> M3 (with the use of an ATL library) ***
- some target elements in M3 need to be constructed by calling on M2
types, operations defined in an ATL library for those types, these
operations being identified, inside a helper, by a String parameter,
belonging to the helper.

Sample:

rule A {
Re: [ATL] Call an operation by a string [message #106909 is a reply to message #106892] Fri, 19 June 2009 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Sorry for the incomplete post (new keyboard).

I'm working on a higher order transformation, with the following scenario:

*** (T1 - HOT): M1 -> ATL ***
- from M1 I get the string of the operations I need to call in the
generated T2 transformation, on the input types of T2.

*** (T2): M2 -> M3 (with the use of an ATL library) ***
- some target elements in M3 need to be constructed by calling on M2 types
(all of them), operations defined in an ATL library for those types, these
operations being identified, inside a helper, by a String parameter,
belonging to the helper.

Sample:

--this will lool like the generated code

uses Utils;

rule R {
from
a:M2!TypeM2
to
b:M3!TypeM3 (
value <- thisModule.getValue(operationName)
)
}

helper def : getValue(operationName : String) :String =
M2!TypeM2.allInstances()-> collect(it|it.'operationName').iterate(e;res:String=''|res.c oncat(e));


in which the operation is defined on the type M2 in the Utils library.

I really don't know if it's clear, please ask to clarify. Thank you!

Best regards,
Cosmin
Re: [ATL] Call an operation by a string [message #106936 is a reply to message #106909] Fri, 19 June 2009 09:15 Go to previous message
Eclipse UserFriend
Kind of reflection if you like and invoke a method on a type, by knowing
its name.
As an alternative of doing this, I could generate rules or just ouput
patterns for all of the strings I need to pass from M1 to T2. This way, in
each rule, I can write the operation corresponding to the string directly.
But this will be a lot of generated code an I was wondering how to pass
the collection of strings and have a general helper, which takes as
parameter one string at a time, to do my job.

Regards,
Cosmin
Previous Topic:Using model already loaded via EMF as source?
Next Topic:[qvto] One-to-Many Mappings
Goto Forum:
  


Current Time: Mon Feb 17 00:32:34 GMT 2025

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

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

Back to the top