Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [Xtend] Problem with a specific transformation
[Xtend] Problem with a specific transformation [message #548257] Wed, 21 July 2010 09:22
schm
Messages: 17
Registered: June 2010
Junior Member
Hi,

I wrote a transformation and get weird results. My transformation looks like this:

//Start Model Transformation here.

create Entity transformDocumentRoot(DocumentRoot documentRoot):
documentRoot.specifications.specification.transformSpecificationType(this) ->
    this.setName("I'm a DocumentRoot!")
;

Void transformSpecificationType(SpecificationType specification, Entity parent):
parent.childEntities.addAll(specification.blockDiagramSpecification.diagramElements.diagramElement.transformDiagramElementT())
;

create Entity transformDiagramElementT(DiagramElementT diagramElementT):
this.setName("I'm a DiagramElementT!")
;


My input looks like this (abbreviated version):

<?xml version="1.0" encoding="UTF-8"?>
<ComponentSpecification:Specifications ...>
	<Layout ...>
		...
	</Layout>
	<Specification name="Main" public="public">
		<BlockDiagramSpecification>
			<ESDLCode>
				...
			</ESDLCode>
			<DiagramElements>
				<DiagramElement>
					...
				</DiagramElement>
				<DiagramElement>
					...
				</DiagramElement>
				<DiagramElement>
					...
				</DiagramElement>
				<DiagramElement>
					...
				</DiagramElement>
				<DiagramElement>
					...
				</DiagramElement>
				<DiagramElement>
					...
				</DiagramElement>
				<DiagramElement>
					...
				</DiagramElement>
			</DiagramElements>
		</BlockDiagramSpecification>
	</Specification>
	<Signature ...  >
		...
	</Signature>
</ComponentSpecification:Specifications>


And the output looks like this:

<?xml version="1.0" encoding="ASCII"?>
<kaom:Entity xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:kaom="http://kieler.cs.cau.de/KAOM" xsi:schemaLocation="http://kieler.cs.cau.de/KAOM java://de.cau.cs.kieler.kaom.KaomPackage" name="I'm a DocumentRoot!"/>


As you can see, the DiagramElement objects are missing, although I tried to collect them by iterating over the list of Specification objects and over the lists of DiagramElement objects in every list of Specification objects. (In this example there is only one Specification object in the Specifications object (note the additional 's').)

[Updated on: Wed, 21 July 2010 09:23]

Report message to a moderator

Previous Topic:[QVTo] Access EMF model enum value
Next Topic:[QVTO/OCL] Usage of non-standard "closure" operator
Goto Forum:
  


Current Time: Wed Oct 22 03:17:58 GMT 2014

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

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