Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Select a Component from bag
Select a Component from bag [message #765707] Wed, 14 December 2011 14:54 Go to next message
Ahsan Missing name is currently offline Ahsan Missing name
Messages: 10
Registered: December 2011
Location: Munich, Germany
Junior Member

index.php/fa/6476/0/Hello Every one

I have been trying to map two elements for a long time but unfortunately due to my limited experience and knowledge I can not figure out a solution. I will much appreciate if any one can guide me little bit. I have attached a rough sketch of the scenario.
In the attached figure I have two attributes in the Class2 named IN and Out and of type XYZ. The source class has two aggregated elements of same type. The aggregated elements have an attribute DIRECTION whose value is defined by another enumeration class.

I have a separate mapping function for the type XYZ.

what i want to do is to map the aggregated element of Class 1 whose direction is IN to the IN attribute of class 2.

Is there any possible solution for this. Please correct if I am wrong some where

Thanks in Advance.

  • Attachment: mapping.jpg
    (Size: 351.93KB, Downloaded 136 times)
Re: Select a Component from bag [message #765708 is a reply to message #765707] Wed, 14 December 2011 14:55 Go to previous messageGo to next message
Ahsan Missing name is currently offline Ahsan Missing name
Messages: 10
Registered: December 2011
Location: Munich, Germany
Junior Member

ops sorry for such a large size image
Re: Select a Component from bag [message #765720 is a reply to message #765707] Wed, 14 December 2011 15:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

It is far from clear what your problem is or what transformation
language you are trying to use.

The solution appears to be in your title. Use an OCL select().

Regards

Ed Willink

On 14/12/2011 06:54, Ahsan wrote:
> Hello Every one
>
> I have been trying to map two elements for a long time but unfortunately due to my limited experience and knowledge I can not figure out a solution. I will much appreciate if any one can guide me little bit. I have attached a rough sketch of the scenario.
> In the attached figure I have two attributes in the Class2 named IN and Out and of type XYZ. The source class has two aggregated elements of same type. The aggregated elements have an attribute DIRECTION whose value is defined by another enumeration class.
>
> I have a separate mapping function for the type XYZ.
>
> what i want to do is to map the aggregated element of Class 1 whose direction is IN to the IN attribute of class 2.
>
> Is there any possible solution for this. Please correct if I am wrong some where
>
> Thanks in Advance.
>
>
Re: Select a Component from bag [message #765727 is a reply to message #765720] Wed, 14 December 2011 15:32 Go to previous messageGo to next message
Ahsan Missing name is currently offline Ahsan Missing name
Messages: 10
Registered: December 2011
Location: Munich, Germany
Junior Member

Hello Ed

thanks for the reply I appreciate that. I am using qvto for the transformations. I understood that select returns a set(bag) of elements.
for example for a transformation like
IN:= class1.port -> select ( port whose direction is IN)
the error is that IN is a component of type XYZ however I am trying to assign a bag to it. This is what my problem is.

I hope i was able to explain it better this time.

Regards



Re: Select a Component from bag [message #765746 is a reply to message #765727] Wed, 14 December 2011 15:49 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

I still don't understand, but perhaps type conversions such as
oclAsBag(), oclAsSet() or any(true) might help.

Regards

Ed Willink

On 14/12/2011 07:32, Ahsan wrote:
> Hello Ed
>
> thanks for the reply I appreciate that. I am using qvto for the
> transformations. I understood that select returns a set(bag) of elements.
> for example for a transformation like
> IN:= class1.port -> select ( port whose direction is IN)
> the error is that IN is a component of type XYZ however I am trying to
> assign a bag to it. This is what my problem is.
>
> I hope i was able to explain it better this time.
>
> Regards
>
>
>
>
Previous Topic:[ATL] - Create Integer set and add a new integer.
Next Topic:[ATL] calling a lazy rule with arguments
Goto Forum:
  


Current Time: Tue Sep 23 00:22:05 GMT 2014

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

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