Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » ATL ignores first Enumeration Entry
ATL ignores first Enumeration Entry [message #85114] Tue, 24 June 2008 18:45 Go to next message
Eclipse UserFriend
Originally posted by: helko.glathe.freenet.de

Hi

I've made an Ecore with Enumerations.
For Example:
<eClassifiers xsi:type="ecore:EEnum" name="GroupVariabilityType">
<eLiterals name="OR" value="1" literal="or"/>
<eLiterals name="XOR" value="2" literal="xor"/>
</eClassifiers>

Inside a Rule, the enumeration will be used by
....
fg : FM!FeatureGroup (GroupVariability <- #OR)
....

The false result is:
....
<ISPJ2008:FeatureGroup/>
....

Using the second enumeration entry instead
....
fg : FM!FeatureGroup (GroupVariability <- #XOR)
....

the right result is
....
<ISPJ2008:FeatureGroup GroupVariability="xor"/>
....

This is only an example. I have many enumerations and this behavior accurs
accessing all of them.

Is this a bug or am I wrong?

Regards, Helko
Re: [ATL] ATL ignores first Enumeration Entry [message #85145 is a reply to message #85114] Wed, 25 June 2008 08:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mddfabro.ilog.fr

Hello,

In fact, the results are correct, because this is one way how EMF
handles enumerations: it does not serialize the first one.

Marcos.

Helko Glathe wrote:
> Hi
>
> I've made an Ecore with Enumerations.
> For Example:
> <eClassifiers xsi:type="ecore:EEnum" name="GroupVariabilityType">
> <eLiterals name="OR" value="1" literal="or"/>
> <eLiterals name="XOR" value="2" literal="xor"/>
> </eClassifiers>
>
> Inside a Rule, the enumeration will be used by
> ...
> fg : FM!FeatureGroup (GroupVariability <- #OR)
> ...
>
> The false result is:
> ...
> <ISPJ2008:FeatureGroup/>
> ...
>
> Using the second enumeration entry instead
> ...
> fg : FM!FeatureGroup (GroupVariability <- #XOR)
> ...
>
> the right result is
> ...
> <ISPJ2008:FeatureGroup GroupVariability="xor"/>
> ...
>
> This is only an example. I have many enumerations and this behavior accurs
> accessing all of them.
>
> Is this a bug or am I wrong?
>
> Regards, Helko
Re: [ATL] ATL ignores first Enumeration Entry [message #85160 is a reply to message #85145] Wed, 25 June 2008 10:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------050004070008000509070905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Marcos,

Specifically EMF doesn't serialize default values. I.e., if
eIsSet(<feature>) returns false, the value for that feature won't be
serialized because of this guard in XMLSaveImpl:

protected boolean shouldSaveFeature(EObject o, EStructuralFeature f)
{
return o.eIsSet(f) || keepDefaults && f.getDefaultValueLiteral()
!= null;
}

You can set keepDefault to true with the following option such that if
the feature itself has an explicit default, the feature's value will be
serialized even if the feature isn't set:

/**
* Keep default content ( e.g. default attributes). This applies
to saving and converting contents to DOM.
* By default the default content is discarded.
* To save the default content, set this option to
<code>Boolean.TRUE</code>.
*/
String OPTION_KEEP_DEFAULT_CONTENT = "KEEP_DEFAULT_CONTENT";



Marcos Didonet Del Fabro wrote:
> Hello,
>
> In fact, the results are correct, because this is one way how EMF
> handles enumerations: it does not serialize the first one.
>
> Marcos.
>
> Helko Glathe wrote:
>> Hi
>>
>> I've made an Ecore with Enumerations.
>> For Example:
>> <eClassifiers xsi:type="ecore:EEnum" name="GroupVariabilityType">
>> <eLiterals name="OR" value="1" literal="or"/>
>> <eLiterals name="XOR" value="2" literal="xor"/>
>> </eClassifiers>
>>
>> Inside a Rule, the enumeration will be used by
>> ...
>> fg : FM!FeatureGroup (GroupVariability <- #OR)
>> ...
>>
>> The false result is:
>> ...
>> <ISPJ2008:FeatureGroup/>
>> ...
>>
>> Using the second enumeration entry instead
>> ...
>> fg : FM!FeatureGroup (GroupVariability <- #XOR)
>> ...
>>
>> the right result is
>> ...
>> <ISPJ2008:FeatureGroup GroupVariability="xor"/>
>> ...
>>
>> This is only an example. I have many enumerations and this behavior
>> accurs
>> accessing all of them.
>>
>> Is this a bug or am I wrong?
>>
>> Regards, Helko


--------------050004070008000509070905
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Marcos,<br>
<br>
Specifically EMF doesn't serialize default values.&nbsp; I.e., if
eIsSet(&lt;feature&gt;) returns false, the value for that feature won't
be serialized because of this guard in XMLSaveImpl:<br>
<blockquote>&nbsp; protected boolean shouldSaveFeature(EObject o,
EStructuralFeature f)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; return o.eIsSet(f) || keepDefaults &amp;&amp;
f.getDefaultValueLiteral() != null;<br>
&nbsp; }<br>
</blockquote>
You can set keepDefault to true with the following option such that if
the feature itself has an explicit default, the feature's value will be
serialized even if the feature isn't set:<br>
<blockquote><small>&nbsp; /**</small><br>
<small>&nbsp;&nbsp; * Keep default content ( e.g. default attributes). This
applies to saving and converting contents to DOM.</small><br>
<small>&nbsp;&nbsp; * By default the default content is discarded.</small><br>
<small>&nbsp;&nbsp; * To save the default content, set this option to
&lt;code&gt;Boolean.TRUE&lt;/code&gt;.</small ><br>
<small>&nbsp;&nbsp; */</small><br>
<small>&nbsp; String OPTION_KEEP_DEFAULT_CONTENT = "KEEP_DEFAULT_CONTENT";</small><br>
</blockquote>
<br>
<br>
Marcos Didonet Del Fabro wrote:
<blockquote cite="mid:g3su84$6bp$1@build.eclipse.org" type="cite">Hello,
<br>
<br>
In fact, the results are correct, because this is one way how EMF
handles enumerations: it does not serialize the first one.
<br>
<br>
Marcos.
<br>
<br>
Helko Glathe wrote:
<br>
<blockquote type="cite">Hi
<br>
<br>
I've made an Ecore with Enumerations.
<br>
For Example:
<br>
&lt;eClassifiers xsi:type="ecore:EEnum" name="GroupVariabilityType"&gt;
<br>
&nbsp;&nbsp;&nbsp; &lt;eLiterals name="OR" value="1" literal="or"/&gt;
<br>
&nbsp;&nbsp;&nbsp; &lt;eLiterals name="XOR" value="2" literal="xor"/&gt;
<br>
&lt;/eClassifiers&gt;
<br>
<br>
Inside a Rule, the enumeration will be used by
<br>
....
<br>
fg : FM!FeatureGroup (GroupVariability &lt;- #OR)
<br>
....
<br>
<br>
The false result is:
<br>
....
<br>
&lt;ISPJ2008:FeatureGroup/&gt;
<br>
....
<br>
<br>
Using the second enumeration entry instead
<br>
....
<br>
fg : FM!FeatureGroup (GroupVariability &lt;- #XOR)
<br>
....
<br>
<br>
the right result is
<br>
....
<br>
&lt;ISPJ2008:FeatureGroup GroupVariability="xor"/&gt;
<br>
....
<br>
<br>
This is only an example. I have many enumerations and this behavior
accurs
<br>
accessing all of them.
<br>
<br>
Is this a bug or am I wrong?
<br>
<br>
Regards, Helko
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------050004070008000509070905--
Re: [ATL] ATL ignores first Enumeration Entry [message #85190 is a reply to message #85160] Wed, 25 June 2008 15:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: helko.glathe.freenet.de

How to set keepDefault to true inside an Eclipse ATL Rule?

Regards, Helko

Ed Merks wrote:

> Marcos,
>
> Specifically EMF doesn't serialize default values. I.e., if
> eIsSet(<feature>) returns false, the value for that feature won't be
> serialized because of this guard in XMLSaveImpl:
>
> protected boolean shouldSaveFeature(EObject o, EStructuralFeature f)
> {
> return o.eIsSet(f) || keepDefaults && f.getDefaultValueLiteral()
> != null;
> }
>
> You can set keepDefault to true with the following option such that if
> the feature itself has an explicit default, the feature's value will be
> serialized even if the feature isn't set:
>
> /**
> * Keep default content ( e.g. default attributes). This applies
> to saving and converting contents to DOM.
> * By default the default content is discarded.
> * To save the default content, set this option to
> <code>Boolean.TRUE</code>.
> */
> String OPTION_KEEP_DEFAULT_CONTENT = "KEEP_DEFAULT_CONTENT";
>
>
>
> Marcos Didonet Del Fabro wrote:
>> Hello,
>>
>> In fact, the results are correct, because this is one way how EMF
>> handles enumerations: it does not serialize the first one.
>>
>> Marcos.
>>
>> Helko Glathe wrote:
>>> Hi
>>>
>>> I've made an Ecore with Enumerations.
>>> For Example:
>>> <eClassifiers xsi:type="ecore:EEnum" name="GroupVariabilityType">
>>> <eLiterals name="OR" value="1" literal="or"/>
>>> <eLiterals name="XOR" value="2" literal="xor"/>
>>> </eClassifiers>
>>>
>>> Inside a Rule, the enumeration will be used by
>>> ...
>>> fg : FM!FeatureGroup (GroupVariability <- #OR)
>>> ...
>>>
>>> The false result is:
>>> ...
>>> <ISPJ2008:FeatureGroup/>
>>> ...
>>>
>>> Using the second enumeration entry instead
>>> ...
>>> fg : FM!FeatureGroup (GroupVariability <- #XOR)
>>> ...
>>>
>>> the right result is
>>> ...
>>> <ISPJ2008:FeatureGroup GroupVariability="xor"/>
>>> ...
>>>
>>> This is only an example. I have many enumerations and this behavior
>>> accurs
>>> accessing all of them.
>>>
>>> Is this a bug or am I wrong?
>>>
>>> Regards, Helko
Re: [ATL] ATL ignores first Enumeration Entry [message #85265 is a reply to message #85190] Thu, 26 June 2008 12:51 Go to previous message
loukil is currently offline loukilFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Helko,

The keepDefault option is not yet supported by ATL.
I recommend you to use Eclipse Bugzilla in order to add this feature
request.

Regards,
Brahim.

Helko Glathe a écrit :
> How to set keepDefault to true inside an Eclipse ATL Rule?
>
> Regards, Helko
>
> Ed Merks wrote:
>
>> Marcos,
>>
>> Specifically EMF doesn't serialize default values. I.e., if
>> eIsSet(<feature>) returns false, the value for that feature won't be
>> serialized because of this guard in XMLSaveImpl:
>>
>> protected boolean shouldSaveFeature(EObject o, EStructuralFeature f)
>> {
>> return o.eIsSet(f) || keepDefaults && f.getDefaultValueLiteral()
>> != null;
>> }
>>
>> You can set keepDefault to true with the following option such that if
>> the feature itself has an explicit default, the feature's value will be
>> serialized even if the feature isn't set:
>>
>> /**
>> * Keep default content ( e.g. default attributes). This applies
>> to saving and converting contents to DOM.
>> * By default the default content is discarded.
>> * To save the default content, set this option to
>> <code>Boolean.TRUE</code>.
>> */
>> String OPTION_KEEP_DEFAULT_CONTENT = "KEEP_DEFAULT_CONTENT";
>>
>>
>>
>> Marcos Didonet Del Fabro wrote:
>>> Hello,
>>>
>>> In fact, the results are correct, because this is one way how EMF
>>> handles enumerations: it does not serialize the first one.
>>>
>>> Marcos.
>>>
>>> Helko Glathe wrote:
>>>> Hi
>>>>
>>>> I've made an Ecore with Enumerations.
>>>> For Example:
>>>> <eClassifiers xsi:type="ecore:EEnum" name="GroupVariabilityType">
>>>> <eLiterals name="OR" value="1" literal="or"/>
>>>> <eLiterals name="XOR" value="2" literal="xor"/>
>>>> </eClassifiers>
>>>>
>>>> Inside a Rule, the enumeration will be used by
>>>> ...
>>>> fg : FM!FeatureGroup (GroupVariability <- #OR)
>>>> ...
>>>>
>>>> The false result is:
>>>> ...
>>>> <ISPJ2008:FeatureGroup/>
>>>> ...
>>>>
>>>> Using the second enumeration entry instead
>>>> ...
>>>> fg : FM!FeatureGroup (GroupVariability <- #XOR)
>>>> ...
>>>>
>>>> the right result is
>>>> ...
>>>> <ISPJ2008:FeatureGroup GroupVariability="xor"/>
>>>> ...
>>>>
>>>> This is only an example. I have many enumerations and this behavior
>>>> accurs
>>>> accessing all of them.
>>>>
>>>> Is this a bug or am I wrong?
>>>>
>>>> Regards, Helko
>
Previous Topic:[Announce] M2M ATL 2.0.0 is available
Next Topic:[ATL] New vs Old Launch Configurations and Ganymede Missing Features
Goto Forum:
  


Current Time: Fri Sep 20 23:27:55 GMT 2019

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

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

Back to the top