Compilation errors found in unit when calling QVTo transform [message #1800528] |
Tue, 01 January 2019 13:27 |
Gururaj Maddodi Messages: 7 Registered: October 2018 |
Junior Member |
|
|
Hello,
First of all happy new year. I'm trying to call my simple QVTo transform from java plugin. I create a plugin project and from there I'm trying call .qvto transform defined in a qvt project. My input model is a UML class diagram created using Papyrus tool. Below is the code:
URI typesUri = URI.createFileURI("C:/Users/Maddo001/Documents/testing/org.project.callTransform/models/testUML.uml");
ResourceSet set = new ResourceSetImpl();
set.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
set.createResource(typesUri);
Resource r = set.getResource(typesUri, true);
EList<EObject> inObjects = r.getContents();
for (EObject temp : inObjects) {
System.out.println(temp.toString());
}
ModelExtent input = new BasicModelExtent(inObjects);
ModelExtent output = new BasicModelExtent();
ExecutionContextImpl context = new ExecutionContextImpl();
context.setConfigProperty("keepModeling", true);
URI transformationURI = URI.createFileURI("C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto");
TransformationExecutor executor = new TransformationExecutor(transformationURI);
ExecutionDiagnostic result = executor.execute(context, input, output);
System.out.println(executor.loadTransformation().getMessage());
If I execute this, I get following error: Compilation errors found in unit 'file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto'
Also when I iterate through ModelExtent input from input UML model, I can only see top level model object, classes and associations are not present. Is that how it's supposed to be?
I checked that my .qvto executes fine from run configurations with same input model. Below is my .qvto code:
modeltype Ecore "strict" uses "http://www.example.org/UMLDomainModel2PCM";
modeltype UML "strict" uses "http://www.eclipse.org/uml2/5.0.0/UML";
transformation TestTransformation(in Source:UML, out Target:Ecore);
main() { Source.rootObjects()[Model] -> map toOverall(); }
mapping Model::toOverall() : Overall { name := self.name; }
I'm new to QVTo and UML2. Kindly suggestion what I'm missing in my implementation. I've attached the input UML model. Thanks in advance.
-
Attachment: testUML.uml
(Size: 1.61KB, Downloaded 169 times)
[Updated on: Tue, 01 January 2019 13:29] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04137 seconds