Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Problem in ATL transformation rule
Problem in ATL transformation rule [message #552751] Fri, 13 August 2010 07:34 Go to next message
Transformed is currently offline Transformed
Messages: 21
Registered: June 2010
Junior Member
Hi all,
I am having problem with output format of the XML file.

The xml.km3 file is like this
package PrimitiveTypes {
datatype Boolean;
datatype Integer;
datatype String;
}
package XML {
abstract class Node {
reference parent[0-1] : Element oppositeOf children;
attribute startLine[0-1] : Integer;
attribute startColumn[0-1] : Integer;
attribute endLine[0-1] : Integer;
attribute endColumn[0-1] : Integer;
attribute name : String;
attribute value : String;
}
class Attribute extends Node {
}
class Text extends Node {
}
class Element extends Node {
reference children[*] ordered container : Node oppositeOf parent;
}
class Root extends Element {
}
}

here is my XMI input file for the ATL code presented below.
sample XMI (IN:BPEL) file
<?xml version="1.0" encoding="ISO-8859-1"?>
<BPEL:Process xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:BPEL="uri:BPEL.ecore" name="ManRoleType" targetNameSpace="http://example .org/build2order">

This is my ATL file with the rule.
--******************ATL FILE ************
module BPEL2XML;
create OUT : XML from IN : BPEL;
rule Process2Root{
from
s : BPEL!Process( ]
s.oclIsTypeOf(BPEL!Process)
)
to
t : XML!Root(
name <- 'process',
children <- Sequence{xmlns, name}
),
xmlns : XML!Attribute(
name <- 'xmlns',
value <- 'http://myproject.com/wsbpel'
),

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

This is my output which is not as I had expected.
Output
<?xml version="1.0" encoding="ISO-8859-1"?>
<Root xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="XML" name="process">
  <children xsi:type="Attribute" name="xmlns" value="http://docs.oasis-open.org/wsbpel/2.0/process/abstract"/>
  <children xsi:type="Attribute" name="name" value="ManRoleType"/>
</Root>

This is my expected output.
-----------> Expected output <---------------------
Expected Output
<?xml version="1.0" encoding="ISO-8859-1"?>
<process name="ManRoleType xmlns="http://myproject.com/wsbpel">
</process>

What sort of changes should I make in ATL rule so that I will get the expected output of BPEL file.

I wanted to use XML extractor from AM3 but I tried this transformation without installing AM3. Does it also make difference. Like could this be due to the fact that I did not use the AM3.savemodel as mentioned below.

<am3.saveModel model="abc" path="${outputFilesDirectoryPath}/${name}.bpel">
			<extractor name="xml"/>
</am3.saveModel>


Thanking in advance!
Re: Problem in ATL transformation rule [message #552952 is a reply to message #552751] Sun, 15 August 2010 01:21 Go to previous message
Transformed is currently offline Transformed
Messages: 21
Registered: June 2010
Junior Member
Solved !!!

Smile
Previous Topic:plugin atl
Next Topic:[QVT-R] Specifications
Goto Forum:
  


Current Time: Thu Aug 21 12:17:04 EDT 2014

Powered by FUDForum. Page generated in 0.01890 seconds