Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] One target model and more than one target metamodels
[ATL] One target model and more than one target metamodels [message #545876] Fri, 09 July 2010 10:00 Go to next message
Olivier Moises is currently offline Olivier Moises
Messages: 6
Registered: July 2009
Junior Member
Hi All,


I am newbie in ATL and my problem is probably simple to solve :
I would like to write a rule where I use objects coming from more than one EMF package.

here is my example :

rule r1 {
from s : ECORE!EPackage
to t : WIDGETS!Composite (
children <- WIDGETS!Text,
layout <- LAYOUTS!RowLayout
)
}

Without the layout, it works well, but neither the editor nor the engine accepts the LAYOUTS metamodel.
My usecase requires only one target model and one source model.

Is it a way to do it ?

Thanks by advance,

Olivier Moises
Re: [ATL] One target model and more than one target metamodels [message #545891 is a reply to message #545876] Fri, 09 July 2010 10:41 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 511
Registered: July 2009
Senior Member
You want the target model to use two different meta-models ?
Re: [ATL] One target model and more than one target metamodels [message #545910 is a reply to message #545876] Fri, 09 July 2010 10:21 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHE
Messages: 129
Registered: July 2009
Senior Member
Le 09/07/2010 16:00, Olivier Moises a écrit :
> Hi All,
>
>
> I am newbie in ATL and my problem is probably simple to solve :
> I would like to write a rule where I use objects coming from more than
> one EMF package.
>
> here is my example :
>
> rule r1 {
> from s : ECORE!EPackage
> to t : WIDGETS!Composite (
> children <- WIDGETS!Text,
> layout <- LAYOUTS!RowLayout
> )
> }
>
> Without the layout, it works well, but neither the editor nor the engine
> accepts the LAYOUTS metamodel.
> My usecase requires only one target model and one source model.

So why having two metamodels for one target model?
May be your target metamodel (to be defined) could inherit from both
WIDGETS and LAYOUTS?
>
> Is it a way to do it ?
>
> Thanks by advance,
>
> Olivier Moises


--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
Re: [ATL] One target model and more than one target metamodels [message #545995 is a reply to message #545910] Fri, 09 July 2010 16:16 Go to previous messageGo to next message
Olivier Moises is currently offline Olivier Moises
Messages: 6
Registered: July 2009
Junior Member
Hi Vincent,

Thx for your reply.
Unfortunately, the metamodels are already used in other applications and cannot be changed. They are coming from wazaabi project which makes it possible to describe UIs using live EMF models.
I just want to transform EClass into a UI where EAttribute will be transformed into Text fields etc...
I succeeded to make a proof of concept using QVTo and now I would like to make the same operation using ATL.



Olivier



Vincent MAHE wrote on Fri, 09 July 2010 10:21
Le 09/07/2010 16:00, Olivier Moises a écrit :
> Hi All,
>
>
> I am newbie in ATL and my problem is probably simple to solve :
> I would like to write a rule where I use objects coming from more than
> one EMF package.
>
> here is my example :
>
> rule r1 {
> from s : ECORE!EPackage
> to t : WIDGETS!Composite (
> children <- WIDGETS!Text,
> layout <- LAYOUTS!RowLayout
> )
> }
>
> Without the layout, it works well, but neither the editor nor the engine
> accepts the LAYOUTS metamodel.
> My usecase requires only one target model and one source model.

So why having two metamodels for one target model?
May be your target metamodel (to be defined) could inherit from both
WIDGETS and LAYOUTS?
>
> Is it a way to do it ?
>
> Thanks by advance,
>
> Olivier Moises


--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00

Re: [ATL] One target model and more than one target metamodels [message #545996 is a reply to message #545891] Fri, 09 July 2010 16:18 Go to previous messageGo to next message
Olivier Moises is currently offline Olivier Moises
Messages: 6
Registered: July 2009
Junior Member
Yes Sylvain,

And may be more than two metamodels ....

Olivier


Sylvain EVEILLARD wrote on Fri, 09 July 2010 10:41
You want the target model to use two different meta-models ?

Re: [ATL] One target model and more than one target metamodels [message #546212 is a reply to message #545876] Mon, 12 July 2010 03:59 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 511
Registered: July 2009
Senior Member
If there are no references between those meta-models, then you have to build a fake meta-model with one EClass that will inherit from each meta-model (any EClass). By using this meta-model you can then use elements from the both meta-models.

If one of your meta-model references the other, then you can use this one as meta-model and still use the EClasses from the second one.
Re: [ATL] One target model and more than one target metamodels [message #546302 is a reply to message #546212] Mon, 12 July 2010 08:38 Go to previous messageGo to next message
Olivier Moises is currently offline Olivier Moises
Messages: 6
Registered: July 2009
Junior Member
Hi Sylvain,

Thx for this reply. Actually the situation is slightly trickier than the one I described in my previous post.

The target is defined by a metamodel (SWT) which inherits from a first one (CORE)
In CORE metamodel, in the 'widgets' package, we have an abstract class : AbstractContainer which owns a reference to a layout (an interface defined in 'layouts' package defined in CORE metamodel)
All the concrete implementations are defined in SWT metamodel.

So, we have

CORE
+-widgets
+-layouts

SWT
+-widgets
+-layouts

The SWT!widgets!Composite class inherits from CORE!widgets!AbstractContainer
The SWT!layouts!RowLayout inherits from CORE!layouts!Layout

What do you think about ?

Regards,

Olivier


quote title=Sylvain EVEILLARD wrote on Mon, 12 July 2010 03:59]If there are no references between those meta-models, then you have to build a fake meta-model with one EClass that will inherit from each meta-model (any EClass). By using this meta-model you can then use elements from the both meta-models.

If one of your meta-model references the other, then you can use this one as meta-model and still use the EClasses from the second one.[/quote]


Re: [ATL] One target model and more than one target metamodels [message #546343 is a reply to message #545876] Mon, 12 July 2010 10:08 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 511
Registered: July 2009
Senior Member
Why can't you use SWT as meta-model then ?
You'll have access to all the EClasses and you can even use a disambiguate style if necessary :
SWT!"SWT::widgets::Text"
Previous Topic:Starting Transformation pogrammatically
Next Topic:[QVTr] QVTd Project - Errors in examples?
Goto Forum:
  


Current Time: Sun Apr 20 18:12:47 EDT 2014

Powered by FUDForum. Page generated in 0.02313 seconds