Sparx Systems Forum
Enterprise Architect => Uml Process => Topic started by: F@lk on December 11, 2020, 08:38:34 pm
-
Hi,
I have an object diagram with 2 objects I created by drag'n'drop from the model tree which was parsed from my C++ source code. I noticed there is not automatically an arrow between two objects although one object is an attribute of the other object and there is also a parent pointer back. So I manually created an accociation arrow between both created objects. But now the question is how can I show a "has"-relationship? My toolbox just offers: Accociate, Depedency, Realize, Trace, Information Flow, Abstraction, Substitution, Usage, Derive, Refine, Responsibility, Note Link. I have the feeling they are all not what I understand as "one has the other one"-relationship.
Thanx in advance,
-- F@lk
-
Hello,
The "has" relationship is normally expressed in UML using a composition or aggregation, but it's a property of classes, not objects.
With objects what you can do is express the relationship at the class level as attributes, and then in the objects set the run state of the containing object to the name of the contained object. This has to be maintained manually, there's no automation that helps you keep it updated.
HTH,
/Uffe
-
...express the relationship at the class level as attributes...
I parsed my C++ source code and there is actually already that relationship because the classes have their proper attributes, I mean class A has an attribute of class B.
...and then in the objects set the run state of the containing object to the name of the contained object...
What do you exactly mean here? Is it something how I can tweak the accociation arrow between two objects?
Furthermore, I tried a Composite Structure diagram but it also has no support of "has"-relationship arrows between objects. I just wonder what such "property" stuff means, which makes no sense if you have parsed C++ classes with attributes and methods and create object instances from them.
-
...and then in the objects set the run state of the containing object to the name of the contained object...
What do you exactly mean here? Is it something how I can tweak the accociation arrow between two objects?
No, but you can name the instance of class B and then set that as the corresponding attribute's value in the A instance's run state.
Furthermore, I tried a Composite Structure diagram but it also has no support of "has"-relationship arrows between objects. I just wonder what such "property" stuff means, which makes no sense if you have parsed C++ classes with attributes and methods and create object instances from them.
In UML, such relationships are expressed using classes. Since every instance of a class will "have" the same contents, there's no point in expressing that in object diagrams.
/U
-
No, but you can name the instance of class B and then set that as the corresponding attribute's value in the A instance's run state.
I see. Hmm, I actually want the arrow to be of type "has".
In UML, such relationships are expressed using classes. Since every instance of a class will "have" the same contents, there's no point in expressing that in object diagrams.
I want to create a software structure survey, and I have an object "server" having 3 members (=attributes) of class "Connection". Each connection calls its own callstack to different connected objects. I need the has-relationship arrow to illustrate such scenario. This is for the docs to show via UML how the main software concept is built.