views:

484

answers:

3

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.

A: 

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
+2  A: 

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>>.

Jordi Cabot
+1  A: 

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
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
Ok, but use the page numbers not what the PDF tool says at the top. They are different.
Ted Johnson
By "paragraph number", I meant things like "18.2.3".
John Saunders
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