Setting attribute with first literal of an enumeration [message #1776988] |
Thu, 23 November 2017 07:49  |
Eclipse User |
|
|
|
Hello there,
I've noted a behavior of Sirius (Obeo Designer Community, Version 10.0.0) when trying to set an enumeration literal value to an attribute.
CONTEXT:
- There is a class "Relationship" that contains an enumeration literal as attribute, this enumeration has two literals:
...
<eClassifiers xsi:type="ecore:EClass" name="Relationship">
...
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#//RelationshipType"/>
...
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="RelationshipType">
<eLiterals name="OneToOne" value="1"/>
<eLiterals name="OneToMany" value="2"/>
...
- Model operation: I've created two separated Edge (element-based) Creation tools, the main diference between them is the value set for "type" feature. Please see attached figurem that shows the "OneToMany" tool (the other tool is configured in similar fashion, just changing the literal value to OneToOne)

PROBLEM:
- The first enumeration literal never makes to the model. See below an excerpt of the xmi file after using the edge creation tools:
<relations source="//@entities.2" target="//@entities.1" type="OneToMany" name="R2"/> // using set type to OneToMany
<relations source="//@entities.3" target="//@entities.0" name="R3"/> // using set type to OneToOne
- I've made some exploration, added more literals to the enumeration, and I've got same behavior: if the value is set with FIRST enumerarion literal, it is not registered in the underline model.
Is this an expected behavior? We should assume the first literal as default value for an enumeration attribute? Also, we should assume that this value will not be registered in the model file?
Thank you in advance.
Best regards,
Camilo.
|
|
|
|
|
Re: Setting attribute with first literal of an enumeration [message #1777498 is a reply to message #1777346] |
Wed, 29 November 2017 12:31  |
Eclipse User |
|
|
|
Hello Julien,
Thanks for you help. The metamodel is registered in the project, and the option with "aql:" works same way as using "[... /]" notation.
I have made some more testing, and it really seems that first literal of an enumeration is treated as a 'default' value. In fact, if the attribute is not filled in the model, the query aql:self.target.type == javason::RelationshipType::OneToOne returns true.
For my current needs, it is not a problem since the EAttribute is supposed to be assigned all times.
Thank you,
Camilo.
|
|
|
Powered by
FUDForum. Page generated in 0.24188 seconds