[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.gmt.amw] Re: Help - AMW2ATL

Hello,

you are right, the problem is in the code you highlighted at the end.
You don't need to create the "NavigationOrAttributeCallExp" element, because it is used only if you need to obtain the attribute of an element. For instance, you would use it to produce an expression like "ot.nome".


Try to assign the "VariableExp" element directly to the "elements" property in the "SetExp" element. The new code is below:


sequence : ATL!SetExp ( elements <- Set{aSource} ), -- here you remove the NavigationOrAttributeCallExp

aSource : ATL!VariableExp(
   referredVariable <- elementoChave
)


Regards,

Marcos.

Alexandre wrote:
Hello,
I've tried to write a high order transformation to create the following code in ATL This code is similar to the example of Class2Relational
ATL Transformation:


module Trans;
create OUT : Relational from IN : OrdemTrabalho;

rule Igualdade {
  from
    ot : OrdemTrabalho!OrdemTrabalho
  to
    saida : Relational!Table (
      name <- ot.nome,
      key <- Set {chave}
    ),
    chave : Relational!Column (
      name <- 'objectID'
    )
}


But the output of my hot is:

module Trans;
create OUT : Relational from IN : OrdemTrabalho;

rule Igualdade {
  from
    ot : OrdemTrabalho!OrdemTrabalho
  to
    saida : Relational!Table (
      name <- ot.nome,
      key <- Set {chave.} - the problem is here
    ),
    chave : Relational!Column (
      name <- 'objectID'
    )
}


The rule of my hot that generates this output is:

rule PadraoSaidaIgualdade {
from
amw: AMW!Right (amw.link.oclIsTypeOf(AMW!Igualdade))
to
atl : ATL!OutPattern (
elements <- elementoSaida,
elements <- elementoChave
),
-- Gera o elemento saida
elementoSaida : ATL!SimpleOutPatternElement(
varName <- 'saida',
type <- tipoSaida,
bindings <- ligacaoSaida,
bindings <- ligacaoConj
),
tipoSaida : ATL!OclModelElement (
name <-MOF!EClassifier.getInstanceById('right', amw.element.ref).name,
model <- ATL!OclModel.allInstances()->select ( e | e.name = 'Relational')->first()
),
ligacaoSaida : ATL!Binding(
propertyName <- 'name',
value <- valorLigacaoSaida
),
valorLigacaoSaida: ATL!NavigationOrAttributeCallExp (
name <- 'nome',
source <- fonteLigacaoSaida
),
fonteLigacaoSaida : ATL!VariableExp(
referredVariable <- thisModule.resolveTemp(amw.link.end->select (e | e.oclIsTypeOf(AMW!Left))->first()
, 'elemento')
),
-- Gera o elemento chave
elementoChave : ATL!SimpleOutPatternElement(
varName <- 'chave',
type <- tipoChave,
bindings <- ligacaoChave
),
tipoChave : ATL!OclModelElement (
name <- 'Column',
model <- ATL!OclModel.allInstances()->select ( e | e.name = 'Relational')->first()
),
ligacaoChave : ATL!Binding(
propertyName <- 'name',
value <- valorLigacaoChave
),
valorLigacaoChave: ATL!StringExp (
stringSymbol <- 'objectID'
),


-- I think that the problem is here
ligacaoConj : ATL!Binding (
propertyName <- 'key',
value <- sequence
),
sequence : ATL!SetExp (
elements <- Set{values}
),
values: ATL!NavigationOrAttributeCallExp (
source <- aSource
),
aSource : ATL!VariableExp(
referredVariable <- elementoChave
)
}




Can you help me with this problem?


Thanks,

Alexandre Mignon.