How to distinguish several in- and out-models [message #22520] |
Fri, 09 March 2007 12:22  |
Eclipse User |
|
|
|
Originally posted by: kehrer.hdm-stuttgart.de
Hello,
I have the following situation:
An ATL transformation with several in- and out-models conorming to the same
metamodel (In my case: UML2)
Looks like this.
create OUT : UML2, TRACE_OUT : UML2 from IN : UML2, TRACE_IN : UML2;
now my problem:
how can I refer to those models in the rule specification?
The examples always consider exactly ONE input and output model.
But how can I tell the ATL-engine, in which model to create or match the
elements?
Thanks for any hints
Timo
|
|
|
Re: How to distinguish several in- and out-models [message #23010 is a reply to message #22520] |
Mon, 12 March 2007 07:40   |
Eclipse User |
|
|
|
Originally posted by: marcos.didonet-del-fabro.univ-nantes.fr
Hi,
in the guard, you can use the method allInstancesFrom, like this:
rule MultipleInput {
from
c : UML2!Class (UML2!Class.allInstancesFrom('IN')->exists ( e | e = c) )
to
...
}
Concerning the output models, try to use different identifiers for the output metamodels,
as shown in the example below:
create OUT : UML_OUT1, TRACE_OUT : UML_OUT2 from ...
rule MultipleOutput {
...
to
model1: UML_OUT1 (
),
model2 : UML_OUT2 (
)
}
Regards,
Marcos.
Timo Kehrer wrote:
> Hello,
>
> I have the following situation:
> An ATL transformation with several in- and out-models conorming to the same
> metamodel (In my case: UML2)
> Looks like this.
>
> create OUT : UML2, TRACE_OUT : UML2 from IN : UML2, TRACE_IN : UML2;
>
> now my problem:
> how can I refer to those models in the rule specification?
> The examples always consider exactly ONE input and output model.
> But how can I tell the ATL-engine, in which model to create or match the
> elements?
>
>
> Thanks for any hints
> Timo
>
>
|
|
|
Re: How to distinguish several in- and out-models [message #23493 is a reply to message #22520] |
Thu, 15 March 2007 07:16  |
Eclipse User |
|
|
|
Originally posted by: ajossic.sodius.com
Hi Timo Kehrer,
I have fix this problem through this following way:
I use two helpers that tell me if the entity come from the appropriate
model:
//header
create merge : ATL from left : ATL, right : ATL;
helper context ATL!Element def : isLeft : Boolean =
ATL!Element.allInstancesFrom('left')
->exists(e | e = self)
;
// helper
helper context ATL!Element def : isRight : Boolean =
ATL!Element.allInstancesFrom('right')
->exists(e | e = self)
I used these to distinguish from which model come from the entities:
//rules
rule matchedRuleFromLeft {
from
lelftMR : ATL!MatchedRule (
lelftMR.isLeft
)
to
m : ATL!MatchedRule (
...
)
}
rule matchedRuleFromRight {
from
rightMR: ATL!MatchedRule (
rightMR.isRight
)
to
m : ATL!MatchedRule (
...
)
}
To optimize your code, i advice you to implement the helpers on your
top-level metatype.
I hope that helps you.
Best Regards,
Albin.
---------------------------------
Albin JOSSIC (ajossic@sodius.com)
SODIUS
6, rue Cornouaille
44319 Nantes - France
Phone: +33 (0)2 28 23 54 34
www.mdworkbench.com
Draw more value from your model
---------------------------------
Timo Kehrer a écrit :
> Hello,
>
> I have the following situation:
> An ATL transformation with several in- and out-models conorming to
the same metamodel (In my case: UML2)
> Looks like this.
>
> create OUT : UML2, TRACE_OUT : UML2 from IN : UML2, TRACE_IN : UML2;
>
> now my problem:
> how can I refer to those models in the rule specification?
> The examples always consider exactly ONE input and output model.
> But how can I tell the ATL-engine, in which model to create or match
the elements?
>
>
> Thanks for any hints
> Timo
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03502 seconds