Author Topic: Tagged Value and Stereotype Questions and Issues  (Read 8648 times)

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Tagged Value and Stereotype Questions and Issues
« on: April 01, 2009, 08:17:09 am »
Hi,

This is a long thread starter, and I'll agree to split this up to separate threads, if there's any interest.

I am still working on my UML-Profile for the Google Protobuf Message Definition Language. It quickly evolved from a simple UML-Profile to a
complete MDG-Technology Definition including a C# EA-AddIn to react to some certain events (praise Sparxians for their wisdom, that not all
of a group need to be implemented to catch just a single one!).

I was advised to use the PreNew events to react on and deny adding of unwanted Operations. I found out, how to use PostNew events, to adjust  my stereotyped Element and Attribute settings. But when I'm adding tagged values (AttributeTags) through the Attribute.TaggedValues collection programmatically, they behave different vs. the tagged value definitions that come along with my stereotype from the UML-Profile.
I have defined (the same) tagged value(type?)s as
  • public attributes in my profile stereotype definition
  • custom tagged value types in the 'Settings->UML' dialog

For the latter I am using exactly the same naming as the tagged values from the UML-Profile stereotypes appear in the 'Tagged Values' window when the 'Show fully qualified Tags' option is set (e.g. Protobuf::protobuf::Field::Rule, the UML-Profile package is named 'Protobuf', the stereotype name is 'protobuf::Field' and the stereotype attribute is named 'Rule'). That's also the value I use for the Name and Type parameters of the Attribute.TaggedValues.AddNew() method, when creating a tagged value programmatically. The tagged values created with any of these methods (adding a stereotyped element from Profile Ressource or Toolbox, adding a tagged value explicitely from 'Tagged Values' window or added programmatically) can be retrieved using just the last name part as Name parameter of the TaggedValues.GetByName() method, and that's fine for my purposes so far.
But anyway in the 'Tagged Values' window they all behave differently:
  • From UML-Profile: everything's fine and as expected; combobox is presented for enumerated values, namespace ('Protobuf::protobuf::<stereotype>')  disappears when 'Show fully qualified Tags' is disabled
  • From 'Add New' in 'Tagged Values' window: combobox is presented for enumerated values (I guess from custom tagged value type definition), namespace   doesn't disappear when 'Show fully qualified Tags' is disabled
  • Added programmatically: neither combobox is presented, nor namespace disappears
1st Question:
How can I get this consistent, especially when adding tagged values programmatically? I want to use the tagged value types, as they were defined in the UML-Profile. I also didn't really understand how to use the Type parameter of Collection::AddNew() method for tagged values, the example is somewhat too unclear (a comment for what "Change" is taken from would be useful).

Another issue I have found with my profile definition was, that stereotype extensions for some particular metaclasses don't behave as I expect.
I defined a stereotype to extend the 'Package' metaclass and referred from a toolbox page attibute for it as described in the SDK doc. When I'm importing the profile and add the stereotyped element from the 'Resources' window, it behaves as expected. The rendered toolbox reference doesn't :-(, there's just a stereotype icon shown in the toolbox, that does nothing when dragging it to the diagram.

2nd Question:
Did I miss something essential to define a stereotyped package class in the profile, or referencing it from the toolbox page? I did referencing the same way, as for other elements from the profile, that work well.

That's it so far, appreciate if anyone can help ...

WBR

Günther



Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #1 on: April 01, 2009, 10:59:08 pm »
1st Question:

a) I think you need to synchronize the tagged values programmatically, which can be achieved by a (still undocumented) method of the EA.Repository object:

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1236853583/2#2

b) To make the toolbox profile work, don't import the profile via the resources window, but pack it into an MDG technology. And put the technology file into the approbiate subfolder of the EA installation directory, or add it from the "Settings - MDG technologies" menu (NOT via resources window!). If it still doesn't work, the reason often is a tiny spelling mistake.

2nd Question:

It works for me with stereotyped packages as with other stereotyped elements, so it's probably a spelling mistake again. They can be hard to find, and EA doesn't help you one bit there. E.g. I once had "UML:Package" instead of "UML::Package" and it took me two days to find out why nothing showed in the toolbox page.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #2 on: April 01, 2009, 11:23:30 pm »
Regarding Frank's last point about exact naming, the typeface EA uses for many of the dialogs makes it difficult to detect errors. In particular, single and double colons look almost identical when surrounded by some letters. Other spelling errors can be hard to see. Since the process is entirely manual - you've got to type values in several places - there is a high probability of clerical error. For large and complex profiles the chance of a clerical error - you have to retype many values each time you iterate the model - quickly becomes untenable.
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #3 on: April 01, 2009, 11:39:06 pm »
Quote
Since the process is entirely manual - you've got to type values in several places - there is a high probability of clerical error

That's the problem exactly. A good profile for defining profiles should normalize this, but setting this up would take a lot of time for planning and implementation, and obviously this is not top priority. After all it's probably just a minority of EA users wanting to define profiles.

Thelonius

  • EA User
  • **
  • Posts: 274
  • Karma: +6/-0
  • I think. Therefore I get paid.
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #4 on: April 02, 2009, 08:47:14 am »
Quote
Quote
Since the process is entirely manual - you've got to type values in several places - there is a high probability of clerical error

That's the problem exactly. A good profile for defining profiles should normalize this, but setting this up would take a lot of time for planning and implementation, and obviously this is not top priority. After all it's probably just a minority of EA users wanting to define profiles.

Don't know about that, Frank. I think UML profiles are the first stop for people wanting to do some really simple and obvious things with EA. Personally, I'd like EA to do some very simple things via the application rather than having to go and create a UML Profile.

One example would be: defining a tagged value that I can name, that has an enum / pull down select list that I define, that allows me to to search, select, list, report on elements that have a tagged value that has a certain value.

Simple natural language example: "On this diagram that shows these business systems and all interfaces, select and display only those that have my tagged value Business Criticality set to HiGH".

What do you think?
 :)

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #5 on: April 02, 2009, 04:50:15 pm »
Quote
Personally, I'd like EA to do some very simple things via the application rather than having to go and create a UML Profile.

Of course. It's always nicer when you can do such things without going through the profile designing process.

As to the "minority": It's just a guess, but I reckon that most users will shy away from designing profiles and rather write a little code generation template here and there. The profile designers are probably overrepresented in this forum, but my impression is that Sparx tends to invest more in the "visible" things like diagram rendering, reporting a.s.o.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #6 on: April 02, 2009, 09:57:25 pm »
Hi,

Thanks for your help first. I have solved the second issue with my toolbox profile: spelling of the package stereotype in the toolpages attribute was correct, but I had a diagram stereotype with the same name. That was obviously the reason why it didn't work, after giving the diagram stereotype another name, the toolbox worked fine.
But in general I agree, that it's easy to have typos regarding those profile stereotype references, I need to use the screen magglass from time to time, to check for such things  ;).
About my 1st question I didn't have time to check if the solution solves my problem, but it probably will. The only concern I have about this is the performance I can expect from this operation. It applies to the whole Repository, and I'm asking myself how it will perform with large repositories. I need to do this everytime, when I want to adjust a newly created attribute. Wouldn't it make sense to have such sync operation for a particular element, attribute etc. where the tagged values are applied?

WBR
Günther

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #7 on: April 06, 2009, 07:54:28 am »
You can define a tagged value type such as a dropdown without defining a profile.

In Settings | UML | Tagged Value Types.

Look at http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/predefinedtaggedvaluetypes.html.

Once set up and used, you can do search/report on them.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Tagged Value and Stereotype Questions and Issu
« Reply #8 on: April 07, 2009, 02:14:46 am »
Thanks for your reply Simon. I know that this is possible, and as mentioned I am also using this, besides the tagged values defined in the profile.
The question was/is, how to get the behavior of the tagged value definitions, that come along with a stereotype, consistent, when setting the stereotype or adding tagged value definitions programatically.

WBR
Günther