Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » How to duplicate an element
How to duplicate an element [message #105834] Fri, 29 May 2009 15:20 Go to next message
Martin Baez is currently offline Martin BaezFriend
Messages: 12
Registered: July 2009
Junior Member
I am a beginner and I am a bit lost dealing with this:

I have a metamodel with this structure

A <-> Connection <-> B

Where A has a collection of Connections, B has a Collection of
Connection and Connection has one A(opposite of connections in A) and
One B(opposite of connections in B)

If I have this instance of the previous metamodel:

a1 <-> conn1 <-> b1

and I want to generate something like this

a1 <-> Conn1 <-> b1
a1 <-> Conn1' <-> b1

I want to duplicate the Connection conn1. I want a1 and b1 connected
twice, with the original connection and a new one.
I dont know how to duplicate the connection conn1 and generate the new one.
I would preciate any clue about how to deal with this.

thanks in advance

colo
Re: How to duplicate an element [message #105862 is a reply to message #105834] Tue, 02 June 2009 06:35 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

You post concerns ATL or QVT?
You must prefix your post with the [ATL] or [QVT]

Colo a écrit :
> I am a beginner and I am a bit lost dealing with this:
>
> I have a metamodel with this structure
>
> A <-> Connection <-> B
>
> Where A has a collection of Connections, B has a Collection of
> Connection and Connection has one A(opposite of connections in A) and
> One B(opposite of connections in B)
>
> If I have this instance of the previous metamodel:
>
> a1 <-> conn1 <-> b1
>
> and I want to generate something like this
>
> a1 <-> Conn1 <-> b1
> a1 <-> Conn1' <-> b1
>
> I want to duplicate the Connection conn1. I want a1 and b1 connected
> twice, with the original connection and a new one.
> I dont know how to duplicate the connection conn1 and generate the new one.
> I would preciate any clue about how to deal with this.
>
> thanks in advance
>
> colo
[ATL] How to duplicate an element [message #106120 is a reply to message #105862] Fri, 05 June 2009 01:38 Go to previous messageGo to next message
Martin Baez is currently offline Martin BaezFriend
Messages: 12
Registered: July 2009
Junior Member
I am a beginner and I am a bit lost dealing with this:

I have a metamodel with this structure

A <-> Connection <-> B

Where A has a collection of Connections, B has a Collection of
Connection and Connection has one A(opposite of connections in A) and
One B(opposite of connections in B)

If I have this instance of the previous metamodel:

a1 <-> conn1 <-> b1

and I want to generate something like this

a1 <-> Conn1 <-> b1
a1 <-> Conn1' <-> b1

I want to duplicate the Connection conn1. I want a1 and b1 connected
twice, with the original connection and a new one.
I dont know how to duplicate the connection conn1 and generate the new one.
I would preciate any clue about how to deal with this.

thanks in advance

colo

Esteban DUGUEPEROUX escribió:
> Hi,
>
> You post concerns ATL or QVT?
> You must prefix your post with the [ATL] or [QVT]
>
> Colo a écrit :
>> I am a beginner and I am a bit lost dealing with this:
>>
>> I have a metamodel with this structure
>>
>> A <-> Connection <-> B
>>
>> Where A has a collection of Connections, B has a Collection of
>> Connection and Connection has one A(opposite of connections in A) and
>> One B(opposite of connections in B)
>>
>> If I have this instance of the previous metamodel:
>>
>> a1 <-> conn1 <-> b1
>>
>> and I want to generate something like this
>>
>> a1 <-> Conn1 <-> b1
>> a1 <-> Conn1' <-> b1
>>
>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>> twice, with the original connection and a new one.
>> I dont know how to duplicate the connection conn1 and generate the new
>> one.
>> I would preciate any clue about how to deal with this.
>>
>> thanks in advance
>>
>> colo
Re: [ATL] How to duplicate an element [message #106139 is a reply to message #106120] Sat, 06 June 2009 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: a.w.laarman.ewi.utwente.nl

Hi colo,

If the number of duplicates is constant, you can use the normal ATL rules to
solve this. That goes somehting like this:

rule AtoX {...}
rule BtoY {...}

rule ConnectiontoCC {
from i:Connection {..}
to o1:Connection2, o2:Connection2 {...}
}


Regards,
Alfons


On 6/5/09 3:38 AM, in article h09su3$h4k$1@build.eclipse.org, "Colo"
<martinbaez@gmail.com> wrote:

> I am a beginner and I am a bit lost dealing with this:
>
> I have a metamodel with this structure
>
> A <-> Connection <-> B
>
> Where A has a collection of Connections, B has a Collection of
> Connection and Connection has one A(opposite of connections in A) and
> One B(opposite of connections in B)
>
> If I have this instance of the previous metamodel:
>
> a1 <-> conn1 <-> b1
>
> and I want to generate something like this
>
> a1 <-> Conn1 <-> b1
> a1 <-> Conn1' <-> b1
>
> I want to duplicate the Connection conn1. I want a1 and b1 connected
> twice, with the original connection and a new one.
> I dont know how to duplicate the connection conn1 and generate the new one.
> I would preciate any clue about how to deal with this.
>
> thanks in advance
>
> colo
>
> Esteban DUGUEPEROUX escribió:
>> Hi,
>>
>> You post concerns ATL or QVT?
>> You must prefix your post with the [ATL] or [QVT]
>>
>> Colo a écrit :
>>> I am a beginner and I am a bit lost dealing with this:
>>>
>>> I have a metamodel with this structure
>>>
>>> A <-> Connection <-> B
>>>
>>> Where A has a collection of Connections, B has a Collection of
>>> Connection and Connection has one A(opposite of connections in A) and
>>> One B(opposite of connections in B)
>>>
>>> If I have this instance of the previous metamodel:
>>>
>>> a1 <-> conn1 <-> b1
>>>
>>> and I want to generate something like this
>>>
>>> a1 <-> Conn1 <-> b1
>>> a1 <-> Conn1' <-> b1
>>>
>>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>>> twice, with the original connection and a new one.
>>> I dont know how to duplicate the connection conn1 and generate the new
>>> one.
>>> I would preciate any clue about how to deal with this.
>>>
>>> thanks in advance
>>>
>>> colo
Re: [ATL] How to duplicate an element [message #107839 is a reply to message #106139] Sat, 04 July 2009 21:24 Go to previous messageGo to next message
Pantanowitz is currently offline PantanowitzFriend
Messages: 3
Registered: July 2009
Junior Member
Hello,
I'm an ATL novice too. My problem is similar to Colo's but with a couple
of complications. My metamodel is like this:

A contains -> B contains -> C ref -> D

So I have an instance like:

a contains -> b
b contains -> (c1, c2)
c1 ref->d1
c2 ref->d2

I want duplicate elements contained in "a" using ATL where the number
duplicates to create is computed by a some helpers. If I want 2
duplicates, the model should be like:

a contains -> b, b
b contains -> (c1, c2)
b contains -> (c1, c2)
c1 ref->d1
c2 ref->d2
c1 ref->d1
c2 ref->d2

Thanks a lot for your help. Please let me know if your any clarifications.

regards,
Panto

Alfons Laarman wrote:
> Hi colo,
>
> If the number of duplicates is constant, you can use the normal ATL rules to
> solve this. That goes somehting like this:
>
> rule AtoX {...}
> rule BtoY {...}
>
> rule ConnectiontoCC {
> from i:Connection {..}
> to o1:Connection2, o2:Connection2 {...}
> }
>
>
> Regards,
> Alfons
>
>
> On 6/5/09 3:38 AM, in article h09su3$h4k$1@build.eclipse.org, "Colo"
> <martinbaez@gmail.com> wrote:
>
>> I am a beginner and I am a bit lost dealing with this:
>>
>> I have a metamodel with this structure
>>
>> A <-> Connection <-> B
>>
>> Where A has a collection of Connections, B has a Collection of
>> Connection and Connection has one A(opposite of connections in A) and
>> One B(opposite of connections in B)
>>
>> If I have this instance of the previous metamodel:
>>
>> a1 <-> conn1 <-> b1
>>
>> and I want to generate something like this
>>
>> a1 <-> Conn1 <-> b1
>> a1 <-> Conn1' <-> b1
>>
>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>> twice, with the original connection and a new one.
>> I dont know how to duplicate the connection conn1 and generate the new one.
>> I would preciate any clue about how to deal with this.
>>
>> thanks in advance
>>
>> colo
>>
>> Esteban DUGUEPEROUX escribió:
>>> Hi,
>>>
>>> You post concerns ATL or QVT?
>>> You must prefix your post with the [ATL] or [QVT]
>>>
>>> Colo a écrit :
>>>> I am a beginner and I am a bit lost dealing with this:
>>>>
>>>> I have a metamodel with this structure
>>>>
>>>> A <-> Connection <-> B
>>>>
>>>> Where A has a collection of Connections, B has a Collection of
>>>> Connection and Connection has one A(opposite of connections in A) and
>>>> One B(opposite of connections in B)
>>>>
>>>> If I have this instance of the previous metamodel:
>>>>
>>>> a1 <-> conn1 <-> b1
>>>>
>>>> and I want to generate something like this
>>>>
>>>> a1 <-> Conn1 <-> b1
>>>> a1 <-> Conn1' <-> b1
>>>>
>>>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>>>> twice, with the original connection and a new one.
>>>> I dont know how to duplicate the connection conn1 and generate the new
>>>> one.
>>>> I would preciate any clue about how to deal with this.
>>>>
>>>> thanks in advance
>>>>
>>>> colo
>
Re: [ATL] How to duplicate an element [message #108230 is a reply to message #107839] Fri, 10 July 2009 21:16 Go to previous messageGo to next message
Martin Baez is currently offline Martin BaezFriend
Messages: 12
Registered: July 2009
Junior Member
hi Pantanowitz, I solved my problem using 2 transformations:

In the first one(t1) I created the duplicated elements only(but still
unconnected).

In the second one(t2) I connect the new elements created in t1 as needed.
The input models for t2 are the original one and the partial one I
created with t1.

I decided to do that because in atl you can just navigate your source
models. In the second transformation I navigate my original source
model, an the partial one created in t1 to connect the elements as needed.

I follow the basic pattern described here:

http://www.eclipse.org/m2m/atl/basicExamples_Patterns/articl e.php?file=SideEffect/index.html

I expect me to be clear.



colo





Pantanowitz escribió:
> Hello,
> I'm an ATL novice too. My problem is similar to Colo's but with a couple
> of complications. My metamodel is like this:
>
> A contains -> B contains -> C ref -> D
>
> So I have an instance like:
>
> a contains -> b
> b contains -> (c1, c2)
> c1 ref->d1
> c2 ref->d2
>
> I want duplicate elements contained in "a" using ATL where the number
> duplicates to create is computed by a some helpers. If I want 2
> duplicates, the model should be like:
>
> a contains -> b, b
> b contains -> (c1, c2)
> b contains -> (c1, c2)
> c1 ref->d1
> c2 ref->d2
> c1 ref->d1
> c2 ref->d2
>
> Thanks a lot for your help. Please let me know if your any clarifications.
>
> regards,
> Panto
>
> Alfons Laarman wrote:
>> Hi colo,
>>
>> If the number of duplicates is constant, you can use the normal ATL
>> rules to
>> solve this. That goes somehting like this:
>>
>> rule AtoX {...} rule BtoY {...}
>>
>> rule ConnectiontoCC {
>> from i:Connection {..}
>> to o1:Connection2, o2:Connection2 {...}
>> }
>>
>>
>> Regards,
>> Alfons
>>
>>
>> On 6/5/09 3:38 AM, in article h09su3$h4k$1@build.eclipse.org, "Colo"
>> <martinbaez@gmail.com> wrote:
>>
>>> I am a beginner and I am a bit lost dealing with this:
>>>
>>> I have a metamodel with this structure
>>>
>>> A <-> Connection <-> B
>>>
>>> Where A has a collection of Connections, B has a Collection of
>>> Connection and Connection has one A(opposite of connections in A) and
>>> One B(opposite of connections in B)
>>>
>>> If I have this instance of the previous metamodel:
>>>
>>> a1 <-> conn1 <-> b1
>>>
>>> and I want to generate something like this
>>>
>>> a1 <-> Conn1 <-> b1
>>> a1 <-> Conn1' <-> b1
>>>
>>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>>> twice, with the original connection and a new one.
>>> I dont know how to duplicate the connection conn1 and generate the
>>> new one.
>>> I would preciate any clue about how to deal with this.
>>>
>>> thanks in advance
>>>
>>> colo
>>>
>>> Esteban DUGUEPEROUX escribió:
>>>> Hi,
>>>>
>>>> You post concerns ATL or QVT?
>>>> You must prefix your post with the [ATL] or [QVT]
>>>>
>>>> Colo a écrit :
>>>>> I am a beginner and I am a bit lost dealing with this:
>>>>>
>>>>> I have a metamodel with this structure
>>>>>
>>>>> A <-> Connection <-> B
>>>>>
>>>>> Where A has a collection of Connections, B has a Collection of
>>>>> Connection and Connection has one A(opposite of connections in A) and
>>>>> One B(opposite of connections in B)
>>>>>
>>>>> If I have this instance of the previous metamodel:
>>>>>
>>>>> a1 <-> conn1 <-> b1
>>>>>
>>>>> and I want to generate something like this
>>>>>
>>>>> a1 <-> Conn1 <-> b1
>>>>> a1 <-> Conn1' <-> b1
>>>>>
>>>>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>>>>> twice, with the original connection and a new one.
>>>>> I dont know how to duplicate the connection conn1 and generate the new
>>>>> one.
>>>>> I would preciate any clue about how to deal with this.
>>>>>
>>>>> thanks in advance
>>>>>
>>>>> colo
>>
Re: [ATL] How to duplicate an element [message #108260 is a reply to message #108230] Sat, 11 July 2009 15:59 Go to previous message
Pantanowitz is currently offline PantanowitzFriend
Messages: 3
Registered: July 2009
Junior Member
Thanks Colo,
It's sucks that ATL does not allow you to navigate the target model. I
was hoping there was an elegant way to use the resolveTemp operation to
helps us out! But I guess it's better to have something that works ;)
and your approach makes sense!
thanks,

Panto,

Colo wrote:
> hi Pantanowitz, I solved my problem using 2 transformations:
>
> In the first one(t1) I created the duplicated elements only(but still
> unconnected).
>
> In the second one(t2) I connect the new elements created in t1 as needed.
> The input models for t2 are the original one and the partial one I
> created with t1.
>
> I decided to do that because in atl you can just navigate your source
> models. In the second transformation I navigate my original source
> model, an the partial one created in t1 to connect the elements as needed.
>
> I follow the basic pattern described here:
>
> http://www.eclipse.org/m2m/atl/basicExamples_Patterns/articl e.php?file=SideEffect/index.html
>
>
> I expect me to be clear.
>
>
>
> colo
>
>
>
>
>
> Pantanowitz escribió:
>> Hello,
>> I'm an ATL novice too. My problem is similar to Colo's but with a
>> couple of complications. My metamodel is like this:
>>
>> A contains -> B contains -> C ref -> D
>>
>> So I have an instance like:
>>
>> a contains -> b
>> b contains -> (c1, c2)
>> c1 ref->d1
>> c2 ref->d2
>>
>> I want duplicate elements contained in "a" using ATL where the number
>> duplicates to create is computed by a some helpers. If I want 2
>> duplicates, the model should be like:
>>
>> a contains -> b, b
>> b contains -> (c1, c2)
>> b contains -> (c1, c2)
>> c1 ref->d1
>> c2 ref->d2
>> c1 ref->d1
>> c2 ref->d2
>>
>> Thanks a lot for your help. Please let me know if your any
>> clarifications.
>>
>> regards,
>> Panto
>>
>> Alfons Laarman wrote:
>>> Hi colo,
>>>
>>> If the number of duplicates is constant, you can use the normal ATL
>>> rules to
>>> solve this. That goes somehting like this:
>>>
>>> rule AtoX {...} rule BtoY {...}
>>>
>>> rule ConnectiontoCC {
>>> from i:Connection {..}
>>> to o1:Connection2, o2:Connection2 {...}
>>> }
>>>
>>>
>>> Regards,
>>> Alfons
>>>
>>>
>>> On 6/5/09 3:38 AM, in article h09su3$h4k$1@build.eclipse.org, "Colo"
>>> <martinbaez@gmail.com> wrote:
>>>
>>>> I am a beginner and I am a bit lost dealing with this:
>>>>
>>>> I have a metamodel with this structure
>>>>
>>>> A <-> Connection <-> B
>>>>
>>>> Where A has a collection of Connections, B has a Collection of
>>>> Connection and Connection has one A(opposite of connections in A) and
>>>> One B(opposite of connections in B)
>>>>
>>>> If I have this instance of the previous metamodel:
>>>>
>>>> a1 <-> conn1 <-> b1
>>>>
>>>> and I want to generate something like this
>>>>
>>>> a1 <-> Conn1 <-> b1
>>>> a1 <-> Conn1' <-> b1
>>>>
>>>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>>>> twice, with the original connection and a new one.
>>>> I dont know how to duplicate the connection conn1 and generate the
>>>> new one.
>>>> I would preciate any clue about how to deal with this.
>>>>
>>>> thanks in advance
>>>>
>>>> colo
>>>>
>>>> Esteban DUGUEPEROUX escribió:
>>>>> Hi,
>>>>>
>>>>> You post concerns ATL or QVT?
>>>>> You must prefix your post with the [ATL] or [QVT]
>>>>>
>>>>> Colo a écrit :
>>>>>> I am a beginner and I am a bit lost dealing with this:
>>>>>>
>>>>>> I have a metamodel with this structure
>>>>>>
>>>>>> A <-> Connection <-> B
>>>>>>
>>>>>> Where A has a collection of Connections, B has a Collection of
>>>>>> Connection and Connection has one A(opposite of connections in A) and
>>>>>> One B(opposite of connections in B)
>>>>>>
>>>>>> If I have this instance of the previous metamodel:
>>>>>>
>>>>>> a1 <-> conn1 <-> b1
>>>>>>
>>>>>> and I want to generate something like this
>>>>>>
>>>>>> a1 <-> Conn1 <-> b1
>>>>>> a1 <-> Conn1' <-> b1
>>>>>>
>>>>>> I want to duplicate the Connection conn1. I want a1 and b1 connected
>>>>>> twice, with the original connection and a new one.
>>>>>> I dont know how to duplicate the connection conn1 and generate the
>>>>>> new
>>>>>> one.
>>>>>> I would preciate any clue about how to deal with this.
>>>>>>
>>>>>> thanks in advance
>>>>>>
>>>>>> colo
>>>
Previous Topic:[ATL] collecting transformation trace information
Next Topic:[ATL] Running ATL Transformation from JAVA
Goto Forum:
  


Current Time: Thu Apr 25 11:58:48 GMT 2024

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

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

Back to the top