[ATL] How to know type of a model element in condition of matched rule [message #805115] |
Thu, 23 February 2012 10:52 |
_md2_ on Forum Messages: 9 Registered: February 2012 Location: L'Aquila |
Junior Member |
|
|
Hi all,
As the title suggests i need to know a type of a model element's field in a matched rule condition. I have 2 metatodel:
1 INPUT diff.ecore: is the metamodel of the models product with EMFCompare.
2 OUTPUT EcoreDiff: is a custom metamodel for rappresenting ModelDifference (deployed in Univeristy of L'Aquila)
At code.google.com/p/ecoredifftoemfcompare/ there is the shared code
I'm just beginning but I have some problems.
I'm try to know a dinamic type of a element.
As you can see the rule DiffGroup2ChangedPackage and DiffGroup2ChangedPackage in from field have commented on the condition. This condition is used to choose which of the two matched rule take based on the type of rightparent. They are commented out because they are never verified. The function sor.rightParent.eClass (). Name = '...' I used heavily in the earlier version and it returned the correct values, but as a helper instead that in the condition of a matched rule.
Sorry for my English
Regards
module Diff2EcoreDiff2; -- Module Template
create Out : EcoreDiff from In : diff;
--##regola che inizializza la trasformazione
rule Diff2Diff {
from
s : diff!DiffModel
to
t : EcoreDiff!DifferenceModel
(
differenceElements <- s.ownedElements.first().subDiffElements->collect(e | thisModule.resolveTemp(e,'element'))
)
}
--metodo per le aggiungere una changedPackage
rule DiffGroup2ChangedPackage {
from
sor : diff!DiffGroup--(sor.rightParent.eClass().name='EPackage')
to
element : EcoreDiff!ChangedEPackage(
updatedElement <- sor.rightParent,
name <- sor.rightParent.name,
eStructuralFeatures <- sor.subDiffElements->collect(e | thisModule.resolveTemp(e,'element'))
)
}
--##metodo per le aggiungere una changedClass
rule DiffGroup2ChangedClass {
from
s : diff!DiffGroup--(s.rightParent.eClass().name='EClass')
to
element : EcoreDiff!ChangedEClass(
updatedElement <- s.rightParent,
name <- s.rightParent.name,
eStructuralFeatures <- s.subDiffElements->collect(e | thisModule.resolveTemp(e,'element'))
)
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03532 seconds