Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] Multiple output
[QVTo] Multiple output [message #675255] Mon, 30 May 2011 23:00 Go to next message
Ruben Bentein is currently offline Ruben BenteinFriend
Messages: 4
Registered: July 2009
Junior Member
Is it possible to make a transformation have multiple output files?
For example: I have a model A. For every subelement Item in A, i would like to create a B, and place that in its own file.

Is this possible in QVTo?

modeltype A uses 'http//A';
modeltype B uses 'http//B';

transformation My_A_to_B_Transformation(in a : A, out B);

main() {
  // create a file for every B, made from 
}

mapping A::Item::itemToB() : B {
  name := self.name;
}
Re: [QVTo] Multiple output [message #675433 is a reply to message #675255] Tue, 31 May 2011 14:00 Go to previous messageGo to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
> Is it possible to make a transformation have multiple output files?
> For example: I have a model A. For every subelement Item in A, i would
> like to create a B, and place that in its own file.
>
> Is this possible in QVTo?
>
>
> modeltype A uses 'http//A';
> modeltype B uses 'http//B';
>
> transformation My_A_to_B_Transformation(in a : A, out B);
>
> main() {
> // create a file for every B, made from }
>
> mapping A::Item::itemToB() : B {
> name := self.name;
> }

I may be wrong, but to be this would be a post-processing step rather
than part of the transformation since you don't know beforehand how
many outputs you'll have. If all instances of B are self-contained
(i.e. contain only child objects and attributes) then I would use a
TransformationExecutor to run the transform then, for the output
ModelExtent do:

ResourceSet set = new ResourceSetImpl();
for (EObject obj : extent.getContents()){
if (obj instanceof B){
Resource res = set.createResource(<uri>);
res.getContents().add(obj);
res.save(<options>);
}
}
(with some appropriate code to generate the unique URIs you need for
each instance and some options if needed).

Alan
Re: [QVTo] Multiple output [message #675513 is a reply to message #675433] Tue, 31 May 2011 17:54 Go to previous messageGo to next message
Ruben Bentein is currently offline Ruben BenteinFriend
Messages: 4
Registered: July 2009
Junior Member
I know the best way to do this is to transform a model A to a model C, where C contains multiple B's. I'm just wondering if this is possible in QVT Smile (i'm writing my thesis about the subject)

Edit: Thanks for the reply btw

[Updated on: Tue, 31 May 2011 17:57]

Report message to a moderator

Re: [QVTo] Multiple output [message #675671 is a reply to message #675255] Wed, 01 June 2011 06:03 Go to previous messageGo to next message
Dennis HendriksFriend
Messages: 74
Registered: January 2010
Location: The Netherlands
Member
If I'm not mistaken QVTo transformations can have multiple outputs, as long
as the number of outputs is fixed.

Dennis


Ruben Bentein wrote:
> Is it possible to make a transformation have multiple output files?
> For example: I have a model A. For every subelement Item in A, i would
> like to create a B, and place that in its own file.
>
> Is this possible in QVTo?
>
>
> modeltype A uses 'http//A';
> modeltype B uses 'http//B';
>
> transformation My_A_to_B_Transformation(in a : A, out B);
>
> main() {
> // create a file for every B, made from }
>
> mapping A::Item::itemToB() : B {
> name := self.name;
> }
>
Re: [QVTo] Multiple output [message #675672 is a reply to message #675671] Wed, 01 June 2011 07:09 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I think the QVTo specification is sufficiently vague to justify your
favourite interpretation. I don't see why an output should not be a
Sequence(...).

The current Eclipse QVTo implementation is probably rather more limited.

Regards

Ed Willink


On 01/06/2011 07:03, Dennis Hendriks wrote:
> If I'm not mistaken QVTo transformations can have multiple outputs, as
> long as the number of outputs is fixed.
>
> Dennis
>
>
> Ruben Bentein wrote:
>> Is it possible to make a transformation have multiple output files?
>> For example: I have a model A. For every subelement Item in A, i
>> would like to create a B, and place that in its own file.
>>
>> Is this possible in QVTo?
>>
>>
>> modeltype A uses 'http//A';
>> modeltype B uses 'http//B';
>>
>> transformation My_A_to_B_Transformation(in a : A, out B);
>>
>> main() {
>> // create a file for every B, made from }
>>
>> mapping A::Item::itemToB() : B {
>> name := self.name;
>> }
>>
Previous Topic:[ATL] http://wiki.eclipse.org/ATL/Concepts broken
Next Topic:[QVTO] Bug or feature: Order of 'out' model parameters affects transformation results
Goto Forum:
  


Current Time: Tue Apr 16 12:53:01 GMT 2024

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

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

Back to the top