How can I represent a Python dictionary in UML?

人盡茶涼 提交于 2019-12-14 02:38:28

问题


I would like to know how I can represent a Python dictionary using UML. This dictionary is an attribute of a class called Digraph. The keys are of type Node, and the values are of type Edge.


回答1:


Qualified associations are useful for modeling maps/dictionaries.

See uml-diagrams.org for some examples.

You can also read the official UML (2.5) specs (see page 215)

And your particular problem can be represented as:

However note that this is only for nodes with single outgoing edges (its one-to-one mapping); if this wasn't your intention than the mapping would have to be Node to array of Edges. (and changing 1 into *).



来源:https://stackoverflow.com/questions/29912096/how-can-i-represent-a-python-dictionary-in-uml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!