Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Default value "*" of tag with type UnlimitedNatural gets lost
Default value "*" of tag with type UnlimitedNatural gets lost [message #473204] Fri, 15 June 2007 12:45 Go to next message
Peter Ellsiepen is currently offline Peter EllsiepenFriend
Messages: 19
Registered: July 2009
Junior Member
I have a stereotype "string" which applies to uml:Datatype with an
optional tag "maxLength" (multiplicity 0..1) of type UnlimitedNatural.
The default value of the tag is set to "*" to represent the unlimited
case. In the profile (*.profile.xmi) this is represented as follows:

....
<packagedElement xmi:type="uml:Stereotype"
xmi:id="_14c603f2_1098865040591_924775_32" name="string">
<ownedAttribute xmi:type="uml:Property"
xmi:id="_14c603f2_1099404297833_151496_3595" name="maxLength"
visibility="public">
<type xmi:type="uml:PrimitiveType"
href=" http://schema.omg.org/spec/UML/2.1.1/uml.xml#UnlimitedNatura l"/>
<upperValue xmi:type="uml:LiteralInteger"
xmi:id="_10_0_17260432_1129543822706_974393_80" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger"
xmi:id="_10_0_17260432_1129543822706_528510_79"/>
<defaultValue xmi:type="uml:LiteralUnlimitedNatural"
xmi:id="_12_1_17260432_1181825212478_838715_611" value="*"/>
</ownedAttribute>
<ownedAttribute xmi:type="uml:Property"
xmi:id="_12_0_17260432_1170851834566_888187_3833" name="base_DataType"
visibility="private" association="_12_0_17260432_1170851834566_168458_3831">
<type xmi:type="uml:Class"
href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#DataType"/>
</ownedAttribute>
</packagedElement>
....

Further, I have a model which applies this stereotype to a uml:DataType
but does not assign any value to the tag. In the model (*.xmi) the
stereotype application looks like this:

<Information_Viewpoint:string
xmi:id="_12_1_f810373_1178606771464_260949_405"

base_DataType="_12_1_f810373_1178606771464_122535_404"/>

From the UML 2.x semantics I would now expect that the tag "maxLength"
is assigned its default value from the stereotype definition (i.e. "*",
or -1 via LiteralUnlimitedNatural.UNLIMITED). However, when reading the
tag value via API using the convenience function

element.getValue(stereotype, "maxLength")

I always get 0, which is the default for the UnlimitedNatural type, but
not the default I assigned via my stereotype! The same happens when
loading the model into the UML2 editor, where the default value of the
stereotype tag is correctly shown as "*", but the tag value of the
stereotype application is 0.

So the issue seems to be that the default assigned by the stereotype
somehow gets lost when reading the file. Any ideas what the reason could be?

Regards, Peter

PS: I am using EMF 2.2.0 and UML2 2.0.3 with Eclipse 2.2.2. If needed, I
can send through the example via email.
Re: Default value "*" of tag with type UnlimitedNatural gets lost [message #473206 is a reply to message #473204] Fri, 15 June 2007 14:52 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Peter,


Have a look at the ecore representation of that property ( under the
annotation of the profile ).
You should see two properties, in the properties view "Default Value " and
"Default Value Literal". is the "Default Value" null?

I would guess that the ecore representation's "Default Value" is null.

Try stepping into the .getValue() function and have a look at where the code
tries to get the default value via eStructuralFeature.getDefaultValue().
Is null returned there?

The UML converter to ecore should probably make a special case for the "*"
value. If you raise a bugzilla on this it will be fixed.

In the meantime, set your default value to "-1" instead of "*" and re-define
your profile.

Cheers

- James.



"Peter Ellsiepen" <peter.ellsiepen@vega.de> wrote in message
news:f4u1m5$ta$1@build.eclipse.org...
> I have a stereotype "string" which applies to uml:Datatype with an
> optional tag "maxLength" (multiplicity 0..1) of type UnlimitedNatural.
> The default value of the tag is set to "*" to represent the unlimited
> case. In the profile (*.profile.xmi) this is represented as follows:
>
> ...
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_14c603f2_1098865040591_924775_32" name="string">
> <ownedAttribute xmi:type="uml:Property"
> xmi:id="_14c603f2_1099404297833_151496_3595" name="maxLength"
> visibility="public">
> <type xmi:type="uml:PrimitiveType"
> href=" http://schema.omg.org/spec/UML/2.1.1/uml.xml#UnlimitedNatura l"/>
> <upperValue xmi:type="uml:LiteralInteger"
> xmi:id="_10_0_17260432_1129543822706_974393_80" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_10_0_17260432_1129543822706_528510_79"/>
> <defaultValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_1_17260432_1181825212478_838715_611" value="*"/>
> </ownedAttribute>
> <ownedAttribute xmi:type="uml:Property"
> xmi:id="_12_0_17260432_1170851834566_888187_3833" name="base_DataType"
> visibility="private"
association="_12_0_17260432_1170851834566_168458_3831">
> <type xmi:type="uml:Class"
> href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#DataType"/>
> </ownedAttribute>
> </packagedElement>
> ...
>
> Further, I have a model which applies this stereotype to a uml:DataType
> but does not assign any value to the tag. In the model (*.xmi) the
> stereotype application looks like this:
>
> <Information_Viewpoint:string
> xmi:id="_12_1_f810373_1178606771464_260949_405"
>
> base_DataType="_12_1_f810373_1178606771464_122535_404"/>
>
> From the UML 2.x semantics I would now expect that the tag "maxLength"
> is assigned its default value from the stereotype definition (i.e. "*",
> or -1 via LiteralUnlimitedNatural.UNLIMITED). However, when reading the
> tag value via API using the convenience function
>
> element.getValue(stereotype, "maxLength")
>
> I always get 0, which is the default for the UnlimitedNatural type, but
> not the default I assigned via my stereotype! The same happens when
> loading the model into the UML2 editor, where the default value of the
> stereotype tag is correctly shown as "*", but the tag value of the
> stereotype application is 0.
>
> So the issue seems to be that the default assigned by the stereotype
> somehow gets lost when reading the file. Any ideas what the reason could
be?
>
> Regards, Peter
>
> PS: I am using EMF 2.2.0 and UML2 2.0.3 with Eclipse 2.2.2. If needed, I
> can send through the example via email.
Re: Default value "*" of tag with type UnlimitedNatural gets lost [message #621684 is a reply to message #473204] Fri, 15 June 2007 14:52 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Peter,


Have a look at the ecore representation of that property ( under the
annotation of the profile ).
You should see two properties, in the properties view "Default Value " and
"Default Value Literal". is the "Default Value" null?

I would guess that the ecore representation's "Default Value" is null.

Try stepping into the .getValue() function and have a look at where the code
tries to get the default value via eStructuralFeature.getDefaultValue().
Is null returned there?

The UML converter to ecore should probably make a special case for the "*"
value. If you raise a bugzilla on this it will be fixed.

In the meantime, set your default value to "-1" instead of "*" and re-define
your profile.

Cheers

- James.



"Peter Ellsiepen" <peter.ellsiepen@vega.de> wrote in message
news:f4u1m5$ta$1@build.eclipse.org...
> I have a stereotype "string" which applies to uml:Datatype with an
> optional tag "maxLength" (multiplicity 0..1) of type UnlimitedNatural.
> The default value of the tag is set to "*" to represent the unlimited
> case. In the profile (*.profile.xmi) this is represented as follows:
>
> ...
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_14c603f2_1098865040591_924775_32" name="string">
> <ownedAttribute xmi:type="uml:Property"
> xmi:id="_14c603f2_1099404297833_151496_3595" name="maxLength"
> visibility="public">
> <type xmi:type="uml:PrimitiveType"
> href=" http://schema.omg.org/spec/UML/2.1.1/uml.xml#UnlimitedNatura l"/>
> <upperValue xmi:type="uml:LiteralInteger"
> xmi:id="_10_0_17260432_1129543822706_974393_80" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_10_0_17260432_1129543822706_528510_79"/>
> <defaultValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_1_17260432_1181825212478_838715_611" value="*"/>
> </ownedAttribute>
> <ownedAttribute xmi:type="uml:Property"
> xmi:id="_12_0_17260432_1170851834566_888187_3833" name="base_DataType"
> visibility="private"
association="_12_0_17260432_1170851834566_168458_3831">
> <type xmi:type="uml:Class"
> href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#DataType"/>
> </ownedAttribute>
> </packagedElement>
> ...
>
> Further, I have a model which applies this stereotype to a uml:DataType
> but does not assign any value to the tag. In the model (*.xmi) the
> stereotype application looks like this:
>
> <Information_Viewpoint:string
> xmi:id="_12_1_f810373_1178606771464_260949_405"
>
> base_DataType="_12_1_f810373_1178606771464_122535_404"/>
>
> From the UML 2.x semantics I would now expect that the tag "maxLength"
> is assigned its default value from the stereotype definition (i.e. "*",
> or -1 via LiteralUnlimitedNatural.UNLIMITED). However, when reading the
> tag value via API using the convenience function
>
> element.getValue(stereotype, "maxLength")
>
> I always get 0, which is the default for the UnlimitedNatural type, but
> not the default I assigned via my stereotype! The same happens when
> loading the model into the UML2 editor, where the default value of the
> stereotype tag is correctly shown as "*", but the tag value of the
> stereotype application is 0.
>
> So the issue seems to be that the default assigned by the stereotype
> somehow gets lost when reading the file. Any ideas what the reason could
be?
>
> Regards, Peter
>
> PS: I am using EMF 2.2.0 and UML2 2.0.3 with Eclipse 2.2.2. If needed, I
> can send through the example via email.
Previous Topic:Default value "*" of tag with type UnlimitedNatural gets lost
Next Topic:How to get compatible Eclipse and EMF?
Goto Forum:
  


Current Time: Thu Apr 25 13:48:56 GMT 2024

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

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

Back to the top