| [ATL] How to refer to superclasses [message #81635] | 
Mon, 19 May 2008 05:12   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: kokoigo.yahoo.com 
 
I am very new in ATL. Sorry if my question is so basic. 
 
So far i am trasforming from umlbMetamodel to TDMetamodel.  
My problem is i have to use an attribute "name", which is defined in a  
class on the top of a TDMetamodel. So, I don't know how to refer to  
superclass of superclass of superclass along the associations. Can i do  
either of the options belows ?  
 
1) Use multiple eContainer() such as  
 
rule ContextAxiom { 
   from t : TDMetamodel!TDTiming   
   to   u : umlbMetamodel!UMLBConstant  
     (name <- 'LOWER_LIMIT_' +  
t.eContainer().eContainer().eContainer().name ) 
    } 
 
 
2) Use assoication's name between Classes such as  
 
rule ContextAxiom {  
  from t : TDMetamodel!TDTiming   
  to   u : umlbMetamodel!UMLBConstant  
     (name <- 'LOWER_LIMIT_' + t.timing.constraints.segments.name ) 
  } 
 
Note that : timing, constraints and segments are association names. 
 
 
I tried both ways but non of them work now. So, i am not sure if i use it  
correct. Please give me suggestion. Thank you very much.
 |  
 |  
  | 
| Re: [ATL] How to refer to superclasses [message #82185 is a reply to message #81635] | 
Mon, 26 May 2008 06:17   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hello, 
 
T. Joochim a écrit : 
> I am very new in ATL. Sorry if my question is so basic. 
>  
> So far i am trasforming from umlbMetamodel to TDMetamodel. My problem is  
> i have to use an attribute "name", which is defined in a class on the  
> top of a TDMetamodel. So, I don't know how to refer to superclass of  
> superclass of superclass along the associations. Can i do either of the  
> options belows ? 
> 1) Use multiple eContainer() such as 
> rule ContextAxiom { 
>   from t : TDMetamodel!TDTiming    to   u : umlbMetamodel!UMLBConstant  
>     (name <- 'LOWER_LIMIT_' +  
> t.eContainer().eContainer().eContainer().name ) 
>    } 
 
What you mean is that TDTiming has a name attribute inherited from one  
of its superclasses ? If yes you can simply access to the "name"  
attribute like that : 
(name <- 'LOWER_LIMIT_' +  t.name ) 
 
If you want to get the name of an other element of your instance model,  
your solution is good. 
if you have : 
A 
|-B 
   |-C 
     |-D 
 
Where D is the TDTiming instance, you will have : 
t.name => D 
t.eContainer().eContainer().eContainer().name => A 
 
Best Regards, 
 
William 
 
>  
>  
> 2) Use assoication's name between Classes such as 
> rule ContextAxiom {  from t : TDMetamodel!TDTiming   to   u :  
> umlbMetamodel!UMLBConstant     (name <- 'LOWER_LIMIT_' +  
> t.timing.constraints.segments.name ) 
>  } 
>  
> Note that : timing, constraints and segments are association names. 
>  
>  
> I tried both ways but non of them work now. So, i am not sure if i use  
> it correct. Please give me suggestion. Thank you very much.
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.05533 seconds