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.