Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Compilation errors found in unit when calling QVTo transform(calling QVTo transform from standalone java )
Compilation errors found in unit when calling QVTo transform [message #1800528] Tue, 01 January 2019 13:27 Go to next message
Gururaj Maddodi is currently offline Gururaj MaddodiFriend
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 32 times)

[Updated on: Tue, 01 January 2019 13:29]

Report message to a moderator

Re: Compilation errors found in unit when calling QVTo transform [message #1800532 is a reply to message #1800528] Tue, 01 January 2019 17:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6430
Registered: July 2009
Senior Member
Hi

Since the problem is one of compilation errors in a *.qvto, the likely problem is
- errors in the *.qvto
- errors in the *.java that compiles the *.qvto
- errors in the 'project' that contains the *.java etc
You have provided none of these, nor any detailed errors.

You may find that https://wiki.eclipse.org/OCL/ForumNetiquette helps you request hep in a way that you can actually get help.

Regards

Ed Willink
Re: Compilation errors found in unit when calling QVTo transform [message #1800698 is a reply to message #1800532] Sat, 05 January 2019 22:11 Go to previous messageGo to next message
Gururaj Maddodi is currently offline Gururaj MaddodiFriend
Messages: 7
Registered: October 2018
Junior Member
Hello,

Thanks a lot for the reply. For some reason the System.out.println(executor.loadTransformation()); statement was not printing the complete diagnostic message. Now I'm able to print the complete message. This is what I get:

Diagnostic ERROR source=org.eclipse.m2m.qvt.oml.execution code=130: Compilation errors found in unit 'file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto' [Diagnostic ERROR source=file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto code=0 Failed to resolve metamodel 'http://www.example.org/UMLDomainModel2PCM' (at:2) data=[], Diagnostic ERROR source=file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto code=0 Type of transformation parameter should be model type (at:6) data=[], Diagnostic ERROR source=file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto code=0 Unknown type (Overall) (at:16) data=[], Diagnostic ERROR source=file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto code=0 Use 'self' explicitly as the source object to perform a call on the context type. (at:17) data=[], Diagnostic ERROR source=file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto code=0 Modified parameter 'self' is input only (at:17) data=[]]


This seems like by custom meta-model defined used Ecore cannot be resolved. But I don't get any problems while I run the .qvto from run configurations. I defined my meta-model plugins in another workspace and imported them into current workspace. I can even create a model from my meta-model. Please let me know why I'm getting this error. I'm not sure what other diagnostic information I can provide.

Thanks.
Re: Compilation errors found in unit when calling QVTo transform [message #1800700 is a reply to message #1800698] Sun, 06 January 2019 06:55 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6430
Registered: July 2009
Senior Member
Gururaj Maddodi wrote on Sat, 05 January 2019 17:11
I'm not sure what other diagnostic information I can provide.


Well, pretty obviously,

file:/C:/Users/Maddo001/Documents/testing/TestTransformation/transforms/TestTransformation/TestTransformation.qvto

and no doubt everything it references and how you invoke it. Lines 2, 6, 16, 17 look relevant to identifying that you are changing something immutable.

Try reading https://wiki.eclipse.org/OCL/ForumNetiquette again.

Regards

Ed Willink

Previous Topic:QVTo transformation from command line
Next Topic:Announce QVTo 3.9.2
Goto Forum:
  


Current Time: Wed Jul 24 08:26:37 GMT 2019

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

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

Back to the top