Author Topic: Add 'tags' to diagram object  (Read 8964 times)

Arnoud_B

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
    • View Profile
Add 'tags' to diagram object
« on: December 10, 2021, 10:43:55 pm »
I have scripts to align and resize my diagrams how ever sometimes I want to tell the script to skip an diagram object or do something a bit different from the standard script behaviour. So I added tags to influence that behaviour and that works. However the tag is on the element itself and not on the diagram object. So if I want one type behaviour on one diagram for an element and another type of behaviour on another diagram my implementation does not support that.
Is there any way to attach information to the diagram object 'wrapping' the element on the diagram that would fix my problem.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Add 'tags' to diagram object
« Reply #1 on: December 10, 2021, 11:41:22 pm »
Not really. Diagrams are just diagrams and not elements. You could use the diagram's stereotype. IIRC you can retrieve that as property. But there are not stereotype properties (which usually is why you define a stereotype). That stereotype of diagrams is not really a stereotype. I guess it's some legacy.

q.

Arnoud_B

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
    • View Profile
Re: Add 'tags' to diagram object
« Reply #2 on: December 11, 2021, 04:43:23 am »
I was afraid so, A diagramObject is a wrapper object of an element but it is not a really thick wrapper in SparxEA  ::)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Add 'tags' to diagram object
« Reply #3 on: December 11, 2021, 08:43:49 am »
diagramobjects are actually representations of elements on diagrams. Diagrams themself are something "special". It's not a kernel part of the UML metamodel but something set aside. So you will usually not have interchange of diagrams between UML models of different vendors. A bit shortsighted I think since SDs are just modeled as diagram and not via an abstract model (unlike ADs which could stand without graphical representation). The UML guys meant diagrams just for humans but actually the whole model is going to be read by humans. So diagrams are some central means of communication. On the other hand people only think of diagrams as being UML without reflecting the model elements being the basis. Probably it's simply just complicated - or so...

q.
« Last Edit: December 11, 2021, 08:42:29 pm by qwerty »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Add 'tags' to diagram object
« Reply #4 on: December 11, 2021, 11:08:39 am »
diagramobjects are actually representations of elements on diagrams. Diagrams themself are something "special". It's not a kernel part of the UML metamodel but something set aside. So you will usually not have an interchange of diagrams between UML models of different vendors. A bit shortsighted I think since SDs are just modelled as diagrams and not via an abstract model (unlike ADs which could stand without graphical representation). The UML guys meant diagrams just for humans but actually, the whole model is going to be read by humans. So diagrams are some central means of communication. On the other hand man, Probably people only think of diagrams as being UML without reflecting the model elements being the basis. Probably it's simply just complicated - or so...

q.
As qwerty says, Diagrams are (probably) third-class citizens of the modelling mechanism based on UML.  As is often the case, we users take invented things in different directions than envisioned by the creators.  UML is actually short for a unified modelling language for modelling source code!  When you understand that, you can see its limitations.  As qwerty says, in that scheme, diagrams aren't relevant for the generation of source code.  Instead, we humans have decided that we can use most of the UML concepts shapes, lines to model anything we need and to communicate better among ourselves without needing to generate anything.  In this scheme, diagrams are paramount as enabling different views for the same or different viewpoints of the same items in the model.


As described elsewhere, we have adopted the convention to use the diagram title block (the misnamed Diagram Element Note in Sparxian) to act as a proxy for the diagram.  We can attach properties to that item (as custom (tags) or inherent properties) and interrogate that, where possible, with our automation.  For your purposes (deciding how to lay out a diagram) this "hack" could be used to provide direction.  If the layout is dependent upon the nature of the diagram, you could use the diagram type in the automation, if it is dependent upon a specific variant of the type, then you can, as qwerty suggested, use the diagram stereotype.  But if it is independent of those two then they can't be used - this will do instead.


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

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Add 'tags' to diagram object
« Reply #5 on: December 13, 2021, 10:23:01 pm »
I've gone for a slightly different approach for Model Expert, and in my wrapper for 'EA.Diagram' added the ability to create Tagged Values for diagrams. As mentioned elsewhere, this is a gap in the Sparx implementation. I put the data into the t_taggedValue table, which is probably very naughty, but seemed a logical place.
Downside is that there is no cascade delete when the diagram gets deleted in EA, so I also need a periodic tidy-up.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13240
  • Karma: +553/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add 'tags' to diagram object
« Reply #6 on: December 14, 2021, 12:30:43 am »
I've gone for a slightly different approach for Model Expert, and in my wrapper for 'EA.Diagram' added the ability to create Tagged Values for diagrams. As mentioned elsewhere, this is a gap in the Sparx implementation. I put the data into the t_taggedValue table, which is probably very naughty, but seemed a logical place.
Downside is that there is no cascade delete when the diagram gets deleted in EA, so I also need a periodic tidy-up.
The biggest risk with this approach is that one day the Project Integrity Check will notice the rogue tagged values records and remove them.

Geert

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Add 'tags' to diagram object
« Reply #7 on: January 11, 2022, 08:22:35 pm »
I agree. Can't think how to get around that problem...
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com