[QVTo] Failed to resolve metamodel - in running Java application [message #645052] |
Wed, 15 December 2010 11:47 |
Kirsten M. Z. Messages: 132 Registered: July 2010 |
Senior Member |
|
|
Hi @all,
currently I am using the following code to execute a QVTo transformation from Java code. However, I get the following error:
Compilation errors found in unit [......./mytrans.qvto]
Failed to resolve metamodel 'http://www.example.org/concrete'
Thereby, the mentioned metamodel is the second metamodel used by my QVTo transformation.
I can imagine that I have to "register" this metamodel in my code/application somewhere, but I have not found an example how to do that in my Java code/application.
The QVTo transformation works in my Eclipse environment, also without compilation error, of course. The metamodel project has been added as "plugin" to my Eclipse environment (I guess that's the reason why compilation and running of the QVTo transformation works there). I have also added the metamodel project to the transformation project. Otherwise, no special settings.
URI transformationURI = URI.createURI(Transformation.class
.getResource("/mytrans.qvto").toURI().toString());
TransformationExecutor executor = new TransformationExecutor(transformationURI);
// load resource 1 (XMI)
Resource res1 = new XMIResourceFactoryImpl().createResource(null);
res1.load(isAML, null);
// load resource 2 (concrete format)
Resource res2 = new de.example.org.concrete.util.ConcreteResourceFactoryImpl()
.createResource(null);
res2.load(isDDS, null);
// create the input extents with its initial contents
ModelExtent in1 = new BasicModelExtent(res1.getContents());
ModelExtent in2 = new BasicModelExtent(res2.getContents());
// setup the execution environment details
ExecutionContextImpl context = new ExecutionContextImpl();
context.setConfigProperty("keepModeling", true);
// run the transformation
ExecutionDiagnostic diagnostics = executor.execute(context, in1, in2);
Thanks in advance!
|
|
|
Re: [QVTo] Failed to resolve metamodel - in running Java application [message #645233 is a reply to message #645052] |
Thu, 16 December 2010 07:06 |
Dennis Hendriks Messages: 74 Registered: January 2010 Location: The Netherlands |
Member |
|
|
Hi vultur,
> I can imagine that I have to "register" this metamodel in my
> code/application somewhere, but I have not found an example how to do
> that in my Java code/application.
Then I guess you didn't look hard enough :)
Anyway, here it is:
http://www.eclipse.org/forums/index.php?t=msg&goto=63020 0
Best regards,
Dennis
vultur wrote:
> Hi @all,
>
> currently I am using the following code to execute a QVTo transformation
> from Java code. However, I get the following error:
>
> Compilation errors found in unit [......./mytrans.qvto]
> Failed to resolve metamodel 'http://www.example.org/concrete'
>
>
> Thereby, the mentioned metamodel is the second metamodel used by my QVTo
> transformation.
>
> I can imagine that I have to "register" this metamodel in my
> code/application somewhere, but I have not found an example how to do
> that in my Java code/application.
>
> The QVTo transformation works in my Eclipse environment, also without
> compilation error, of course. The metamodel project has been added as
> "plugin" to my Eclipse environment (I guess that's the reason why
> compilation and running of the QVTo transformation works there). I have
> also added the metamodel project to the transformation project.
> Otherwise, no special settings.
>
>
> URI transformationURI = URI.createURI(Transformation.class
> .getResource("/mytrans.qvto").toURI().toString());
> TransformationExecutor executor = new
> TransformationExecutor(transformationURI);
>
> // load resource 1 (XMI)
> Resource res1 = new XMIResourceFactoryImpl().createResource(null);
> res1.load(isAML, null);
>
> // load resource 2 (concrete format)
> Resource res2 = new
> de.example.org.concrete.util.ConcreteResourceFactoryImpl()
> .createResource(null);
> res2.load(isDDS, null);
>
> // create the input extents with its initial contents
> ModelExtent in1 = new BasicModelExtent(res1.getContents());
> ModelExtent in2 = new BasicModelExtent(res2.getContents());
>
> // setup the execution environment details
> ExecutionContextImpl context = new ExecutionContextImpl();
> context.setConfigProperty("keepModeling", true);
>
> // run the transformation
> ExecutionDiagnostic diagnostics = executor.execute(context, in1, in2);
>
>
> Thanks in advance!
|
|
|
|
Powered by
FUDForum. Page generated in 0.03178 seconds