Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » M2M transformation reports(How to create a M2M transformation reports for each resource)
M2M transformation reports [message #811592] Fri, 02 March 2012 15:17 Go to next message
Michael Veit is currently offline Michael VeitFriend
Messages: 12
Registered: January 2012
Junior Member
I am doing a model to model transformation using Xtext2 and Xtend2, working fine so far.

What I did:
- Parse a set of thousands of IDL model files using Xtext.
- Transform each of the IDL files to another meta model using Xtend and save a huge target model file.

Now I would like to have a separate transformation report for each IDL file which have been parsed. Target is to create rather simple HTML on the fly during transformation and putting relevant transformation information to the HTML report. These reports will be needed for manual postprocessing of the result model.

My idea was to use Xtend for that purpose, but how may I handle the various reports?
My issues:
- How to open and handle the various IGenerator instances? doGenerate() would expect a top-down handling of each resource, but I need to append some pieces of text during the transformation. (should be called at the beginning of the resource transformation method)
- Output to these generators would not be written at once. From various transformation methods, I need to append text to the reports. I would like to call a Xtend method like report(typename, resourcename, text).
- Must be able to keep different generators open at the same time, because the transformation may require to transform included resources before continuing with another resource.
- How to close these files? (should be called at the end of the resource transformation method)

Do you think it's a good idea to use Xtend for that, or should I try another framework / all handling manual?

I would be glad if you could share your experience regarding transformation reports.

Kind regards
Re: M2M transformation reports [message #811733 is a reply to message #811592] Fri, 02 March 2012 19:02 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
It seems like you actually have a transformation which takes an entire ResourceSet instead of a lot of separate Resource-s (i.e., IDL model files), at least for the report side of things.

Karsten wrote a blog about how to do just that:
You have to adapt the sources a little to account for differences between the version of Xtext available at the time of writing and now, but that's more or less evident (and make to sure to shout out here in case it isn't).
The drawback of this is that the ResourceSet is potentially a memory hog, even if the output models are relatively small (for the reports) or can be generated on a per-Resource basis (for the transformed meta models).

To mesh the two transformations (-> meta models, -> reports) a little better, you could take a sort of monadic approach by wrapping generated meta model artifacts together with generated report texts at all levels, and unpacking the wrapping at the right spot to either serialize the meta model or the reports part. I really should provide an example for this, but haven't got time to do so now...

Re: M2M transformation reports [message #813583 is a reply to message #811733] Mon, 05 March 2012 13:15 Go to previous message
Michael Veit is currently offline Michael VeitFriend
Messages: 12
Registered: January 2012
Junior Member
Thanks for the fast response.

Handling a bundle of resources for one target model was already solved.
As I do not need to parse more than 20 resources in parallel (handling nested includes) and having reports less than 20 kB, I decided to do the reporting manually:

- Create a hash map (key: resource name; value: report StringBuffer)
- Append text to the report StringBuffer based on the resource name
- When completing a resource, writing the StringBuffer to the report file and deleting the HashMap entry.
- All the report handling will be encapsulated in a static report class, serving all required methods.

This should be a robust and performant way for the reports.
Previous Topic:Running / Interpret the DSL
Next Topic:linking cross-references manually
Goto Forum:

Current Time: Sat Mar 28 21:36:29 GMT 2020

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

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

Back to the top