Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Ask again about three problems about ATL transfromer
Ask again about three problems about ATL transfromer [message #86837] Tue, 22 July 2008 10:17
Eclipse UserFriend
Originally posted by: ZhuangGuotao.hotmail.com

Dear all,

I am a beginner at ATL Programming. Now I meet three problems which are
not sloved by myself. I expect help to solve these. Thanks a lot.

For describing my problems, I firstly makes two very simple MetaModel.
These structures are following:

MMA( MetaModel A)

RootA( The root element of MetaModel A) (Element number bound: 1)
- EAA( Element A of MetaModel A) (Element number bound: 0..*)
- EAB( Element B of MetaModel A) (Element number bound: 1..*)

MMA ( MetaModel B)

RootB( The root element of MetaModel B) (Element number bound: 1)
- EBA( Element A of MetaModel B) (Element number bound: 0..1)
- EBB( Element B of MetaModel B) (Element number bound: 1..*)
- EBC( Element C of MetaModel B) (Element number bound: 0..*)
- EBD( Element D of MetaModel B) (Element number bound: 1)


I plan to transfer MMA to MMB. The rules are following: EAA ---> EBA
EAB ---> EBB
EAB ---> EBC
EBD is a new element.

The three problems are following:

1. How to write this rule which is about transfering EAA to EBA. if the
EAA exists, then generates one EBA, otherwise doesn't generate EBA.

2. The EBB and EBC are generated by EAB. In this MetaModel B, the EBB and
EBC are all contained by RootB, In fact, EBB and EBC maybe be contained by
different complex element.

So the general way maybe not suit for this case. The general way likes as
following:

rule EAB2EBBC {
from
ab : MMA!EAB
to
bb : MMB!EBB (
....
),
bc : MMB!EBC (
....
)
}

In the practice case, the EBB and EBC maybe be contained by different
complex element. I need this distributed way to transfer element:

rule EAB2EBB {
from
ab : MMA!EAB
to
bb : MMB!EBB (
....
)
}

rule EAB2EBC {
from
ab : MMA!EAB
to
bb : MMB!EBC (
....
)
}

If I use this distributed way in my transformer, the transformer will be
not correct. But I looked a example which is Class2Relational(
http://www.eclipse.org/m2m/atl/atlTransformations/Class2Rela tional/ExampleClass2Relational[v00.01].pdf).

In the Class2Relational, the Class!Attribute generate several target
elements by this distributed way.

rule SingleValuedDataTypeAttribute2Column {
from
a : Class!Attribute (
a.type.oclIsKindOf(Class!DataType) and not a.multiValued
)
to
out : Relational!Column (
name <- a.name,
type <- a.type
-- explicit use of implicit tracking links
-- (first expected syntax, then present actual syntax)
-- owner <- [Class2Type.key]a.owner
-- owner <- thisModule.resolveTemp(a.owner, 'key')
)
}
rule MultiValuedDataTypeAttribute2Column {
from
a : Class!Attribute (
a.type.oclIsKindOf(Class!DataType) and a.multiValued
)
to
out : Relational!Table (
name <- a.owner.name + '_' + a.name,
col <- Sequence {id, value}
),
id : Relational!Column (
name <- a.owner.name.firstToLower() + 'Id',
type <- thisModule.objectIdType
),
value : Relational!Column (
name <- a.name,
type <- a.type
)
}
rule ClassAttribute2Column {
from
a : Class!Attribute (
a.type.oclIsKindOf(Class!Class) and not a.multiValued
)
to
out : Relational!Column (
name <- a.name + 'Id',
type <- thisModule.objectIdType
)
}



3. How to write this rule which is reference to EBD which is generated by
a called rule.

if the called rule likes this :

rule genEBD() {
to
bd : MMB!EBD (
....
)
}

I try the follow way, but failed.

EBD <- thisModule.genEBD()
Previous Topic:[ATL] How to define the xsi:schemaLocation with the transformation rules?
Next Topic:[QVTO] Problems with resolve and update
Goto Forum:
  


Current Time: Tue Apr 23 09:10:51 GMT 2024

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

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

Back to the top