Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Zero values in literals omitted in .UML file(Papyrus seems to omit the value tag in the uml file if the value of a lteral is zero)
Zero values in literals omitted in .UML file [message #1773294] Tue, 26 September 2017 08:45 Go to next message
Benedikt Bauer is currently offline Benedikt BauerFriend
Messages: 11
Registered: March 2017
Junior Member
A colleague of mine recently came across some unexpecetd behaviour in the .uml file that Papyrus uses to save a SyML model: If the value of a literal in an an instance slot is zero, the "value" tag in the .uml file is omitted. It looks like papyrus is assuming implicitly that a missing value tag equals a value of "0".

I was wondering whether this is a convention in the XMI standard or something Papyrus does on its own for some reason. If the latter, is it a bug or is it intended?

Steps to reproduce

  1. Create a SysML model
  2. Add an instance specification and an instance slot therein
  3. Create literals of of different types (integer, real, bool...) in the instance slot. Create some with value "0" and some with a non-zero value
  4. Save the model
  5. Open the .uml file of the model with a text editor and search for the definition of the created literals (Compare code below).
  6. Only literals of nonzero value contain a value="..." tag.


      <slot xmi:type="uml:Slot" xmi:id="_stN8QJnuEeeFToQU8dZboQ" definingFeature="_2Xe3kJntEeenh9hS7_Hu7Q">
        <value xmi:type="uml:LiteralReal" xmi:id="_KLexEJnvEeeFToQU8dZboQ" name="real"/>
        <value xmi:type="uml:LiteralInteger" xmi:id="_qykYAJnvEeeFToQU8dZboQ" name="int"/>
        <value xmi:type="uml:LiteralBoolean" xmi:id="_LMRqQJnwEeeFToQU8dZboQ" name="bool_false"/>
        <value xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Ri9fgJnwEeeFToQU8dZboQ" name="LiteralUnlimitedNatural"/>
        <value xmi:type="uml:LiteralBoolean" xmi:id="_wys94KKUEeejL5UD3kFAsw" name="bool_true" value="true"/>
        <value xmi:type="uml:LiteralInteger" xmi:id="_zjBJYKKUEeejL5UD3kFAsw" name="int_nonzero" value="11"/>
        <value xmi:type="uml:LiteralReal" xmi:id="_4opmcKKUEeejL5UD3kFAsw" name="real_nonzero" value="0.1"/>
        <value xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_7on-kKKUEeejL5UD3kFAsw" name="LiteralUnlimitedNatural_nonzero" value="12"/>
      </slot>


I din't check for a UML model but I would expect the same outcome.

[Updated on: Tue, 26 September 2017 08:56]

Report message to a moderator

Re: Zero values in literals omitted in .UML file [message #1773298 is a reply to message #1773294] Tue, 26 September 2017 08:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5573
Registered: July 2009
Senior Member
Hi

This is a standard EMF behavior. The default value of a LiteralInteger is zero, so to serialize it would be bloat. Programmatically, there is an XMLResource.OPTION_KEEP_DEFAULT_CONTENT save option if you like bloat.

Regards

Ed Willink
Re: Zero values in literals omitted in .UML file [message #1773300 is a reply to message #1773298] Tue, 26 September 2017 08:59 Go to previous message
Benedikt Bauer is currently offline Benedikt BauerFriend
Messages: 11
Registered: March 2017
Junior Member
Hi Ed,

thanks a lot for the really quick answer. Great to see that it's not a bug.

Cheers, Benedikt
Previous Topic:How to specialize a SysML diagram for user defined usage
Next Topic:missing constructor stereotype in Papyrus
Goto Forum:
  


Current Time: Wed Jan 17 09:30:09 GMT 2018

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

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