Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » multi-reference transformation problem(problem with multi references and some attributes during ATL transformation)
multi-reference transformation problem [message #689768] Tue, 28 June 2011 10:13 Go to next message
Emwedish Endargachew is currently offline Emwedish EndargachewFriend
Messages: 27
Registered: April 2011
Junior Member
Dear All,
I am currently writing a code to make model transformation using ATL. What is currently happening is that, when i try to make transformation which has multiple references, where one classes references to the other class which the other class also is referenced to the other class, and my situation is i have to keep the references respectively. During this transformation, i am getting the following result on my xmi target model,
<attributeTypes attributeType="/0/@types"/> where attributeTypes contains a reference to AttributeType, However the content to the class AttributeType is listed out of the intended class. And btw i do not know where "/0/@types"/ comes from and what it means. The other issue is when i make transformation, there are some attributes which does not show up at the result, and i do not know the reason why they do not show up at the target model. Is there any one who is getting same outputs? Please share what happened and how did solve it. Let me give u the code i am using to make the transformation

rule transfor1
{
from i: XML!Element(i.name = 'XX')
to o: Model2!classA(
attributeTypes <- atypes,
types <- i.children ->select(c|c.oclIsKindOf(XML!Element)) -> asSequence()

),
atypes:Model2!AttributeTypes(
attributeType <- i.children -> select(c|c.oclIsKindOf(XML!Element) ->asSequence()
)

}

rule Types
{
from i:XML!Element(i.name = 'Types')
to o:Model2!Types(
xx <- i.children ->select(c|c.oclIsKindOf(XML!Element) -> asSequence(), --reference
yy <- i.children ->select(c|c.oclIsKindOf(XML!Element) -> asSequence() --this is another reference
)
}

rule AttributeType
{
from i:XML!Element(i.name = 'AttributeType')
to o:Model2!AttributeType(
name <- i.getAttrVal('name'), --- this is an attribute
rr <- i.children -> select(c|c.oclIsKindOf(XML!Element)) -> asSequence --this is another reference
)
}

and the output i am getting is:
<XML:classA>
<type>
<xx/>
<yy/>
</type>
<attributeTypes attributeType="/0/@types"/>
</XML:classA>
<XML:AttributeType name="SDVA"/>

does "/0/@types" mean it is referenced to the last line which is XML:AttributeType name = "SDVA" ? I am not sure how data, nodes and stuff are organized but my guess is that if it was the right one it would have been like
<XML:classA>
<type>
<xx/>
<yy/>
</type>
<attributeTypes>
<AttributeType name="SDVA"/>
<AttributeTypes/>
</XML:classA>


I need it very badly, please help if there is someone with the same problem.

Thanks in advance
Re: multi-reference transformation problem [message #689974 is a reply to message #689768] Tue, 28 June 2011 16:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Comments below.

On 28/06/2011 3:13 AM, Emwedish wrote:
> Dear All,
> I am currently writing a code to make model transformation using ATL.
> What is currently happening is that, when i try to make transformation
> which has multiple references, where one classes references to the
> other class which the other class also is referenced to the other
> class, and my situation is i have to keep the references respectively.
> During this transformation, i am getting the following result on my
> xmi target model, <attributeTypes attributeType="/0/@types"/> where
> attributeTypes contains a reference to AttributeType, However the
> content to the class AttributeType is listed out of the intended
> class. And btw i do not know where "/0/@types"/ comes from and what it
> means.
It's path to navigate the first object at the root of the same resource
and then to the types reference of that object.
> The other issue is when i make transformation, there are some
> attributes which does not show up at the result, and i do not know the
> reason why they do not show up at the target model. Is there any one
> who is getting same outputs? Please share what happened and how did
> solve it. Let me give u the code i am using to make the transformation
>
> rule transfor1
> {
> from i: XML!Element(i.name = 'XX')
> to o: Model2!classA(
> attributeTypes <- atypes,
> types <- i.children ->select(c|c.oclIsKindOf(XML!Element)) ->
> asSequence()
>
> ),
> atypes:Model2!AttributeTypes(
> attributeType <- i.children ->
> select(c|c.oclIsKindOf(XML!Element) ->asSequence() )
>
> }
>
> rule Types
> {
> from i:XML!Element(i.name = 'Types')
> to o:Model2!Types(
> xx <- i.children ->select(c|c.oclIsKindOf(XML!Element) ->
> asSequence(), --reference
> yy <- i.children ->select(c|c.oclIsKindOf(XML!Element) ->
> asSequence() --this is another reference
> )
> }
>
> rule AttributeType
> {
> from i:XML!Element(i.name = 'AttributeType')
> to o:Model2!AttributeType(
> name <- i.getAttrVal('name'), --- this is an attribute
> rr <- i.children -> select(c|c.oclIsKindOf(XML!Element)) ->
> asSequence --this is another reference
> )
> }
>
> and the output i am getting is:
> <XML:classA>
> <type>
> <xx/>
> <yy/>
> </type>
> <attributeTypes attributeType="/0/@types"/>
> </XML:classA>
> <XML:AttributeType name="SDVA"/>
>
> does "/0/@types" mean it is referenced to the last line which is
> XML:AttributeType name = "SDVA" ? I am not sure how data, nodes and
> stuff are organized but my guess is that if it was the right one it
> would have been like
> <XML:classA>
> <type>
> <xx/>
> <yy/>
> </type>
> <attributeTypes>
> <AttributeType name="SDVA"/>
> <AttributeTypes/>
> </XML:classA>
>
>
> I need it very badly, please help if there is someone with the same
> problem.
> Thanks in advance
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: multi-reference transformation problem [message #690195 is a reply to message #689974] Wed, 29 June 2011 07:01 Go to previous messageGo to next message
Emwedish Endargachew is currently offline Emwedish EndargachewFriend
Messages: 27
Registered: April 2011
Junior Member
Hi Ed Merks,
Thanks for the reply. So does this mean it is referencing to the AttributeType which is listed at the bottom or it is just a reference and had no element yet. I do not get it. Can you for example try to explain it which one is referencing to according to the target model i gave on the question, if it is possible. Or do u mean the way it is representing the target model is the way it should be?

Thanks in advance,
Re: multi-reference transformation problem [message #691268 is a reply to message #690195] Fri, 01 July 2011 06:27 Go to previous message
Emwedish Endargachew is currently offline Emwedish EndargachewFriend
Messages: 27
Registered: April 2011
Junior Member
Hi Ed Merks,
Thanks, i got what you meant.
Previous Topic:After i Inject the XML using the AM3, the created model or XMI does not conform the XMI model
Next Topic:[ATL] What does this runtime error mean?
Goto Forum:
  


Current Time: Thu Apr 25 03:35:53 GMT 2024

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

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

Back to the top