Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » How to distinguish several in- and out-models
How to distinguish several in- and out-models [message #22520] Fri, 09 March 2007 17:22 Go to next message
Eclipse UserFriend
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 11:40 Go to previous messageGo to next message
Eclipse UserFriend
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 11:16 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:[ATL] New ATL use case: Implementing two business rule languages: PRR and IRL
Next Topic:derived classes
Goto Forum:
  


Current Time: Tue Mar 19 07:11:19 GMT 2024

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

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

Back to the top