2

If class A is created by its __metaclass M, how does the arrow look in UML?

The stereotype syntax seems to be related.

I didn't look in Python UML tools yet.

Community
  • 1
  • 1
Tobias
  • 3,882
  • 2
  • 22
  • 25

3 Answers3

4

A metaclass is drawn using the class notation plus the <<metaclass>> stereotype. The relationship between a class and its metaclass can be defined using a dependency relationship between the two (dashed line with the arrow pointing to the metaclass) annotated with the stereotype <<instantiate>>.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Jordi Cabot
  • 8,058
  • 2
  • 33
  • 39
  • Metaclasses do create classes, so wouldn't it be better to use the "create" keyword? – max Jan 16 '12 at 18:00
1

This answer is from the UML 2.2 Superstructure Specification:

More class answer: "For instance, the «create» keyword can appear next to an operation name to indicate that it is a constructor operation, and it can also be used to label a Usage dependency between two Classes to indicate that one Class creates instances of the other." (Pg 690[706-AdobeReader], Appendix B, Unnumbered 4th paragraph, 1st on the page) I think this would apply to meta-classes.

Stereotype answer: This is kind of an answer, but does not infer "create" which is the word you used in your post, but might have just been an ambiguous word choice. The notation is an normal line with a filled triangle. I have also seen the keyword of <<extend>> used in tools like Rational Software Modeler. (Pg 657[673-AdobeReader] Figure 18.3 and 659 Figure 18.5, Profile Section)

You might also want to clarify if you mean meta-class in the MOF/Model definition sense or in some language or other context.

Let me know if you refine your question.

Ted Johnson
  • 4,315
  • 3
  • 29
  • 31
  • Please specify the precise location in the spec that you're referring to, by paragraph number. I don't feel that page number is sufficient. – John Saunders Sep 28 '09 at 23:27
  • Ok, but use the page numbers not what the PDF tool says at the top. They are different. – Ted Johnson Sep 29 '09 at 02:29
  • By "paragraph number", I meant things like "18.2.3". – John Saunders Sep 29 '09 at 03:00
  • I thought using double-underscores, mentioning Python, and tagging it python would be sufficient to determine the context ;) In that language classes are instances of metaclasses. – Tobias Sep 29 '09 at 08:14
0

I would draw a dependency with the stereotype «metaclass». This is not a predefined stereotype, but should make it clear to the read what kind of dependency this is.

Martin v. Löwis
  • 124,830
  • 17
  • 198
  • 235