Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsM2M transformation reports
https://www.eclipse.org/forums/index.php/mv/msg/302157/811592/#msg_811592
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
Michael]]>Michael Veit2012-03-02T15:17:08-00:00Re: M2M transformation reports
https://www.eclipse.org/forums/index.php/mv/msg/302157/811733/#msg_811733
Karsten wrote a blog about how to do just that: http://kthoms.wordpress.com/2011/07/12/xtend-generating-from-multiple-input-models/
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...]]>Meinte Boersma2012-03-02T19:02:31-00:00Re: M2M transformation reports
https://www.eclipse.org/forums/index.php/mv/msg/302157/813583/#msg_813583
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.]]>Michael Veit2012-03-05T13:15:00-00:00