Author Topic: Shape Script Stereotypes and Instances  (Read 6926 times)

mmontminy

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Shape Script Stereotypes and Instances
« on: February 16, 2019, 02:26:43 am »
Hi,

I have created Stereotypes extending ArchiMate Stereotype. I've added tagged value to my Stereotypes. I've created Shape Script that based on the value of those tagged values will render the Stereotype differently. That works fine for the Stereotype itself. But when I create Instances of those Stereotypes, the tagged value is there and I can set it but the Shape Script is not executed.

Is there a way to do this?

Thanks!
Martin

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #1 on: February 16, 2019, 03:15:20 am »
I don't know Archimate('s MDG) but you'd probably need to extend also the corresponding Object for your stereotype.

q.

mmontminy

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #2 on: February 16, 2019, 07:02:20 am »
I didn't know you could do that (extend objects of a stereotype). How do you do that?

Also, tagged values which are attributes of my stereotype are "inherited" by the instances(objects) of my stereotype. The shape script attached to the "_image" Attribute of my stereotype is not used when displaying the objects. That doesn't really surprises me because all objects look like they are rendered as UML Class object.
Martin

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1324
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #3 on: February 16, 2019, 09:11:06 am »
I didn't know you could do that (extend objects of a stereotype). How do you do that?
The the diagram you created the stereotype add an object and link the stereotype with an extension relationship

I Also, tagged values which are attributes of my stereotype are "inherited" by the instances(objects) of my stereotype. The shape script attached to the "_image" Attribute of my stereotype is not used when displaying the objects. That doesn't really surprises me because all objects look like they are rendered as UML Class object.
You  need a stereotype to extend the object to get the shapescript and tags. The step above will fix that.
You should end up with classes and objects with stereotypes.
By the way ArchiMate doesn't have the concept of instances but in order to create multiple objects of the same I used instances too.
For example system software like windows server 2016 in technology diagrams
Happy to help
:)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shape Script Stereotypes and Instances
« Reply #4 on: February 16, 2019, 04:37:52 pm »
In one of the properties of the stereotype you can define what their instances are.
By default they are UML objects.

Geert

Thelonius

  • EA User
  • **
  • Posts: 274
  • Karma: +6/-0
  • I think. Therefore I get paid.
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #5 on: February 19, 2019, 09:52:53 am »
"By the way ArchiMate doesn't have the concept of instances"

Archimate does have the concept of instances, through the Specialisation relationship. Use it all the time. Different thinking to UML Instantiated Objects, however. :-)

Thelonius

  • EA User
  • **
  • Posts: 274
  • Karma: +6/-0
  • I think. Therefore I get paid.
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #6 on: February 19, 2019, 09:58:28 am »
Hi,

I have created Stereotypes extending ArchiMate Stereotype. I've added tagged value to my Stereotypes. I've created Shape Script that based on the value of those tagged values will render the Stereotype differently. That works fine for the Stereotype itself. But when I create Instances of those Stereotypes, the tagged value is there and I can set it but the Shape Script is not executed.

Is there a way to do this?

Thanks!

This is what I'd like to be able to do. I haven't found any instructions on how to modify / extend the Archimate 3 MDG Technology. I'd like to be able to draw annotation markers on Archimate shapes (simple squares or circles) and fill them with simple colours and / or  a few alphanum characters based on a the value of a tagged value settable for that object.

I'm sure someone has done this before, but I'm sadly not gifted at coding or scripting.

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #7 on: February 19, 2019, 12:31:21 pm »
This is what I'd like to be able to do. I haven't found any instructions on how to modify / extend the Archimate 3 MDG Technology. I'd like to be able to draw annotation markers on Archimate shapes (simple squares or circles) and fill them with simple colours and / or  a few alphanum characters based on a the value of a tagged value settable for that object.

For example

To specialise the ArchiMate 3 Driver to and ArchiMate Risk Driver you have the following relationships in your MDG
  • ArchiMate Risk Driver extends class
  • ArchiMate Risk Driver generalises ArchiMate3::ArchiMate_Driver

To do the shapescript tho' you enter the wiggity world of the third worst MDG shapescripting :-)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #8 on: February 19, 2019, 03:25:39 pm »
ArchiMate Risk Driver extends class

I'd no longer recommend that, and it's no longer in our help.
https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/non-uml_metatypes.html

I haven't seen a scenario where it caused anything good to happen in a while. (But I have seen it cause confusion about which metaclass extension to use etc)

To do the shapescript tho' you enter the wiggity world of the third worst MDG shapescripting :-)

You can probably avoid it if you call drawparentshape() in your script. Then you just draw what you want over the top (or outside the 0,0,100,100 rect of the original.)

mmontminy

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #9 on: February 20, 2019, 06:11:16 am »
In one of the properties of the stereotype you can define what their instances are.
By default they are UML objects.

Geert

I'v tried your suggestion and it seems to work very well. But there is a side effect I don't understand. The stereotype objects and there instances are now displayed with the full namespace. The diagram properties option to show or not namespace has no effect.
Martin

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1324
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #10 on: February 20, 2019, 06:34:21 am »
"By the way ArchiMate doesn't have the concept of instances"

Archimate does have the concept of instances, through the Specialisation relationship. Use it all the time. Different thinking to UML Instantiated Objects, however. :-)
Interesting take on that but I don't interpret specialisation as identifying an instance. To quote the 3.01 spec
Quote
As explained in Section 3.6, the ArchiMate language in general focuses on the modeling of types, not instances, since this is the most relevant at the Enterprise Architecture level of description...
Of course if you get 10 architects reading a spec you'll get 11 interpretations of it. One from the author and 10 from each of the architects
Happy to help
:)

mmontminy

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #11 on: February 20, 2019, 09:09:56 am »
Actually I do both a high level diagram showing only ArchiMate type/stereotype and an instantiation of it that provide the actual implementation. The later one using instances. It's like a UML deployment diagram.

I'm happy with the high level version that falls into Enterprise Architecture scope. On the other hand, other stakeholders need the implementation version and Sparx E.A. support both rather nicely. Much better than doing it in Visio.

As per my problem with the namespace always displaying. I traced it to the shape script I wrote. The drawing methods drawparentshape and drawnativeshape behave very differently. I understand that I should be using drawparentshape as I am extending non-UML Object types. I still don't fully understand the behavior but getting closer.

Thanks all!
Martin

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Shape Script Stereotypes and Instances
« Reply #12 on: February 20, 2019, 09:50:50 am »
Actually I do both a high level diagram showing only ArchiMate type/stereotype and an instantiation of it that provide the actual implementation. The later one using instances. It's like a UML deployment diagram.

I create an archetypal diagram.  And then I have elements realise the archetype.  For example I will model Microsoft Exchange with a technology diagram as a single node with associated system software, interfaces, functions it al.  Then the actual server nodes realise the Exchange archetype node.