[ATL] ecore to ecore transformation [message #63873] |
Fri, 12 October 2007 14:35 |
Eclipse User |
|
|
|
Originally posted by: n.toublanc.laposte.net
Hi all,
I'm trying to write my first ATL project using Eclipse 3.3. Here is my
first ATL file :
module ClassModel2DAClassModel; -- Module Template
create da : MOF from dto : MOF;
rule Package{
from
ip :MOF!EPackage
to
op :MOF!EPackage(
name <- ip.name + '.da.hibernate.impl'
)
}
rule Class {
from
ic : MOF!EClass
to
oc : MOF!EClass (
name <- ic.name + 'DAImpl'
)
}
The result is that the packages and the classes are created with the
suffixes I specified.
Example :
- km3 format of my ecore input
package "com.mdd.test" {
class Project {
attribute name[0-1] : ;
attribute beginDate[0-1] : ;
attribute endDate[0-1] : ;
attribute id[0-1] : ;
}
- km3-like format of my ecore output
package "com.mdd.test.da.impl" {
}
class ProjectImpl {
}
So, it's not too bad to begin. The first problem is that my classes are
not in the package. How could I do that in my ATL file?
Then, I would like to add some methods in my MyClassDAImpl like :
public List<MyClass> getAll(){
}
How could I do that?
I will try to read the ATL guide to understand that myself, but I you
can simply explain me the concepts I need to know to do that, it would
really help me.
Thanks for your help.
Regards
|
|
|
Re: [ATL] ecore to ecore transformation [message #63896 is a reply to message #63873] |
Fri, 12 October 2007 14:43 |
Eclipse User |
|
|
|
Originally posted by: freddy.allilaire.univ-nantes.fr
Hi Nicolas,
I advise you to take a look to the following article/example:
http://www.eclipse.org/m2m/atl/basicExamples_Patterns/Tree2L ist/
(especially section 6).
Regards,
Freddy.
Nicolas Toublanc a écrit :
> Hi all,
>
> I'm trying to write my first ATL project using Eclipse 3.3. Here is my
> first ATL file :
>
> module ClassModel2DAClassModel; -- Module Template
> create da : MOF from dto : MOF;
>
> rule Package{
> from
> ip :MOF!EPackage
> to
> op :MOF!EPackage(
> name <- ip.name + '.da.hibernate.impl'
> )
> }
>
> rule Class {
> from
> ic : MOF!EClass
> to
> oc : MOF!EClass (
> name <- ic.name + 'DAImpl'
> )
> }
>
> The result is that the packages and the classes are created with the
> suffixes I specified.
>
> Example :
> - km3 format of my ecore input
> package "com.mdd.test" {
>
> class Project {
> attribute name[0-1] : ;
> attribute beginDate[0-1] : ;
> attribute endDate[0-1] : ;
> attribute id[0-1] : ;
> }
> - km3-like format of my ecore output
> package "com.mdd.test.da.impl" {
>
> }
> class ProjectImpl {
> }
>
>
> So, it's not too bad to begin. The first problem is that my classes are
> not in the package. How could I do that in my ATL file?
>
> Then, I would like to add some methods in my MyClassDAImpl like :
>
> public List<MyClass> getAll(){
> }
>
> How could I do that?
>
> I will try to read the ATL guide to understand that myself, but I you
> can simply explain me the concepts I need to know to do that, it would
> really help me.
>
>
> Thanks for your help.
>
> Regards
--
Freddy Allilaire - ATLAS Group (INRIA & LINA)
http://www.sciences.univ-nantes.fr/lina/atl/contrib/allilair e
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03427 seconds