Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Problem with refining mode in ATL (2)
Problem with refining mode in ATL (2) [message #1830760] Mon, 03 August 2020 13:22 Go to next message
Andreas Bäuerle is currently offline Andreas BäuerleFriend
Messages: 11
Registered: April 2020
Junior Member
Hello again!

I thought it would be advantageous to show you my problem in a larger scope. My task is to take 2 input xmi files. The first one is a description of a state machine diagram and shall be refined using the data in the of the second file. By refining I mean, that for each repair, a statement of kind

<ownedRule id="_YuUUycHQEeqlZKYKBU5D1w" constrainedElement="_YuUU8MHQEeqlZKYKBU5D1w">
<specification type="LiteralString" id="_YuUUysHQEeqlZKYKBU5D1w" value="x&lt;=2"/>
</ownedRule>

should be added. However I think that the second file is not correctly read. I use ATL rules of the kind, which I came up with after hours of "research". No errors are given.

rule appendConstraints{
from
s: RepairMeta!repair
to
notNeeded: RepairMeta!repair (),
t : SMD!ownedRule (
id <- s.id + 'Repair' ,
constrainedElement <- thisModule.getConstrainedElement(s."node-Type", s.id)
)
}


The project is attached.

I do not know what I am doing wrong. Any help is appreciated.

Bests, Andreas
  • Attachment: SysAnno.zip
    (Size: 9.11KB, Downloaded 86 times)
Re: Problem with refining mode in ATL (2) [message #1830761 is a reply to message #1830760] Mon, 03 August 2020 13:23 Go to previous messageGo to next message
Andreas Bäuerle is currently offline Andreas BäuerleFriend
Messages: 11
Registered: April 2020
Junior Member
Is the refining mode the correct choice for my use-case? :)
Re: Problem with refining mode in ATL (2) [message #1830778 is a reply to message #1830761] Mon, 03 August 2020 17:31 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

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 #1830792 is a reply to message #1830778] Tue, 04 August 2020 06:21 Go to previous messageGo to next message
Andreas Bäuerle is currently offline Andreas BäuerleFriend
Messages: 11
Registered: April 2020
Junior Member
Hi Dennis!

Thank you for your fast answer. I eliminated the issues with the ecore models, your hint that there are 2 validate options helped me very much.

The refining rules run, but only existing instances of "SMD!ownedRule" are considered and refined. 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.

Is it possible to change the rule accordingly?

Bests, Andreas
Re: Problem with refining mode in ATL (2) [message #1830817 is a reply to message #1830792] Tue, 04 August 2020 18:49 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

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
Previous Topic:Problem with refining mode in ATL
Next Topic:Casting in ATL
Goto Forum:
  


Current Time: Wed Apr 24 15:55:58 GMT 2024

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

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

Back to the top