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 Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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. I.e., if
eIsSet(<feature>) returns false, the value for that feature won't
be serialized because of this guard in XMLSaveImpl:<br>
<blockquote> protected boolean shouldSaveFeature(EObject o,
EStructuralFeature f)<br>
{<br>
return o.eIsSet(f) || keepDefaults &&
f.getDefaultValueLiteral() != null;<br>
}<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> /**</small><br>
<small> * Keep default content ( e.g. default attributes). This
applies to saving and converting contents to DOM.</small><br>
<small> * By default the default content is discarded.</small><br>
<small> * To save the default content, set this option to
<code>Boolean.TRUE</code>.</small ><br>
<small> */</small><br>
<small> 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>
<eClassifiers xsi:type="ecore:EEnum" name="GroupVariabilityType">
<br>
<eLiterals name="OR" value="1" literal="or"/>
<br>
<eLiterals name="XOR" value="2" literal="xor"/>
<br>
</eClassifiers>
<br>
<br>
Inside a Rule, the enumeration will be used by
<br>
....
<br>
fg : FM!FeatureGroup (GroupVariability <- #OR)
<br>
....
<br>
<br>
The false result is:
<br>
....
<br>
<ISPJ2008:FeatureGroup/>
<br>
....
<br>
<br>
Using the second enumeration entry instead
<br>
....
<br>
fg : FM!FeatureGroup (GroupVariability <- #XOR)
<br>
....
<br>
<br>
the right result is
<br>
....
<br>
<ISPJ2008:FeatureGroup GroupVariability="xor"/>
<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 message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 Go to previous message](theme/Solstice/images/up.png) |
loukil![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=brahim-khalil.loukil%40univ-nantes.fr) 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
>
|
|
|
Goto Forum:
Current Time: Tue Aug 27 23:34:17 GMT 2024
Powered by FUDForum. Page generated in 0.04522 seconds
|