Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » AM3 » Interesting problem(How to transform relationship of XMI of a metamodel instance into XML Element)
Interesting problem [message #552951] Sun, 15 August 2010 05:08 Go to next message
Transformed is currently offline TransformedFriend
Messages: 21
Registered: June 2010
Junior Member
Hi all,
I have an ecore model with Process class containing variable class with Variables association name and partnerLink class with partnerLinks association name as shown below.
		|--{Variables}--> |variable|
|Process| <composite>  
		|--{partnerLinks}--> |partnerLink|

The respective XMI instance looks like this
<BPEL:Process xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"name="ManRoleType" targetNameSpace="http://abc.com">
  <variables name="POChannelInstance"/>
  <variables name="CPUnotInStock"/>
  <partnerLinks name="CustRoleType"/>
  <partnerLinks name="SupCPURoleType"/>
</BPEL:Process>


I am using AM3 extractor to generate an XML document which looks like this
<process >
	<partnerLinks>
		<partnerLink name=CustRoleType />
		<partnerLink name=SupCPURoleType/>
	</partnerLinks>
	
	<varilables>
		<varilable name= POChannelInstance/>
		<varilable name= CPUnotInStock/>
	</varilables>
</process>

Now, my problem is how can I specify those relationnames namely partnerLinks and variables into as an Element of XML.

Following ATL code does not help.
rule Process2Root{
	from
		s	:	BPEL!Process
	to
		t	:	XML!Root(
			name <- 'process',
			children <- Sequence{xmlns, name, partnerLinks}
	),
	xmlns	:	XML!Attribute(
		name <- 'xmlns',
		value <- 'http://docs.oasis-open.org/wsbpel/2.0/process/executable'
		),
		
		name	:	XML!Attribute(
			name <- 'name',
		 value <- s.name ),
partnerLinks:	XML!Element(
			name <- 'partnerLinks'	
		)		
}

rule prtnerlinks2Elements (
from s: BPEL!PartnerLinks <!-- This is error now as BPEL metamodle does not have PartnerLinks as class -->
)

How should I work out to make partnerLinks and variables as elemtents that contains partnerlink and variable respectively?

Thanks
Re: Interesting problem [message #554721 is a reply to message #552951] Tue, 24 August 2010 08:42 Go to previous message
Guillaume Doux is currently offline Guillaume DouxFriend
Messages: 56
Registered: July 2009
Member
Hi,

If I have understood your problem correctly, the problem is in the From of the second rule.

In this "from" part of your ATL code you should have a class name,
You should use the name of the relation type name and not the relation name.

So you should use:
from s: BPEL!PartnerLink (without the s)

By looking at your code I see a second point:

rule Process2Root{
from
s : BPEL!Process
to
t : XML!Root(
name <- 'process',
children <- Sequence{xmlns, name, partnerLinks}
),
xmlns : XML!Attribute(
name <- 'xmlns',
value <- 'http://docs.oasis-open.org/wsbpel/2.0/process/executable'
),

name : XML!Attribute(
name <- 'name',
value <- s.name ),
partnerLinks: XML!Element(
name <- 'partnerLinks'
)

}

The bold part seems to be incomplete, you should specify that you want the parterlinks of the current process as child of this partnerLinks node. So you should do something like:

partnerLinks: XML!Element(
name <- 'partnerLinks',
children <- s.partnerLinks
)

With that the bindings with the PartnerLink elements created from the second rule will be done automatically by ATL.

I hope it will help you,

B.R.

Guillaume
Previous Topic:problem on installing new am3
Next Topic:Interesting problem
Goto Forum:
  


Current Time: Sat Nov 29 03:50:24 GMT 2014

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

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