Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] QVTo file as target model
[QVTo] QVTo file as target model [message #644477] Sat, 11 December 2010 21:13 Go to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 24
Registered: July 2009
Junior Member
Hi,

I am trying to create a QVTo file thru a QVTo transformation.

Tried
modeltype qvto uses "http://www.eclipse.org/QVT/1.0.0/Operational";

transformation Test2QVTo( out qvtoModel : qvto);

main()
{
map createMainUnit('Hallo Welt');
}

mapping createMainUnit(cuName : String) : qvto::expressions::OperationalTransformation
{
result.name := cuName;
result.entry := object qvto::expressions::EntryOperation {
name := 'Einstieg';
};
}

but to no avail.

The target file given in the QVTo launch config is not generated.
The qvtotrace looks as if things work but the serialization fails.

What do I miss?

Cheers,

Uwe
Re: [QVTo] QVTo file as target model [message #644823 is a reply to message #644477] Tue, 14 December 2010 10:51 Go to previous messageGo to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 24
Registered: July 2009
Junior Member
Here is the same problem from a slightly different angle

This copys an ecore model like a charm

modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";

transformation EcoreCopy( in ecoreIn : ecore, out ecoreOut : ecore);

main()
{
ecoreIn.rootObjects()[ecore::EPackage]->map theMap();
}

mapping ecore::EPackage::theMap() : ecore::EPackage
{
init
{
result := self.deepclone().oclAsType(ecore::EPackage);
}
}

And this one works with java files using the java metamodel from the EMText sphere

modeltype Java uses "http://www.emftext.org/java";

transformation Test2Java( in javaIn : Java, out javaOut : Java);

main()
{
javaIn.rootObjects()[Java::containers::JavaRoot]->map theMap();
}

mapping Java::containers::JavaRoot::theMap() : Java::containers::JavaRoot
{
init
{
result := self;
}
}

mapping Java::containers::EmptyModel::theMap() : Java::containers::JavaRoot
{
init
{
result := object Java::containers::EmptyModel {};
}
}

mapping Java::containers::CompilationUnit::theMap() : Java::containers::JavaRoot
{
init
{
result := self.deepclone().oclAsType(Java::containers::CompilationUnit );
}
}

mapping Java::containers::Package::theMap() : Java::containers::JavaRoot
{
init
{
result := self.deepclone().oclAsType(Java::containers::Package);
}
}


Unfortunately the QVTo one does not work:

modeltype qvto uses "http://www.eclipse.org/QVT/1.0.0/Operational";

transformation QVToCopy( in qvtoIn : qvto, out qvtoOut : qvto);

main()
{
qvtoIn.rootObjects()[qvto::expressions::Module]->map theMap();
}

mapping qvto::expressions::Module::theMap() : qvto::expressions::Module
{
init
{
result := self;
}
}

mapping qvto::expressions::Library::theMap() : qvto::expressions::Module
{
init
{
result := self.deepclone().oclAsType(qvto::expressions::Library);
}
}

mapping qvto::expressions::OperationalTransformation::theMap() : qvto::expressions::Module
{
init
{
result := self.deepclone().oclAsType(qvto::expressions::OperationalTra nsformation);
}
}

From debugging I see that execution correctly branches into the OperationalTransformation::theMap mapping.
A OperationalTransformation copy instance is created and beeing back in main() qvtoOut is correctly populated with it.

On the console I read
Diagnostic OK source=org.eclipse.m2m.qvt.oml.execution code=0 OK data=[]
[QVTO Stack trace:]


Just the output file is missing Sad

Cheers,

Uwe


Re: [QVTo] QVTo file as target model [message #644834 is a reply to message #644823] Tue, 14 December 2010 12:06 Go to previous message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 24
Registered: July 2009
Junior Member
Ok folks,

I think I found it myself:

In
org/eclipse/m2m/internal/qvt/oml/runtime/resource/QvtOperati onalResourceImpl.java

the sad truth is that

@Override
public Document save(Document doc, Map<?, ?> options, DOMHandler handler) {
throw new UnsupportedOperationException();
}

Cheers,

Uwe
Previous Topic:[ATL] Use of key words as Model Element Data Type
Next Topic:transform many models
Goto Forum:
  


Current Time: Thu Dec 18 11:30:03 GMT 2014

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

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