Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Apply a stereotype on a diagram?
Apply a stereotype on a diagram? [message #1779603] Wed, 10 January 2018 08:41 Go to next message
Yoann Farré is currently offline Yoann FarréFriend
Messages: 41
Registered: November 2017
Member
Hello everyone,

I'm currently working on customization of Papyrus via some plugins and I would know if there is a way to apply a stereotype to a diagram. I would had attributes to this stereotype.
As "Diagram" metaclass is not available when creating a profile, I would say that it is not possible. Did I miss something?

In the case where this is not possible, what would be the workaround to obtain a similar behavior? Create a stereotyped element to own the diagram? Anything else?

(I already use custom representation kinds via an architecture file).

Thank you for reading.

Yoann.
Re: Apply a stereotype on a diagram? [message #1779606 is a reply to message #1779603] Wed, 10 January 2018 09:07 Go to previous messageGo to next message
Benoit Maggi is currently offline Benoit MaggiFriend
Messages: 129
Registered: March 2013
Location: Bordeaux, France
Senior Member
Hi Yoann,

Profile/Stereotype is a mechanism to extend UML
Diagram/notation isn't part of UML.
So you won't be able to simply attach a stereotype application to a diagram.
(you may probably be able to do it by raw hacking, but I won't recommend it)

Did you had a look to eAnnotations mechanism ?

Another more UML compliant solution would be to apply the stereotype to the owner of the diagram.

/Benoit
Re: Apply a stereotype on a diagram? [message #1779608 is a reply to message #1779603] Wed, 10 January 2018 09:22 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
@Benoit Maggi

The UML Specification 2.5 specifies

B.7.13 UMLDiagram [Abstract Class]
B.7.13.1 Description
The most general class for UML diagrams.

I and I guess also Yoann Farré interprets this, as UMLDiagram shall be a Metaclass as for example Class.

I also would like to have the possibility to assign a Profile (includes OCL) to an UML Diagram. That way the allowed elements and relations can be restricted. An IMHO elegant way to enforce modeling Guidelines.

/pica

[Updated on: Wed, 10 January 2018 09:24]

Report message to a moderator

Re: Apply a stereotype on a diagram? [message #1779609 is a reply to message #1779608] Wed, 10 January 2018 09:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6001
Registered: July 2009
Senior Member
Hi

You haven't explained why you want to stereotype a diagram.

Suppose you want all classes to be NICE. If NICEness is an important aspect of your model that should appear in the UML model then you should perhaps ensure that all objects in the NICE diagram are contained by a <NICE>Package and that other elements are not. Perhaps NICE elements are just the targets of references from NICEManager.niceElements.

Alternatively if NICE is a purely visual effect that does not need to be modelled, you can surely use the many Papyrus facilities such as layers and CSS styling that I am not familiar with.

Remember that a diagram is just a partial view of the model. Just like using a magnifying glass to inspect some text. Is NICE a characteristic of the text, or a consequence of viewing the text with a magnifying glass?

Regards

Ed Willink
Re: Apply a stereotype on a diagram? [message #1779610 is a reply to message #1779609] Wed, 10 January 2018 09:56 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
I can and thus will not speak for Yoann Farré, but as far I am concerned it is about enforcing modeling guidelines on diagram Level (please refer to https://www.eclipse.org/forums/index.php?t=msg&th=1091004&goto=1779608&#msg_1779608)).

Having available the profile mechanism for diagram I could sub-type e.g. a class diagram as an interface declaration diagram. A NICE piece of useability sugar would be, that the Papyrus "magic connectors" (just to use the ArchiMate term) and the Palette would react on the assignment.

/pica


PS I am Aware of the SOLID criterias, but what are the NICE criterias are about?

[Updated on: Wed, 10 January 2018 09:59]

Report message to a moderator

Re: Apply a stereotype on a diagram? [message #1779612 is a reply to message #1779610] Wed, 10 January 2018 10:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6001
Registered: July 2009
Senior Member
Hi

"NICE" is just a 'neutral' adjective for the purposes of discussion. Sorry if it implied some major formalization.

Once UMLDI is supported, the UMLDiagram class should be available and all the good/bad qualities of stereotypes and profiles could apply.

Regards

Ed Willink
Re: Apply a stereotype on a diagram? [message #1779613 is a reply to message #1779609] Wed, 10 January 2018 10:16 Go to previous messageGo to next message
Benoit Maggi is currently offline Benoit MaggiFriend
Messages: 129
Registered: March 2013
Location: Bordeaux, France
Senior Member
@Carsten: UMLDiagram [Abstract Class] is part of Annex B: UML Diagram Interchange (which is about interchange UMLDI not contained in the UML core Meta-model)

- Extension [Class] (12.4.1) has these association ends : /metaclass : Class [1..1]{} and ownedEnd : ExtensionEnd [1..1]{
- As far as I can tell An UMLDiagram isn't a class (it extends UML::CommonStructure::PackageableElement ( See B.2.2))
So I believe that it isn't allowed to define a Stereotype on an UMLDiagram
( but I didn't reread all the annex so I may have missed something)

You can apply a profile to a package containing your diagram, this should restrict the possibility of elements and relations.

@Yoann: Do you have a real use case for this requirement ?

That said:
- I didn't find any java implementation for UMLDiagram
- I agree with Ed: a diagram is just a view of your model.


Re: Apply a stereotype on a diagram? [message #1779617 is a reply to message #1779613] Wed, 10 January 2018 10:42 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Benoit Maggi wrote on Wed, 10 January 2018 11:16
@Carsten:
...
- I agree with Ed: a diagram is just a view of your model.


On M1 ( meta Level 1, as defined in UML up to 2.4.1) I fully agree.

But not on M2 (meta level 2, as defined in UML up to 2.4.1) I do not agree at all. And defining profiles I locate on M2.

/pica
Re: Apply a stereotype on a diagram? [message #1779618 is a reply to message #1779613] Wed, 10 January 2018 10:45 Go to previous messageGo to next message
Yoann Farré is currently offline Yoann FarréFriend
Messages: 41
Registered: November 2017
Member
Thank you all for answers!

I would like to be able to use stereotype attributes (from a stereotype applied on a diagram) to store some informations like a relation with an element (or a collection of elements) of the model.

I asked this question because I know that it is possible in other modeling tools (Rhapsody for example).

@ Benoit : I don't know the eAnnotation mechanism but I'll study this point. Thank you.
Re: Apply a stereotype on a diagram? [message #1779624 is a reply to message #1779618] Wed, 10 January 2018 11:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6001
Registered: July 2009
Senior Member
Hi

Pending Papyrus support for UMLDI and M2 extensibility, you could workaround the problem by adding a DiagramAttributes class to your model and then creating an Instance of that class in your diagram. Constraints on the DiagramAttributes class may enforce structural but not layout guidelines.

Regards

Ed Willink
Re: Apply a stereotype on a diagram? [message #1779627 is a reply to message #1779624] Wed, 10 January 2018 11:53 Go to previous message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
@Ed

Many, many thanks Ed.

I so far never thought that direction, I begin to really like your approach.

/pica
Previous Topic:sysml palette associations
Next Topic:Add DecisionNode to Activity Diagram
Goto Forum:
  


Current Time: Wed Aug 15 22:35:54 GMT 2018

Powered by FUDForum. Page generated in 0.02539 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top