|
|
|
Re: [ATL] Reference output model elements [message #70666 is a reply to message #70651] |
Mon, 07 January 2008 06:59   |
Eclipse User |
|
|
|
Hi Stefanie, you have to import the profile as metamodel if you want to
apply some stereotype to your output elements.
This is the header of a sample transformation from profile A to profile B:
module moduleName;
create OUT : UML2 from IN : UML2, PRO : UML2;
IN and OUT are the UML2 metamodel and PRO is the .uml definition of
profile B.
The following is a rule that matches a stereotyped UML Component and
generates a stereotyped UML Class:
rule comp2class{
from
s : UML2!Component
(
s.isStereotypeApplied('<stereotypeName>')
)
to
t : UML2!Class(
-- bindings
)
do {
t.applyStereotype(<here you put the Stereotype definition contained in
PRO>);
t.setValue(<Stereotype definition contained in PRO>, '<propertyName>',
<propertyValue>);
}
}
helper context UML2!Element def: isStereotypeApplied(name : String) :
Boolean =
not self.getAppliedStereotypes()->select(p |
p.name = name
).isEmpty();
This is how I tackled the problem of applying stereotypes to UML elements
and set the values of UML Tagged values.
I hope this will be useful, regards
Ivano
stefanie zhao wrote:
> Hi, Thanks very much, it's really helpful.
> But I have another question, can I set the stereotype properties, just
> in the same procedure as i set the basic properties of this element. I
> need to set some properties defined in the stereotype to refine my PIM
> to get a PSM.
> Should I import the profile as a metamodel?
> Thanks again.
> Tristan FAURE åé:
>> Hi !
>> when you match you match your element in an ATL rule you can add some
>> condition example
>> from o : UML!Operation(myCondition)
>> and it exists the function getAppliedStereotypes()
>> you can do getAppliedStereotypes()->select(s | s.name = "Invoke")
>>
>>
>>
|
|
|
Re: [ATL] Reference output model elements [message #70708 is a reply to message #70651] |
Mon, 07 January 2008 10:18  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
This is a multi-part message in MIME format.
--------------090008050402010007030803
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Lisa,
OK! So, in ATL, you assign a reference of an output object with an input
object. This last will be replaced by a reference to the object created
from it.
Therefore, you do not handle directly the references but rather let them
to ATL.
I hope this meets your question.
Quentin
Lisa Kelly a
|
|
|
Powered by
FUDForum. Page generated in 0.04772 seconds