Author Topic: Tagged Values for Roles?  (Read 6741 times)

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Tagged Values for Roles?
« on: December 14, 2014, 08:59:22 am »
Hi all,
I have EA10 Ultimate which does not have TVs for Roles (which is a showstopper for my code generation, which needs to regard several additional properties for association roles).

Does any later version of EA introduced TVs for roles?

// Rolf Lampa
-- There's always a solution --

qwerty

  • EA Guru
  • *****
  • Posts: 12778
  • Karma: +363/-295
  • I'm no guru at all
    • View Profile
Re: Tagged Values for Roles?
« Reply #1 on: December 14, 2014, 09:46:25 pm »
Can you tell us how you create a Role?

q.

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Tagged Values for Roles?
« Reply #2 on: December 15, 2014, 12:31:53 pm »
Quote
Can you tell us how you create a Role?

Sorry, "roles" are of course implicit in the model ("target" and "source"), I actually meant to say that for these (roles/association-ends) it seems that I cannot apply a meta class as to make the TVs be inserted automagically for a stereotype (it works only for the association itself, not for the association ends).

That means that I'd have to define all TVs manually for each association end (role), but I need more than ten TVs for each role so that's not an option really.

Is this fixed in later versions than EA10?

// Rolf Lampa
-- There's always a solution --

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7718
  • Karma: +101/-18
    • View Profile
Re: Tagged Values for Roles?
« Reply #3 on: December 15, 2014, 03:49:09 pm »
In the current version, applying the stereotype will automatically add all the tagged values. I think you can also drag a stereotype extending an AssociationRole from the toolbox to the end of an existing connector to apply it.
Eve

support@sparxsystems.com

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Tagged Values for Roles?
« Reply #4 on: December 15, 2014, 07:41:33 pm »
OK, hopefully I can test this with the EA11 trial before upgrading?
-- There's always a solution --

qwerty

  • EA Guru
  • *****
  • Posts: 12778
  • Karma: +363/-295
  • I'm no guru at all
    • View Profile
Re: Tagged Values for Roles?
« Reply #5 on: December 16, 2014, 12:04:18 am »
I guess that should work. (My above question was due to a too late evening - I was looking for some Role element ::))

q.

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Tagged Values for Roles?
« Reply #6 on: December 16, 2014, 05:27:06 am »
Quote
I guess that should work. (My above question was due to a too late evening - I was looking for some Role element ::))

I wrote the first question at a too late hour too. :)

I tried EA11, and yes, now it works. That is, the TVs are now attached to each end role (instead of only to the Association itself) and moreover,  when right-clicking on a Stereotype in the ToolBox I can update that Stereotype in the entire model.

3 more problems:

1. Now to figure out how to create new model elements (classes, attributes, operations and links) with the correct Stereotypes included already from creation!
Q: Any good tutorials out there?

2. I have a broken link between Stereotypes and UML Types (in Settings | UML Types) which also is stuck in the Stereotype-list and so it cannot be removed. (The delete button is disabled when the broken one is selected). I can create a new copy and delete the new one, but not the broken one. This causes two identical Stereotypes to show up when defining Stereotypes in model elements .
Q: How can I remove a broken link between Stereotype & UML Type?

3. For some reason TVs without a value or default value (should be void) suddenly returns the following crap value instead of an empty string: "$ea_notes=". TVs with valid values returns its value as expected, only the empty TVs returns this strange crap ("$ea_notes="). This odd "value" started to show up after I had updated the Stereotypes as described in the beginning of this post.

Q: Any clue about why this is, and most important, how do I fix this? (I have hundreds of reads of TVs in my code generation so I hesitate to add an additional check
if TV != "" and TV != "$ea_notes=" ... :)

// Rolf Lampa
« Last Edit: December 16, 2014, 05:30:42 am by Rolf_Lampa »
-- There's always a solution --

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Tagged Values for Roles?
« Reply #7 on: December 16, 2014, 07:22:30 am »
Hm, isn't there any patches for EA10* fixing this hassle with Stereotypes?

I mean, $699 is pretty much only for fixing that little bug (EA10 Ultimate ->EA11).

No upgrade prices either?

// Rolf Lampa

* I have EA 10.0.1006
-- There's always a solution --

qwerty

  • EA Guru
  • *****
  • Posts: 12778
  • Karma: +363/-295
  • I'm no guru at all
    • View Profile
Re: Tagged Values for Roles?
« Reply #8 on: December 16, 2014, 09:00:51 am »
1. Isn't that simply creating a MDG (or using an existing one) and dragging the element/stereotype in question onto the diagram?

2. I haven't heard of such broken links so far. Probably you should report that as bug (link bottom right of this page). Also try deleting the connector from the Relations window. Will that work? As a last resort: write a script or SQL to get rid of it.

3. no idea. I stopped using this crude macros years ago in favor of scripts.

Bonus question: you're probably pissed here. I just have corporate and that 60€ are affordable anyway (even if I dislike some of the "updates").

q.
« Last Edit: December 16, 2014, 09:01:50 am by qwerty »

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Tagged Values for Roles?
« Reply #9 on: December 16, 2014, 09:09:51 am »
1. Well yes, but if I drag a, say, "<<myAssociation>>" to the diagram, then my new association should also have its Stereotypes set for the association ends to "<<myRole>>", but now the Stereotype fields are empty for the association ends after the association is created.

2. :(

3. The crappy results was produced during Code Generation. Is there any other way to generate code?  (I'd really like to be able to generate attributes for outgoing links, for example, but I don't think one can determine the direction of a link (from a Class context) in the Code Gen.  :(

// Rolf Lampa
« Last Edit: December 16, 2014, 09:12:46 am by Rolf_Lampa »
-- There's always a solution --

qwerty

  • EA Guru
  • *****
  • Posts: 12778
  • Karma: +363/-295
  • I'm no guru at all
    • View Profile
Re: Tagged Values for Roles?
« Reply #10 on: December 16, 2014, 10:03:29 am »
1. I haven't been swimming in that water. Maybe one of the Sparxian can help.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7718
  • Karma: +101/-18
    • View Profile
Re: Tagged Values for Roles?
« Reply #11 on: December 16, 2014, 04:46:06 pm »
Quote
2. I have a broken link between Stereotypes and UML Types (in Settings | UML Types) which also is stuck in the Stereotype-list and so it cannot be removed. (The delete button is disabled when the broken one is selected). I can create a new copy and delete the new one, but not the broken one. This causes two identical Stereotypes to show up when defining Stereotypes in model elements .
Q: How can I remove a broken link between Stereotype & UML Type?
Is one coming from a technology imported into your model? You may not be able to see from that list, but if you look in the resources window and find your technology imported there it may be an answer.

Quote
3. For some reason TVs without a value or default value (should be void) suddenly returns the following crap value instead of an empty string: "$ea_notes=". TVs with valid values returns its value as expected, only the empty TVs returns this strange crap ("$ea_notes="). This odd "value" started to show up after I had updated the Stereotypes as described in the beginning of this post.
Pretty sure I remember that some tagged value tables in EA don't have a notes field. That identifier was used to separate notes from the value proper. Not sure why it's showing up for you though.

Quote
Hm, isn't there any patches for EA10* fixing this hassle with Stereotypes?

I mean, $699 is pretty much only for fixing that little bug (EA10 Ultimate ->EA11).

No upgrade prices either?
Only the current version will get any fixes. There is an upgrade pricing, if you haven't receive (or have misplaced) your renewal email then contact our sales department. Additioanlly, each purchase includes a year worth of upgrades.

Quote
1. Well yes, but if I drag a, say, "<<myAssociation>>" to the diagram, then my new association should also have its Stereotypes set for the association ends to "<<myRole>>", but now the Stereotype fields are empty for the association ends after the association is created.
There's no built-in way to specify that associations with one stereotype should cause their roles to be stereotyped too. Or at least not one that I know of.

Quote
3. The crappy results was produced during Code Generation. Is there any other way to generate code?  (I'd really like to be able to generate attributes for outgoing links, for example, but I don't think one can determine the direction of a link (from a Class context) in the Code Gen.  :(
Code gen only calls the Linked Attribute template for associations that it believes need to be generated. But there's no way to customize what those conditions are.
Eve

support@sparxsystems.com

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Tagged Values for Roles?
« Reply #12 on: December 17, 2014, 05:34:28 am »
Quote
Quote
2. I have a broken link between Stereotypes and UML Types (in Settings | UML Types) which also is stuck in the Stereotype-list and so it cannot be removed. (The delete button is disabled when the broken one is selected). I can create a new copy and delete the new one, but not the broken one. This causes two identical Stereotypes to show up when defining Stereotypes in model elements .
Q: How can I remove a broken link between Stereotype & UML Type?
Is one coming from a technology imported into your model? You may not be able to see from that list, but if you look in the resources window and find your technology imported there it may be an answer.
No, it looks good in the resource file (only one instance). Thus the broken fragment seems to be an orphan residing in the database.

I'd be thankful for a script (preferably VBscript) accessing and removing the orphan? (name: "bold.attr" (name doesn't show in the edit fields, see fig 1.) with the erroneous stereotype: "property".

Fig 1: Orphan:


Fig 2: The valid one:




Quote
Quote
3. For some reason TVs without a value or default value (should be void) suddenly returns the crap value instead of an empty string: "$ea_notes=". TVs with valid values returns its value as expected, only the empty TV values returns this strange crap ("$ea_notes="). This odd "value" started to show up after I had updated the Stereotypes as described in the beginning of this post.
Pretty sure I remember that some tagged value tables in EA don't have a notes field. That identifier was used to separate notes from the value proper. Not sure why it's showing up for you though.
No, nothing there. Preview shows this :
Code: [Select]
<TaggedValues>
<Tag name="Bold.CPPName" type="Bold.CPPName" default="" values="" unit="" description=""/>
Both "default" and "values" have (proper) empty strings, no crap in them, so either there's a bug in the importer (probably not, because it looks good in the TV editor after import), or (more probable) in the code generator.  The code generated result :
Code: [Select]
"...,Bold.CPPName=$ea_notes=,..."(the "$ea_notes=" shouldn't there. Expected result should be no value at all).

As you pointed, there is no such thing as a "note" field in the TVs, so one possibility is that someone has planned for a future note field and that that extra note field is referenced, perhaps as an intermediate (extra) Json field when retrieving model element data internally for the code gen?



Quote
Quote
Hm, isn't there any patches for EA10* fixing this hassle with Stereotypes?

I mean, $699 is pretty much only for fixing that little bug (EA10 Ultimate ->EA11).

No upgrade prices either?
Only the current version will get any fixes. ...
The hassle with stereotypes was discussed here (on the forum) long before EA11 came. I had to abandon my projects then, but now again I have even bigger need for supporting special code generation.



Quote
Quote
1. Well yes, but if I drag a, say, "<<myAssociation>>" to the diagram, then my new association should also have its Stereotypes set for the association ends to "<<myRole>>", but now the Stereotype fields are empty for the association ends after the association is created.
There's no built-in way to specify that associations with one stereotype should cause their roles to be stereotyped too. Or at least not one that I know of.
OK, I have made a VBscript that iterates the model and inserts stereotypes for roles where they're missing. Is there a way to run scripts automatically at certain UI events or the alike? Or a quick meny for running scripts for "current" model elements?



(continued, post too long)...
-- There's always a solution --

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Tagged Values for Roles?
« Reply #13 on: December 17, 2014, 05:49:45 am »
Continued:

Quote
Quote
3. The crappy results was produced during Code Generation. Is there any other way to
 generate code?  (I'd really like to be able to generate attributes for outgoing links, for
 example, but I don't think one can determine the direction of a link (from a Class
context) in the Code Gen.  :(
Code gen only calls the Linked Attribute template for associations that it believes need to
 be generated. But there's no way to customize what those conditions are.
Event triggers: - Is it possible to call a predefined VBscript from the code generator when an association is detected (and also output any generated "attribute" result strings into the right place, that is, among attributes)?

Transform model?: - Or, another option, would it be possible to "transform" links into attributes into a new (intermediate) model, and then generate the final code from that model?

My own code gen?: - If none of the above, I guess I'm forced to write my own code generator from scratch in VBscript. But I'm afraid that VBscript is very slow and I have very big models to deal with (>250 classes with average 5+ associations and 10+ attributes per class, with average 15+ TVs per model element (class, attributes & links & roles).

Fastest model dump ever?: - What's the fastest way to dump a model into a readable format? Is there any Json exporter for example?

// Rolf Lampa
« Last Edit: December 17, 2014, 05:54:15 am by Rolf_Lampa »
-- There's always a solution --

qwerty

  • EA Guru
  • *****
  • Posts: 12778
  • Karma: +363/-295
  • I'm no guru at all
    • View Profile
Re: Tagged Values for Roles?
« Reply #14 on: December 17, 2014, 06:35:43 am »
Quote
Event triggers: - Is it possible to call a predefined VBscript from the code generator when an association is detected (and also output any generated "attribute" result strings into the right place, that is, among attributes)?

Transform model?: - Or, another option, would it be possible to "transform" links into attributes into a new (intermediate) model, and then generate the final code from that model?

My own code gen?: - If none of the above, I guess I'm forced to write my own code generator from scratch in VBscript. But I'm afraid that VBscript is very slow and I have very big models to deal with (>250 classes with average 5+ associations and 10+ attributes per class, with average 15+ TVs per model element (class, attributes & links & roles).

Fastest model dump ever?: - What's the fastest way to dump a model into a readable format? Is there any Json exporter for example?

// Rolf Lampa
triggers -  I don't know but would guess that no.

transform - I (again) guess that this would be possible. Though I don't like the transformation idea (or the way it is handled in EA) for various reasons.

own generator: I once did that with Perl and it was (at another guess) not too much slower than a native Cxx implementation. Most time is wasted in accessing the database. So if you have an idea what to do you can optimize that quite a lot. Even with the API if you got the idea how EA bundles (or doesn't bundle) queries.

fastest: Likely XMI. This is bound into EA and (likely?) rather optimized. I guess it is feasible to use XSLT to convert it to JSON. But probably (at least for me) it's easier to create the JSON via automation.

q.