Book a Demo

Author Topic: Special Characters in stereotype names/labels...  (Read 17914 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Special Characters in stereotype names/labels...
« on: November 20, 2015, 05:07:57 pm »
The UML specification appears/is mute on what characters may constitute a stereotype label/name (it seems ambiguous on what it shall be called).

I'm keen (for a variety of reasons which I won't go into here), to use some special characters in the names of some stereotypes.

1.  Does anybody know if any reason UML would not allow me to use such characters?  For example, I'd expect that using the guillemet characters might "play havoc" with the (apparent) output semantics.

2.  Does Sparx EA impose any additional restrictions on which characters may be used. For example, Character sets, Unicode ranges etc...  Or impediments due to the MDG generation/loading process.

TIA,
Paolo
« Last Edit: November 20, 2015, 05:08:49 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Special Characters in stereotype names/labels.
« Reply #1 on: November 20, 2015, 10:35:00 pm »
The only char that definitely does not work is a comma. What also will cause trouble it the colon. You can specify a FQN like MDG::stereo (and EA will mangle that so it has its internal t_xref structures). Further chars like new line/carriage return are probably no good idea. I just used "[ch960][ch8730]" (pi sqrt) as stereo and that worked. I can't remember anything in the specs (but I also have not fostered that in this respect).

MDGs are XML exports. So they are escaped and you will likely see &#uNNN; or the like (also not tested).

q.

P.S. Hmm. I probably need to switch to Jet4. The abov "[ch960][ch8730]" has changed to "pv".

P.P.S: Yes. With Jet4 it is saved as name="[ch960][ch8730]" and I can use it as such in the MDG.

P.P.P.S. The specs define (any) name as StringExpression which is defined as
Quote
A StringExpression is an Expression that specifies a String value that is derived by concatenating a sequence of operands with String values or a sequence of subExpressions, some of which might be template parameters.
No mention of il/legal characters whatsoever.

P4.S. There is a URI in an example the specs:
Code: [Select]
<ownedAttribute xmi:id="id349" name="text">
    <type xmi:type="uml:PrimitiveType"
          href="http://www.omg.org/spec/UML/YYYYMMnn/PrimitiveTypes.xmi#String"/>
  </ownedAttribute>
but that URI does not exist (maybe if someone knows what to use for YYYYMMnn?

P5.S. You can use guillemets also as or inside stereotypes. But the rendering will definitely look strange. So «» will render as ««»».
« Last Edit: November 20, 2015, 11:17:46 pm by qwerty »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Special Characters in stereotype names/labels.
« Reply #2 on: November 23, 2015, 09:26:05 am »
I can't remember seeing UML explicitly make any restrictions on valid stereotype names. However, XMI places more restrictions by encoding the stereotype name as the element name. That's mainly important  for interchange between tools though.

There's also precedent within OMG specifications for a different keyword (what's displayed between « and ») being used than the stereotype name. EA currently doesn't offer that as an option for user profiles though.
« Last Edit: November 23, 2015, 09:29:21 am by simonm »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Special Characters in stereotype names/labels.
« Reply #3 on: November 23, 2015, 10:52:59 am »
Thanks Simon (et al)...

I'm not thinking of anything outlandish, just not your usual alphanumerics...

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Special Characters in stereotype names/labels.
« Reply #4 on: November 23, 2015, 11:33:00 am »
Quote
The only char that definitely does not work is a comma. What also will cause trouble it the colon. You can specify a FQN like MDG::stereo (and EA will mangle that so it has its internal t_xref structures). Further chars like new line/carriage return are probably no good idea.
I would add ; ' " () to that list. Anything that might be used as a delimiter is best avoided. Spaces are OK as long as they're not leading or trailing.
« Last Edit: November 23, 2015, 12:01:32 pm by KP »
The Sparx Team
[email protected]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Special Characters in stereotype names/labels.
« Reply #5 on: November 23, 2015, 05:37:23 pm »
Interestingly, when adding ; ' " () as stereotype EA gets some hick-ups but saves that string. But when you try to apply it to its base class it will not work.

q.