Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Storing and loading .qvtox(A problem in loading previously stored .qvtox files)
Storing and loading .qvtox [message #1476884] Mon, 17 November 2014 12:39 Go to next message
Trajche Masinov is currently offline Trajche MasinovFriend
Messages: 6
Registered: November 2014
Junior Member
Hello everyone,

I am experimenting with storing the compiled transformation as a QVTOX file and later (on a subsequent run of the same transformation) to load that QVTOX file and use it directly as a compiled version.

I have a transformation that references a number of other transformations (other qvto files). I managed to store the compiled transformation (the AST) in a .qvtox file by using the ExeXMISerializer class. I store the compilation result of my main transformation (not the referenced libraries, although they get compiled and their CST appended to the main transformation).

However, when I try to load that .qvtox file into a CompuledUnit object, I receive the following error:
java.lang.IllegalArgumentException: 
imported module must be in a resource: org.eclipse.m2m.internal.qvt.oml.expressions.impl.ModuleImpl@21e19031 (eProxyURI: qvto:/module.env#/)
	at org.eclipse.m2m.internal.qvt.oml.compiler.CompiledUnit.computeImports(CompiledUnit.java:254)
	at org.eclipse.m2m.internal.qvt.oml.compiler.CompiledUnit.computeImports(CompiledUnit.java:230)
	at org.eclipse.m2m.internal.qvt.oml.compiler.CompiledUnit.<init>(CompiledUnit.java:166)
	at org.eclipse.m2m.internal.qvt.oml.compiler.CompiledUnit.<init>(CompiledUnit.java:110)


I believe the problem lays somewhere in these referenced transformations, but I am not sure.
Does anyone have an idea on what could the problem be?

(I am quite new to this, so I apologize if I've made some mistakes in my understanding of the engine)

Thanks for the help,
Trajche
Re: Storing and loading .qvtox [message #1477068 is a reply to message #1476884] Mon, 17 November 2014 15:41 Go to previous messageGo to next message
Trajche Masinov is currently offline Trajche MasinovFriend
Messages: 6
Registered: November 2014
Junior Member
An update to this.

I've managed to store and load (almost) successfully. I am storing now also the referenced libraries (modules) as qvtox files. The engine takes care of their loading afterwards (basically, that was my problem from before).

But, the problem that I am having now is executing the transformation.
I get a NullPointerException on a OperationBody object from one of my referenced libraries (The operation exists, and in the load process I see that the body is not null).
Here is a part of the call stack:
QvtOperationalEvaluationVisitorImpl.visitOperationBody(OperationBody) line: 1223	
QvtOperationalEvaluationVisitorImpl.visitHelper(Helper) line: 523	
QvtOperationalEvaluationVisitorImpl$1InterruptVisitor(QvtGenericEvaluationVisitor).visitHelper(Helper) line: 332	
HelperImpl.accept(U) line: 112	


Any clues?

Thanks
Re: Storing and loading .qvtox [message #1477111 is a reply to message #1477068] Mon, 17 November 2014 16:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5395
Registered: July 2009
Senior Member
Hi

It's probably a proxy, and probably an OCL standard library proxy.

You'll need to register the relevant package somehow.

Regards

Ed Willink


On 17/11/2014 15:41, Trajche Masinov wrote:
> An update to this.
>
> I've managed to store and load (almost) successfully. I am storing now
> also the referenced libraries (modules) as qvtox files. The engine takes
> care of their loading afterwards (basically, that was my problem from
> before).
>
> But, the problem that I am having now is executing the transformation. I
> get a NullPointerException on a OperationBody object from one of my
> referenced libraries (The operation exists, and in the load process I
> see that the body is not null).
> Here is a part of the call stack:
>
> QvtOperationalEvaluationVisitorImpl.visitOperationBody(OperationBody)
> line: 1223
> QvtOperationalEvaluationVisitorImpl.visitHelper(Helper) line: 523
> QvtOperationalEvaluationVisitorImpl$1InterruptVisitor(QvtGenericEvaluationVisitor).visitHelper(Helper)
> line: 332
> HelperImpl.accept(U) line: 112
>
>
> Any clues?
>
> Thanks
Re: Storing and loading .qvtox [message #1478350 is a reply to message #1477111] Tue, 18 November 2014 16:05 Go to previous messageGo to next message
Trajche Masinov is currently offline Trajche MasinovFriend
Messages: 6
Registered: November 2014
Junior Member
As I debugged the compilation, I observed that the imports are handled in the creation of a CompiledUnit object.
The problem is that the evaluation cannot resolve a function call located in an imported transformation. I am receiving an error "Unresolved constructor on type ... " or "Cannot find operation...".

Do you have an idea on how to register that proxy you are suggesting?
So far I've tried:
EcoreUtil.resolveAll(resource);

ProjectMap projectMap = new ProjectMap();
projectMap.initializeResourceSet(resourceSet);


I am sorry for maybe sounding vague, but with the lack of documentation is really difficult to understand how everything works.

Maybe it is important to mention that the transformation is executed via a plugin to plugin communication in Eclipse. Also, the .qvtox files are saved in and loaded from a different location than the location of the .qvto files.
Maybe that is breaking some references?

Any help is appreciated.

Regards,
Trajche
Re: Storing and loading .qvtox [message #1478564 is a reply to message #1478350] Tue, 18 November 2014 19:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5395
Registered: July 2009
Senior Member
Hi

ProjectMap is from the new Pivot OCL do not use these plugins as part of
normal QVTo tooling.

EcoreUtil.resolveAll may put the errors in the Resource.errors, You
should always check ALL Resource.errors.

I usually set a breakpoint in the ECoreUtil.resolveProxy retry.

Regards

Ed Willink

On 18/11/2014 16:05, Trajche Masinov wrote:
> As I debugged the compilation, I observed that the imports are handled
> in the creation of a CompiledUnit object.
> The problem is that the evaluation cannot resolve a function call
> located in an imported transformation. I am receiving an error
> "Unresolved constructor on type ... " or "Cannot find operation...".
>
> Do you have an idea on how to register that proxy you are suggesting?
> So far I've tried:
>
> EcoreUtil.resolveAll(resource);
>
> ProjectMap projectMap = new ProjectMap();
> projectMap.initializeResourceSet(resourceSet);
>
>
> I am sorry for maybe sounding vague, but with the lack of documentation
> is really difficult to understand how everything works.
>
> Maybe it is important to mention that the transformation is executed via
> a plugin to plugin communication in Eclipse. Also, the .qvtox files are
> saved in and loaded from a different location than the location of the
> .qvto files.
> Maybe that is breaking some references?
>
> Any help is appreciated.
>
> Regards,
> Trajche
Re: Storing and loading .qvtox [message #1480776 is a reply to message #1478564] Thu, 20 November 2014 13:22 Go to previous messageGo to next message
Trajche Masinov is currently offline Trajche MasinovFriend
Messages: 6
Registered: November 2014
Junior Member
I've debugged it, it seems to resolve the proxies but I still get errors, such as:
1. Unresolved constructor on type X
2. Cannot find operation m() for the type X

What I have is the following:
1. I receive a loaded transformation into a UnitProxy with an URI that points to a certain location (lets say, platform:/resource/Project/transformation.qvto
2. I compile the unit and store the AST into a .qvtox by using the ExeXmiSerializer to a different location (platform:/resource/Project2/transformation.qvtox)
3. For every referenced library (import), I perform step 2.

If I try to run a different transformation that uses the same referenced libraries as the first one, but now using the generated qvtox files, I get the errors stated above.
The procedure is:
1. doCompiler on the QVTOCompiler instance is called
2. A check is made for the existance of an compiled XMI unit
3. The XMI unit is loaded using the getCompiledXMIUnit method() by creating a CompiledUnit instance

My structure is as follows:

importLib
library importLib;

query getTest(): String
{
	return "test";
}


transformation.qvto (and also the other transformation)
import testLib;

main() {
    getTest();
}



Re: Storing and loading .qvtox [message #1485424 is a reply to message #1480776] Mon, 24 November 2014 08:23 Go to previous messageGo to next message
Trajche Masinov is currently offline Trajche MasinovFriend
Messages: 6
Registered: November 2014
Junior Member
Any clues?
Re: Storing and loading .qvtox [message #1485647 is a reply to message #1480776] Mon, 24 November 2014 12:20 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5395
Registered: July 2009
Senior Member
Hi

Please attach a repro to Bugzilla.

Regards

Ed

On 20/11/2014 13:22, Trajche Masinov wrote:
> I've debugged it, it seems to resolve the proxies but I still get
> errors, such as:
> 1. Unresolved constructor on type X
> 2. Cannot find operation m() for the type X
>
> What I have is the following:
> 1. I receive a loaded transformation into a UnitProxy with an URI that
> points to a certain location (lets say,
> platform:/resource/Project/transformation.qvto
> 2. I compile the unit and store the AST into a .qvtox by using the
> ExeXmiSerializer to a different location
> (platform:/resource/Project2/transformation.qvtox)
> 3. For every referenced library (import), I perform step 2.
>
> If I try to run a different transformation that uses the same referenced
> libraries as the first one, but now using the generated qvtox files, I
> get the errors stated above.
> The procedure is:
> 1. doCompiler on the QVTOCompiler instance is called
> 2. A check is made for the existance of an compiled XMI unit
> 3. The XMI unit is loaded using the getCompiledXMIUnit method() by
> creating a CompiledUnit instance
>
> My structure is as follows:
>
> importLib
>
> library importLib;
>
> query getTest(): String
> {
> return "test";
> }
>
>
> transformation.qvto (and also the other transformation)
>
> import testLib;
>
> main() {
> getTest();
> }
>
>
>
>
Re: Storing and loading .qvtox [message #1485652 is a reply to message #1485424] Mon, 24 November 2014 12:21 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5395
Registered: July 2009
Senior Member
Hi

Sorry. My earlier reply was accidentally off-list, so now I'm confused.

A QVTo Bugzilla may be submitted at:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=MMT.QVTo

Regards

Ed Willink

On 24/11/2014 08:23, Trajche Masinov wrote:
> Any clues?
Re: Storing and loading .qvtox [message #1485692 is a reply to message #1485652] Mon, 24 November 2014 13:06 Go to previous message
Trajche Masinov is currently offline Trajche MasinovFriend
Messages: 6
Registered: November 2014
Junior Member
Thank you.
Already submitted it. If you need more information, contact me.
I will check the bug report and this forum thread frequently.

Thank you for your help.

Regards,
Trajche
Previous Topic:Transform qvto file standalone
Next Topic:Including UML primitive types in result of transformation
Goto Forum:
  


Current Time: Sun Sep 24 03:26:57 GMT 2017

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

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