|
|
Re: Problem with refining mode in ATL (2) [message #1830778 is a reply to message #1830761] |
Mon, 03 August 2020 17:31 |
|
Refining mode is correct for this, but your understanding of how ATL rules work in refining mode is not. In order to "refine" a model element, you must list the element as the first one both in the "from" part and the "to" part. You're currently listing an instance of "RepairMeta!repair" as the instance to refine, but your ATL module header states that you want to refine "SMD" models, not "RepairMeta" models.
What you probably mean to do is something like this:
rule appendConstraints{
from
s: SMD!ownedRule,
r: RepairMeta!repair
to
t : SMD!ownedRule (
id <- r.id + 'Repair' ,
constrainedElement <- thisModule.getConstrainedElement(s."node-Type", r.id)
)
}
The rule above will change all instances of "SMD!ownedRule" for every instance of "RepairMeta!repair".
Your attached project also has some issues with the metamodels, which can cause problems. To view these problems, do the following:
- Open the .ecore metamodel in the Sample Ecore Model Editor
- Right-click the root element
- Select the first "Validate" option (there may be two)
It is best to address these metamodel issues before going any further.
Cheers,
Dennis
|
|
|
|
Re: Problem with refining mode in ATL (2) [message #1830817 is a reply to message #1830792] |
Tue, 04 August 2020 18:49 |
|
Andreas Bäuerle wrote on Tue, 04 August 2020 08:21
What I want to do is to leave the existing instances of "SMD!ownedRule" untouched (transfer them like they are) and add instances of "SMD!ownedRule" for each instance of a repair.
In that case, your original rule was correct: for reach "repair" instance you want to generate a new "ownedRule". You may choose to omit the "notNeeded" output element from the rule, as long as there is no output model of type "RepairMeta" (i.e. ATL cannot modify the "RepairMeta" instance model).
Cheers,
Dennis
|
|
|
Powered by
FUDForum. Page generated in 0.01975 seconds