Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Enumeration literal and reserved words(How to refer to enumeration literals that have names matching reserved words?)
Enumeration literal and reserved words [message #1847047] Wed, 13 October 2021 06:44 Go to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
I have an enumeration that contains both "in" and "out" as its literals. According to the documentation, and if I get it right, the proper syntax referring to the "in" literal should be : #"in". However, when used in a rule for assigning a value to a property, I get the following:

direction <- #out -- works fine, the "out" literal is assigned

while

direction <- #"in" -- does not work, no value is assigned

Do I missed something ?


Yves
Re: Enumeration literal and reserved words [message #1847076 is a reply to message #1847047] Wed, 13 October 2021 20:51 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

That's correct, and it works for me (tested on EMFTVM). Test code attached.
  • Attachment: ATLTest.zip
    (Size: 2.51KB, Downloaded 62 times)


Cheers,
Dennis
Re: Enumeration literal and reserved words [message #1847104 is a reply to message #1847076] Thu, 14 October 2021 16:43 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Thank you Dennis.

But actually, we cannot say it works. Indeed, in the out model, the direction does not appears. You can say that this is because "in" the default value for UML::Parameter, which is correct, but it's not the case in my target metamodel and the value is not serialized either.

I guess you will ask for a sample model, with the appropriate metamodel. I'll try to build such a bundle with a minimum size...

Also, I will try to modify your example so that there is a test on the "in" value because this does not work here either.



Yves

[Updated on: Fri, 15 October 2021 06:34]

Report message to a moderator

Re: Enumeration literal and reserved words [message #1847139 is a reply to message #1847104] Fri, 15 October 2021 16:00 Go to previous message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Hi Dennis,

Some news about this topic: I understand what happens now!

So, first, I confirm that ATL works fine and that it is not responsible for the results I get.

Explanation: as discussed, in your example the fact that the direction does not appear in the generate file is normal because the "in" direction is the default.

However in my target metamodel the direction has no default value,. So I was expecting that the value of the direction is serialized in all cases. But that was not what I observed. The direction was serialized for all direction values except the "in" one.

In fact, it looks like ecore assumes there is always a default value . If it is not specified, it considers that it is the first one in the enumeration. Indeed, if I modified the target metamodel so that the default value for the direction is explicitly set to "out", the directions with the value "in" are serialized.



Yves
Previous Topic:ATL question
Next Topic:ATL 4.5.0 release
Goto Forum:
  


Current Time: Sat Nov 11 08:17:23 GMT 2023

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

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

Back to the top