Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Mapping not working([QVTO] Mapping not working)
[QVTO] Mapping not working [message #536846] Mon, 31 May 2010 09:17
Vishal seth is currently offline Vishal sethFriend
Messages: 32
Registered: April 2010
Member
Hi,

Trying to do a very basic transformation using QVT, but doesn't work.

My ecore model is :

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="myDsl"
nsURI="http://www.xtext.org/example/mydsl/MyDsl" nsPrefix="myDsl">
<eClassifiers xsi:type="ecore:EClass" name="Namespace">
<eStructuralFeatures xsi:type="ecore:EReference" name="elements" upperBound="-1"
eType="#//ModelElement" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ModelElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="case" eType="#//Case" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Case">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>


& instance file is :

<?xml version="1.0" encoding="UTF-8"?>
<myDsl:Namespace xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myDsl="http://www.xtext.org/example/mydsl/MyDsl">
<elements>
<case name="Name">
</case>
</elements>
</myDsl:Namespace>

QVT file is as:

modeltype myDslTransform uses "http://www.xtext.org/example/myDslTransform/myDslTransform";

modeltype myDsl uses "http://www.xtext.org/example/mydsl/MyDsl";

transformation NewTransformation(in source:myDsl,out target:myDslTransform);

main() {
source.rootObjects()[Namespace] -> map NamespaceToNS();
log("comes here in main " );
}

mapping Namespace::NamespaceToNS():myDslTransform::NS{
log("NamespaceToNS " + self.metaClassName() );
self.subobjects() -> map ModelElementToME();
}


But the above thing does not work. It does not traverse to the mapping NamespaceToNS().
But if write the QVTo file like as below then it works & traverse through the next mapping but then it wont solve the purpose.

The log statement self.metaClassName() gives Namespace. But then not sure what the problem is?

main() {
source.rootObjects()[Element] -> map NamespaceToNS();
log("comes here in main " );
}

mapping Element::NamespaceToNS():myDslTransform::NS{
log("NamespaceToNS " + self.metaClassName() );
self.subobjects() -> map ModelElementToME();
}


Thanks
Vishal

[Updated on: Mon, 31 May 2010 09:20]

Report message to a moderator

Previous Topic:[ATL] Transformation crashes on saving
Next Topic:[QVTO] load metamodel programmatically
Goto Forum:
  


Current Time: Tue Apr 16 17:17:31 GMT 2024

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

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

Back to the top