Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » QVT - how to programatically retrieve the model(AST) from the transformation script
QVT - how to programatically retrieve the model(AST) from the transformation script [message #500685] Fri, 27 November 2009 14:09 Go to next message
Dana Wong is currently offline Dana WongFriend
Messages: 12
Registered: September 2009
Junior Member
Hello

Is it possible to programatically retrieve the abstract syntax tree of the QVT Transformation script?

This is my use case:
My QVT script transforms only a subset of the elements from the input model.
I was hoping to analyse the model behind the qvt script so that I can determine which elements can and cannot be transformed from the input model . The input model elements that could not be transformed will then be written to a separate file.

Thanks for your help.

Thank you,
Dana
Re: QVT - how to programatically retrieve the model(AST) from the transformation script [message #500699 is a reply to message #500685] Fri, 27 November 2009 15:03 Go to previous message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Dana,

You can do it just like this,


EList<EObject> contents = new ResourceSetImpl().getResource(uri,
true).getContents();
OperationalTransformation transf =
(OperationalTransformation)contents.get(0);
ModelType modelType =
(ModelType)transf.getModelParameter().get(0).getType();
EPackage usedMetamodel = modelType.getMetamodel().get(0);

Well, code a little bit more defensive then me ;).

Note, the AST classes are still from internal packages, though the AST
metamodel structure is pretty stable. It will be open, but can't say when
we have higher prio tasks at the moment.

Regards,
/Radek


On Fri, 27 Nov 2009 15:09:45 +0100, Dana Wong <dana.wong@bmw-carit.de>
wrote:

> Hello
>
> Is it possible to programatically retrieve the abstract syntax tree of
> the QVT Transformation script?
>
> This is my use case:
> My QVT script transforms only a subset of the elements from the input
> model. I was hoping to analyse the model behind the qvt script so that I
> can determine which elements can and cannot be transformed from the
> input model . The input model elements that could not be transformed
> will then be written to a separate file.
>
> Thanks for your help.
>
> Thank you,
> Dana
Previous Topic:[QVTO] creating recursive instances
Next Topic:[QVTO] Resvolving and query help please
Goto Forum:
  


Current Time: Thu Apr 25 11:07:36 GMT 2024

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

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

Back to the top