Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] how to convert relationName among two classes into Element in XML as Target
[ATL] how to convert relationName among two classes into Element in XML as Target [message #552953] Sun, 15 August 2010 01:25 Go to next message
Transformed is currently offline Transformed
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

[Updated on: Sun, 15 August 2010 02:07]

Report message to a moderator

Re: [ATL] how to convert relationName among two classes into Element in XML as Target [message #553050 is a reply to message #552953] Mon, 16 August 2010 05:19 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 522
Registered: July 2009
Senior Member
You can't transform relations but you transform elements. Try to transform each BPEL!PartnerLink to a XML!Element partnerLink with an attribute name with the name of the PartnerLink and then the partnerLinks relation is transformed to :

partnerLinks: XML!Element(
name <- 'partnerLinks',
children <- s.partnerLinks
)
Previous Topic:[ATL] How to generate customized name spaces in an element?
Next Topic:[QVTo] Two new QVTo bugs...
Goto Forum:
  


Current Time: Sat Aug 30 12:42:21 EDT 2014

Powered by FUDForum. Page generated in 0.04499 seconds