Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

QVTo/FAQ

< QVTo(Redirected from QVTO/FAQ)

This QVTo Wiki entry gather some frequently asked questions thrown in the QVTo forum

Q: Is there a way to create some utiles.qvto file that contains common/shared functionality ?

A: Yes. The QVTo language provides import mechanisms so that your modules may import other Tranformations and Libraries defined in other files.

This is an easy example in which we create a MyLib.qvto library acceded by a MyTransformation.qvto.

1. MyLyb.qvto file:

library MyLib;

helper doSomethingCol() : String {
   return "Well, this is trivial!!";
} 

2. MyTransformation.qvto file:

import MyLib;

transformation MyTransformation();

main() {
   log(doSomethingCool());   
}

You may find more information about the different mechanisms of module imports in the Section 8.2.1.4 of the OMG QVT specification

Q: I've properly defined a Java black box unit and the editor recognize my blackbox operations, however my transformation crashes when executing those operations. What am I doing wrong?

A: May be you have forgotten to define in the extension of the Java Black-Box Units extension point all the metamodels which are involved in operations of your java black box unit.

So for example, for the following java black box operation:

@Operation(contextual=true)
public static String doSomeComplexOperation(MyDSLType self) {
   String result;
   // Do some complex operation with self variable
   return result;
}

Ensure that you have properly defined the URI of the metamodel of MyDSLType:

<extension point="org.eclipse.m2m.qvt.oml.javaBlackboxUnits">
   <unit name="FAQJavaLib" namespace="m2m.qvt.oml.faq">
      <library name="FAQUtilLib" class="org.eclipse.m2m.qvt.oml.faq.UtilitiesLibrary">
         <metamodel nsURI="http://MyDSL1URI"/>
         <metamodel nsURI="http://MyDSL2URI"/>   
      </library>
   </unit>
</extension>

For more information about Java Black-Box units check the QVT Operational Developer Guide (Eclipse's Help) since there is "BlackBox support" section which covers this topic

Back to the top