Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Composite Transformations(Composite Transformations with unknown model URI at invocation time)
[QVTO] Composite Transformations [message #498122] Sat, 14 November 2009 18:03 Go to next message
Ioan Salau is currently offline Ioan SalauFriend
Messages: 69
Registered: July 2009
Location: Toronto
Member

I have a model which contains a set of soft references (just names) to other models. I would like to use composite transformations to invoke the other transformations (even recursive transformations) using as input models the models specified by the soft references, but I am not sure what is the best way to define the input models of the sub-transformations since at the invocation time I don't know yet how many soft references the main model contains and therefore I can't pass the all input models. Is there a way to load at runtime the input model for a sub-transformation that I invoke from the main transformation?

Thanks,

Ioan

[Updated on: Sat, 14 November 2009 18:24]

Report message to a moderator

Re: [QVTO] Composite Transformations [message #498131 is a reply to message #498122] Sat, 14 November 2009 20:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Ioan,

You can use composite transformations and recursion too.
You can create dynamically any number of empty models
that can be passed as model parameter to an aggregated
transformation, as well as existing models referenced by
declared model parameters.

What is problematic is to create a dynamic number of non empty
input models as the QVTO spec does not define any mechanism for that.

Only Model::createEmptyModel() operation is available in the Stdlib.
We would like to come up with an extension like
Model::createModel(rooObjects : Collection(Element)), which would allow to
create arbitrary input model from existing objects on the fly.

Not sure, I fully understand your usecase of loading input models
for your soft references.

I have pasted just a dummy code example of what I talked about, to avoid
a plain text mess. ;)

Regards,
/Radek




import Composed;

modeltype ECORE "strict" uses
ecore('http://www.eclipse.org/emf/2002/Ecore');
modeltype UML "strict" uses uml('http://www.eclipse.org/uml2/3.0.0/UML');


transformation Composite(in uml : UML, out ecore : ECORE) access Composed;

main() {
uml.rootObjects()[Package]->toPackage();

var status := new Composed(uml, ecore).transform();
assert fatal (status.succeeded());

var emptyEcore := UML.createEmptyModel().oclAsType(ECORE);
new Composed(uml, emptyEcore).transform();
}

mapping Package::toPackage() : EPackage {
}

//////////////////


transformation Composed(in uml : UML, inout model : ECORE);

main() {
// do my job
}



On Sat, 14 Nov 2009 19:03:14 +0100, Ioan <ioan.salau@insighteck.com> wrote:

> I have a model which contains a set of soft references (just names) to
> other models. I would like to use composite transformations to invoke
> the other transformations (even recursive transformations), but I am not
> sure what is the best way to define the input models since at the
> invocation time I don't know yet how many soft references the main model
> contains and therefore I can't pass the all input models. Is there a way
> to load at runtime the input model for a transformation that I invoke
> within a different transformation?
>
> Thanks,
>
> Ioan
Re: [QVTO] Composite Transformations [message #498140 is a reply to message #498131] Sat, 14 November 2009 23:04 Go to previous messageGo to next message
Ioan Salau is currently offline Ioan SalauFriend
Messages: 69
Registered: July 2009
Location: Toronto
Member

Hi Radek,

Thank you for your quick response on a Saturday, I really appreciate your effort. The sample you posted is really good as I need that use case as well. However, what I am really looking for is a method like UML.loadModel("/workspace/MyProject/models/mycomponent_reusable.ecore") and pass this model to the sub-transformation as input model.

Regards,

Ioan

[Updated on: Sat, 14 November 2009 23:04]

Report message to a moderator

Re: [QVTO] Composite Transformations [message #498192 is a reply to message #498140] Sun, 15 November 2009 19:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Ioan,

What you require has been already requested couple of times and is pretty
logical.
Though the OMG spec does define anything like this I think we should
support such
additional operation as well.

Would you mind raising a bugzilla to get this implemented?
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2M& component=QVT_OML-Engine

Regards,
/Radek



On Sun, 15 Nov 2009 00:04:18 +0100, Ioan <ioan.salau@insighteck.com> wrote:

> Hi Radek,
> Thank you for your quick response on a Saturday, I really appreciate
> your effort. The sample you posted is really good as I need that use
> case as well. However, what I am really looking for is a method like
> UML.loadModel("/workspace/MyProject/models/mycomponent_reusable.ecore ")
> and pass this model to the sub-transformation as input model.
>
> Regars,
>
> Ioan
Re: [QVTO] Composite Transformations [message #498219 is a reply to message #498192] Sun, 15 November 2009 23:23 Go to previous messageGo to next message
Ioan Salau is currently offline Ioan SalauFriend
Messages: 69
Registered: July 2009
Location: Toronto
Member

Hi Radek,

I opened a new bugzilla to address the request for this new feature:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=295193


As a suggestion, M2M QVTo could use the EMFIndex to provide a flexible way to load existing models from file or to save new models created with UML.createEmptyModel(). I know that Eclipse XTeam uses EMFIndex.

Regards,
Ioan
Re: [QVTO] Composite Transformations [message #498435 is a reply to message #498219] Mon, 16 November 2009 22:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Ioan,

I would rather be careful about saving the model from within a
transformation.
How would you know that you can save the model?
IOW, is this the final contents to save?

An [out] model from one composed transformation can be modified elsewhere,
until it exits the main calling transformation.

For example, objects contained in an intermediate saved resource may be
set to a
different container later, making the result invalid.

Eventually, all intermediate [out], [inout] models might be saved in the
very end
of the main transformation, but we get an issue of how do we know the
direction
kind of the model if it's not assigned to a model parameter.

Also, performing many composed transformations might have a big memory
footprint,
as there is no cleanup API for models.

Perhaps, in your very dynamic scenario, you might have the main
transformation written
in Java or whatever else and realize only the composed transformation in
QVTO.

Regards,
/Radek



On Mon, 16 Nov 2009 00:23:49 +0100, Ioan <ioan.salau@insighteck.com> wrote:

> Hi Radek,
>
> I opened a new bugzilla to address the request for this new feature:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=295193
>
>
> As a suggestion, M2M QVTo could use the EMFIndex to provide a flexible
> way to load existing models from file or to save new models created with
> UML.createEmptyModel(). I know that Eclipse XTeam uses EMFIndex.
> Regards,
> Ioan
Re: [QVTO] Composite Transformations [message #498454 is a reply to message #498435] Tue, 17 November 2009 03:13 Go to previous messageGo to next message
Ioan Salau is currently offline Ioan SalauFriend
Messages: 69
Registered: July 2009
Location: Toronto
Member

Hi Radek,

I do understand the risk and obviously you have to pay attention when you save the model.
Anyway, let's consider following business case:

I have a UML Class Diagram and I want to create a Java Model (not java code) for each Class with the end result being one file per Java Model. You don't know how many classes you have before you start processing the UML Class Diagram, still you have to create count(Class) different files. I guess this is not possible with a pure M2M QVTo solution, therefore I have to provide a Java based solution or a preprocessing with QVTo and the last step of breaking into multiple files using Java based solution.

The opposite situation is when you have UML Class Summary Diagram (only class names and relationships) and the details about each Class (attributes and operations) are stored into separate file which contains corresponding Java Model. To restore the full UML Class Diagram, I would have to load at runtime the specific Java Models.

Regards,

Ioan
Re: [QVTO] Composite Transformations [message #498503 is a reply to message #498454] Tue, 17 November 2009 09:48 Go to previous message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Ioan,

The model (instance of a modeltype) in QVTO does no necessarily contains a
single
object, but can have multiple root objects.

Then a variable number of UML classes you can handle from a single input
UML model.
The output Java model would contain multiple root objects which can be
easily
saved in separate resources after QVTo execution, most likely using Java.

Regards,
/Radek


On Tue, 17 Nov 2009 04:13:39 +0100, Ioan <ioan.salau@insighteck.com> wrote:

> Hi Radek,
>
> I do understand the risk and obviously you have to pay attention when
> you save the model. Anyway, let's consider following business case:
>
> I have a UML Class Diagram and I want to create a Java Model (not
> java code) for each Class with the end result being one file per Java
> Model. You don't know how many classes you have before you start
> processing the UML Class Diagram, still you have to create count(Class)
> different files. I guess this is not possible with a pure M2M QVTo
> solution, therefore I have to provide a Java based solution or a
> preprocessing with QVTo and the last step of breaking into multiple
> files using Java based solution. The opposite situation is when you
> have UML Class Summary Diagram (only class names and relationships) and
> the details about each Class (attributes and operations) are stored into
> separate file which contains corresponding Java Model. To restore the
> full UML Class Diagram, I would have to load at runtime the specific
> Java Models.
> Regards,
>
> Ioan
Previous Topic:[QVTo] Execute .qvto transformations from MWE
Next Topic:[ATL] Transformation termination and confluence
Goto Forum:
  


Current Time: Tue Oct 22 14:48:26 GMT 2019

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

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

Back to the top