Book a Demo

Author Topic: New stereotype creation  (Read 10254 times)

ralfeus

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
New stereotype creation
« on: August 23, 2016, 06:13:14 pm »
Hi
I'm trying to create a new stereotype, which would extend the Archimate2::ArchiMate_Network one. In fact I just want to add some attributes and keep appearance same as original stereotype.
I used this manual to create a stereotype extending non-UML stereotype: http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/non_uml_metatypes.html
Whole definition looks like this:

The "_image" attribute contains image script:
shape main{
   drawparentshape();
}
When I import the profile and add the SBNetwork object to diagram it has appearance of regular UML class whilst I want it to look exactly as Network object:

Can I achieve that?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: New stereotype creation
« Reply #1 on: August 23, 2016, 06:47:44 pm »
Have you tried to just leave away the shape script and _image stuff?

q.

ralfeus

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: New stereotype creation
« Reply #2 on: August 23, 2016, 06:55:29 pm »
Yes, that was first attempt. Appearance is same.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: New stereotype creation
« Reply #3 on: August 23, 2016, 08:00:49 pm »
Over the years I've extended archimate MDG to add attributes and I manage to get it to work by not having the _image in the SBNetwork stereotype so the parent shapescript is invoked. Note that you must have the ArchiMate V2.0 MDG enabled otherwise it won't work and you end up with the base UML shape.
Alternatively you can re-write the archimate shapescript and put it in the _image attribute of SBNetwork. Geert Bellekens even provides a script to extra shape scripts from MDG's so you could you that from his open source shapescript library
http://community.sparxsystems.com/news/978-presenting-the-new-open-source-enterprise-architect-shapescript-library
Happy to help
:)

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: New stereotype creation
« Reply #4 on: August 24, 2016, 01:35:27 pm »
From memory you also have to extend the abstract metaclass for it all to work properly.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: New stereotype creation
« Reply #5 on: August 24, 2016, 02:27:30 pm »
From memory you also have to extend the abstract metaclass for it all to work properly.

I believe this is the key.
See http://sparxsystems.com/enterprise_architect_user_guide/12.1/building_models/non-uml_metatypes.html for an example.

Geert

ralfeus

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: New stereotype creation
« Reply #6 on: August 24, 2016, 04:44:59 pm »
Yeah, that was it! That's strange the Sparx manual doesn't mention necessity to extend the metaclass.
Only unclear thing left - why the element's color isn't same as Archimate2::ArchiMate_Network?


Also now when I drag an element to the diagram I get a menu to choose between two identical elements. Does it have something with the fact my stereotype extends two classes at once?
though it's not that that terrible.
Thank you guys for the help.
« Last Edit: August 24, 2016, 05:00:31 pm by ralfeus »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: New stereotype creation
« Reply #7 on: August 24, 2016, 05:36:17 pm »
Look closely at the the image, there is one extension, and one generalization.
Make sure it looks exactly like the image in the help page.
Then it should be fine.

I believe you can also remove the _image attribute completely in order to get the exact rendering of the parent.

If all else fails, you can still use the complete archimate shapescript: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/blob/master/Archimate2/ArchiMate_Network.shapeScript

Geert

ralfeus

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: New stereotype creation
« Reply #8 on: August 24, 2016, 05:45:22 pm »
Look closely at the the image, there is one extension, and one generalization.
Make sure it looks exactly like the image in the help page.

Yeah, it extends Class and generalizes Archimate2::ArchiMate_Network:


I believe you can also remove the _image attribute completely in order to get the exact rendering of the parent.

Indeed removing the _image attribute helped :-)

If all else fails, you can still use the complete archimate shapescript

My goal is actually to inherit as much as possible and do copy/paste as little as possible :-)

ralfeus

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: New stereotype creation
« Reply #9 on: August 24, 2016, 06:10:30 pm »
Also I'm unable to show element's tags on the diagram. I tried to turn on tags showing as described here. But tags didn't show up.
When I removed stereotype the tags did show up. So I suspect their visibility is suppressed in ArchiMate_Network sterotype. Is there any way to override this?

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: New stereotype creation
« Reply #10 on: August 25, 2016, 08:52:43 am »
In my EA MDG I extended only the archimate 2 element without the need for the base uml meta class and it worked fine. i.e. no need to extend class too. If you think about it the Archimate 2 element is already extending the uml meta class so you may end up with some side effects by extending the meta class twice.

Tags on diagram -  Well the archimate 2 shapescript doesn't seem to support that so you have a couple of options.
a) connect a note and connect the note to the element using linked note element feature (left click on connector to get context menu) and select tags
b) create and _image attribute and write the shapescript to do that all that. Use Geert's shape script code to extract the shapescript to start you off rather than starting from scratch.

BTW; I've got an EA MDG model that extends Archimate 2 which is used to create a custom EA MDG based on ArchiMate and I share it with folk I know across NZ govt under a creative commons ShareAlike licence https://creativecommons.org/licenses/by-sa/4.0/ Free of charge. I can remove the NZ Govt specific stuff and share it if anyone is interested.

Similarly I have a Enterprise Integration Patterns MDG I could share too based on Gregor Hohpe's book http://www.enterpriseintegrationpatterns.com/.
 
The question is where is the best place to share them? Any suggestions?
Happy to help
:)

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: New stereotype creation
« Reply #11 on: August 25, 2016, 09:06:45 am »
Also I'm unable to show element's tags on the diagram. I tried to turn on tags showing as described here. But tags didn't show up.
When I removed stereotype the tags did show up. So I suspect their visibility is suppressed in ArchiMate_Network sterotype. Is there any way to override this?

Archimate does not have compartments.  So there is no [UML] compartment to display your tags in.  Someone like Paolo probably has lots of suggestions about how you can UMLize up your Archimate :-)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: New stereotype creation
« Reply #12 on: August 25, 2016, 09:57:08 am »
Also I'm unable to show element's tags on the diagram. I tried to turn on tags showing as described here. But tags didn't show up.
When I removed stereotype the tags did show up. So I suspect their visibility is suppressed in ArchiMate_Network sterotype. Is there any way to override this?

Archimate does not have compartments.  So there is no [UML] compartment to display your tags in.  Someone like Paolo probably has lots of suggestions about how you can UMLize up your Archimate :-)
He has a lot of suggestions on how to use ArchiMate as the base for a viable modelling methodology (not necessarily to "UMLize").  Not only suggestions, but a working example - which is able to self-modify "in flight" as the modelling requirements and understanding of the metamodels improves.

To analogise what Glassboy said elsewhere today, "Some (most?) Modelling Standards are actually brain damaged (at least to some extent)."

Added to which, the tool vendors add their (sometimes inconsistent) spin on the standards.

However, in order to make this work, you have to create (and maintain) your own MDG which is hopefully more self (and externally) consistent than those provided - which, to be fair to Sparx, are necessarily constrained by having to conform to the standards.

Once you understand that and take the leap, it's not that difficult, just needs discipline.

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

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: New stereotype creation
« Reply #13 on: August 25, 2016, 10:49:36 am »
Added to which, the tool vendors add their (sometimes inconsistent) spin on the standards.

Or don't use them.  I'm currently learning PowerDesigner and I'm having to remind myself constantly that unless I'm in a UML model then a dependency or a trace is whatever the vendor wants it to be :-)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: New stereotype creation
« Reply #14 on: August 25, 2016, 12:48:59 pm »
The question is where is the best place to share them? Any suggestions?

The community site and Github would be my choice I guess.
I use github for anything code related.

Geert