Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » resolveTemp in combination with multiple source patterns
resolveTemp in combination with multiple source patterns [message #25912] Tue, 27 March 2007 08:17 Go to next message
Eclipse UserFriend
Originally posted by: strommer.big.tuwien.ac.at

Is it somehow possible to use the resolveTemp operation to point to a
target model element that is generated by multiple sources?

Thx a lot,
Michael
[ATL] Re: resolveTemp in combination with multiple source patterns [message #25953 is a reply to message #25912] Tue, 27 March 2007 08:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marcos.didonet-del-fabro.univ-nantes.fr

Hello,

You mean to use resolveTemp for a rule that matches more than one element?

if this is the case, than it is possible. You need to use tuples. I give you a simple
example below:

consider the rule:

rule attribute_class {

from
in1 : MOF!EClass, in2 : MOF!EAttribute
to
output : metamodel!SomeElement (
),
output2 : metamodel!SomeElement2 (
)
}

you can use the resolveTemp as follows:

rule AnotherRule {

from
...
to
metamodel!SomeElement (
someProperty <- thisModule.resolveTemp(
-- Tuple { in1 = aClass, in2 = aAttribute} ,'output2')

You replace the "aClass", "aAttribute", "someProperty", etc. by your metamodel elements.


Regards,

Marcos.


Michael Strommer wrote:
> Is it somehow possible to use the resolveTemp operation to point to a
> target model element that is generated by multiple sources?
>
> Thx a lot,
> Michael
Re: [ATL] Re: resolveTemp in combination with multiple source patterns [message #26117 is a reply to message #25953] Wed, 28 March 2007 05:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: strommer.big.tuwien.ac.at

Hello,

thank you for the quick answer. In general the resolveTemp is used to
change the default target pattern. Unfortunately my use case is a little
bit different. Consider for example a merge of three elements from one
language into only one element in the other language:


rule EventFunction2OpaqueAction {
from
ev : EPC!Event,
f : EPC!BasicFunction,
c : EPC!ControlFlow
(
c.target = f and
c.source = ev
)

to
o : Activity!OpaqueAction (
...
)

}

Now i want to establish proper relationships to this newly created
OpaqueActions matching existing ControlFlows in the source model. Every
ControlFlow that has in the source model an Event as target feature now
has an OpaqueAction as target feature. (Vice versa for the source feature)

rule ControlFlow2ControlFlow {
from
cf : EPC!ControlFlow (cf.target -> oclIsTypeOf(EPC!Event))

to

cf2 : Activity!ControlFlow (
target <- thisModule.resolveTemp(Tuple{ev = EPC!Event, c =
EPC!ControlFlow, f = EPC!BasicFunction}, 'o') -> someOperation
source ....
)
}

To get this to work, resolveTemp would have to return a list of all
OpaqueActions being created, I could then apply some name matching upon.

Do you know how to deal with this kind of problem? (Still sticking to
multiple source patterns and avoiding helpers...)

Thx for your help,
Michael



Marcos Didonet Del Fabro schrieb:
> Hello,
>
> You mean to use resolveTemp for a rule that matches more than one element?
>
> if this is the case, than it is possible. You need to use tuples. I give
> you a simple example below:
>
> consider the rule:
>
> rule attribute_class {
>
> from
> in1 : MOF!EClass, in2 : MOF!EAttribute
> to
> output : metamodel!SomeElement (
> ),
> output2 : metamodel!SomeElement2 (
> )
> }
>
> you can use the resolveTemp as follows:
>
> rule AnotherRule {
>
> from
> ...
> to
> metamodel!SomeElement (
> someProperty <- thisModule.resolveTemp(
> -- Tuple { in1 = aClass, in2 = aAttribute} ,'output2')
>
> You replace the "aClass", "aAttribute", "someProperty", etc. by your
> metamodel elements.
>
>
> Regards,
>
> Marcos.
>
>
> Michael Strommer wrote:
>> Is it somehow possible to use the resolveTemp operation to point to a
>> target model element that is generated by multiple sources?
>>
>> Thx a lot,
>> Michael
Re: [ATL] Re: resolveTemp in combination with multiple source patterns [message #26159 is a reply to message #26117] Wed, 28 March 2007 07:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marcos.didonet-del-fabro.univ-nantes.fr

Hello,


Actually, in the resolveTemp, you should not put the type of the element (e.g., f =
EPC!BasicFunction, ev = EPC!Event,...), but the element itself, as shown below:

> cf2 : Activity!ControlFlow (
> target <- thisModule.resolveTemp(Tuple{ev = cf.target, c =
> cf, f = cf.source}, 'o') -> someOperation
> source ....

So, I think that instead of returning a list of all OpaqueAction, you should create some
condition inside the tuple to get the right elements. For instance, to get the right
control flow:

> target <- thisModule.resolveTemp(Tuple{ev = cf.target, c =
> EPC!ControlFlow.allInstances()->select (e | e.name = ...), f = cf.source}, 'o') ->
someOperation

I don't know your metamodel, but another solution can be to set the opposite reference,
ie, when you create the OpaqueAction object.


Regards,

Marcos.

Michael Strommer wrote:
> Hello,
>
> thank you for the quick answer. In general the resolveTemp is used to
> change the default target pattern. Unfortunately my use case is a little
> bit different. Consider for example a merge of three elements from one
> language into only one element in the other language:
>
>
> rule EventFunction2OpaqueAction {
> from
> ev : EPC!Event,
> f : EPC!BasicFunction,
> c : EPC!ControlFlow
> (
> c.target = f and
> c.source = ev
> )
>
> to
> o : Activity!OpaqueAction (
> ...
> )
>
> }
>
> Now i want to establish proper relationships to this newly created
> OpaqueActions matching existing ControlFlows in the source model. Every
> ControlFlow that has in the source model an Event as target feature now
> has an OpaqueAction as target feature. (Vice versa for the source feature)
>
> rule ControlFlow2ControlFlow {
> from
> cf : EPC!ControlFlow (cf.target -> oclIsTypeOf(EPC!Event))
>
> to
>
> cf2 : Activity!ControlFlow (
> target <- thisModule.resolveTemp(Tuple{ev = EPC!Event, c =
> EPC!ControlFlow, f = EPC!BasicFunction}, 'o') -> someOperation
> source ....
> )
> }
>
> To get this to work, resolveTemp would have to return a list of all
> OpaqueActions being created, I could then apply some name matching upon.
>
> Do you know how to deal with this kind of problem? (Still sticking to
> multiple source patterns and avoiding helpers...)
>
> Thx for your help,
> Michael
>
>
>
> Marcos Didonet Del Fabro schrieb:
>> Hello,
>>
>> You mean to use resolveTemp for a rule that matches more than one
>> element?
>>
>> if this is the case, than it is possible. You need to use tuples. I
>> give you a simple example below:
>>
>> consider the rule:
>>
>> rule attribute_class {
>>
>> from
>> in1 : MOF!EClass, in2 : MOF!EAttribute
>> to
>> output : metamodel!SomeElement (
>> ),
>> output2 : metamodel!SomeElement2 (
>> )
>> }
>>
>> you can use the resolveTemp as follows:
>>
>> rule AnotherRule {
>>
>> from
>> ...
>> to
>> metamodel!SomeElement (
>> someProperty <- thisModule.resolveTemp(
>> -- Tuple { in1 = aClass, in2 = aAttribute} ,'output2')
>>
>> You replace the "aClass", "aAttribute", "someProperty", etc. by your
>> metamodel elements.
>>
>>
>> Regards,
>>
>> Marcos.
>>
>>
>> Michael Strommer wrote:
>>> Is it somehow possible to use the resolveTemp operation to point to a
>>> target model element that is generated by multiple sources?
>>>
>>> Thx a lot,
>>> Michael
Re: [ATL] Re: resolveTemp in combination with multiple source patterns [message #26200 is a reply to message #26159] Wed, 28 March 2007 07:45 Go to previous message
Eclipse UserFriend
Originally posted by: strommer.big.tuwien.ac.at

Thx a lot. I tried both solutions and it works now.

Michael


Marcos Didonet Del Fabro schrieb:
> Hello,
>
>
> Actually, in the resolveTemp, you should not put the type of the element
> (e.g., f = EPC!BasicFunction, ev = EPC!Event,...), but the element
> itself, as shown below:
>
> > cf2 : Activity!ControlFlow (
> > target <- thisModule.resolveTemp(Tuple{ev = cf.target, c =
> > cf, f = cf.source}, 'o') -> someOperation
> > source ....
>
> So, I think that instead of returning a list of all OpaqueAction, you
> should create some condition inside the tuple to get the right elements.
> For instance, to get the right control flow:
>
> > target <- thisModule.resolveTemp(Tuple{ev = cf.target, c =
> > EPC!ControlFlow.allInstances()->select (e | e.name = ...), f =
> cf.source}, 'o') -> someOperation
>
> I don't know your metamodel, but another solution can be to set the
> opposite reference, ie, when you create the OpaqueAction object.
>
>
> Regards,
>
> Marcos.
>
> Michael Strommer wrote:
>> Hello,
>>
>> thank you for the quick answer. In general the resolveTemp is used to
>> change the default target pattern. Unfortunately my use case is a
>> little bit different. Consider for example a merge of three elements
>> from one language into only one element in the other language:
>>
>>
>> rule EventFunction2OpaqueAction {
>> from
>> ev : EPC!Event,
>> f : EPC!BasicFunction,
>> c : EPC!ControlFlow
>> (
>> c.target = f and
>> c.source = ev
>> )
>>
>> to o : Activity!OpaqueAction (
>> ...
>> )
>>
>> }
>>
>> Now i want to establish proper relationships to this newly created
>> OpaqueActions matching existing ControlFlows in the source model.
>> Every ControlFlow that has in the source model an Event as target
>> feature now has an OpaqueAction as target feature. (Vice versa for the
>> source feature)
>>
>> rule ControlFlow2ControlFlow {
>> from
>> cf : EPC!ControlFlow (cf.target -> oclIsTypeOf(EPC!Event))
>>
>> to
>> cf2 : Activity!ControlFlow (
>> target <- thisModule.resolveTemp(Tuple{ev = EPC!Event, c =
>> EPC!ControlFlow, f = EPC!BasicFunction}, 'o') -> someOperation
>> source ....
>> ) }
>>
>> To get this to work, resolveTemp would have to return a list of all
>> OpaqueActions being created, I could then apply some name matching upon.
>>
>> Do you know how to deal with this kind of problem? (Still sticking to
>> multiple source patterns and avoiding helpers...)
>>
>> Thx for your help,
>> Michael
>>
>>
>>
>> Marcos Didonet Del Fabro schrieb:
>>> Hello,
>>>
>>> You mean to use resolveTemp for a rule that matches more than one
>>> element?
>>>
>>> if this is the case, than it is possible. You need to use tuples. I
>>> give you a simple example below:
>>>
>>> consider the rule:
>>>
>>> rule attribute_class {
>>>
>>> from
>>> in1 : MOF!EClass, in2 : MOF!EAttribute
>>> to
>>> output : metamodel!SomeElement (
>>> ),
>>> output2 : metamodel!SomeElement2 (
>>> )
>>> }
>>>
>>> you can use the resolveTemp as follows:
>>>
>>> rule AnotherRule {
>>>
>>> from
>>> ...
>>> to
>>> metamodel!SomeElement (
>>> someProperty <- thisModule.resolveTemp(
>>> -- Tuple { in1 = aClass, in2 = aAttribute} ,'output2')
>>>
>>> You replace the "aClass", "aAttribute", "someProperty", etc. by your
>>> metamodel elements.
>>>
>>>
>>> Regards,
>>>
>>> Marcos.
>>>
>>>
>>> Michael Strommer wrote:
>>>> Is it somehow possible to use the resolveTemp operation to point to
>>>> a target model element that is generated by multiple sources?
>>>>
>>>> Thx a lot,
>>>> Michael
Previous Topic:[ATL] User interaction during transformation
Next Topic:Enumeration Type
Goto Forum:
  


Current Time: Wed May 14 15:25:46 EDT 2025

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

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

Back to the top