Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] How to refer to superclasses
[ATL] How to refer to superclasses [message #81635] Mon, 19 May 2008 09:12 Go to next message
Eclipse UserFriend
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 10:17 Go to previous message
William Piers is currently offline William PiersFriend
Messages: 301
Registered: July 2009
Senior Member
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.
Previous Topic:Problem with simple transformation
Next Topic:no KM3 in ATL
Goto Forum:
  


Current Time: Sat Apr 27 03:18:13 GMT 2024

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

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

Back to the top