1

I have three questions on directed association link inside a class diagram. here is a screenshot of what i did. i am using modelio.

Description of screenshot: The screenshot shows a class "Dress" linked by a directed association link to an enumeration named "TypeOfClothes".

  • On the arrowhead side (near the enumeration) there is a multiplicity of 1 and public attribute named "TypeOfDress" is specified
  • On the non arrowhead part of the association there is a multiplicity of *
  • Under the class Dress, the public attribute "typeOfDress" of type "TypeOfClothes" is also specified

enter image description here

here are my questions:

1: When two class or a class and an enumeration are linked together with a directed association link like here what does the multiplicity under the none arrowhead part of the association means ?

2: From what I understand, the attribute above the association means the same thing as the attribute under the class typeOfDress. however there is no attribute created in the model when given only with association. Am i wrong somewhere ?

3: If I had an attribute given on the none arrowhead side of the association what would that means ?

I hope it's understandable, if not, please tell me what I can improve :) Thank you for your help and have a nice day!

bruno
  • 32,421
  • 7
  • 25
  • 37
Mygntay
  • 45
  • 5
  • UML does not generate anything. Only certain tools do that. Also please do not ask multiple questions in one SO question. There are answers for 1 and 3 already. – qwerty_so Apr 03 '21 at 18:57
  • I’m voting to close this question because 2) needs clarity about the used tool and 1) / 3) already have good answers here. – qwerty_so Apr 03 '21 at 18:58
  • I've been looking through the internet for while looking for answers both on SysML or UML as they have both comon descriptions). I even tried to look at OMG's specifications (https://www.omg.org/spec/UML/2.5/PDF/). I must say that the example of multiplicity at both end of an association link seems to be rarely addressed. tho I'm sure that I am not the only one that had that question before I'm trying to understand UML and being the most rigorous as I can using it (generating something with it is not in my interest) – Mygntay Apr 03 '21 at 20:54
  • About the fact that I asked multiple questions, I do agree that it might not be correct. Please excuse me. I'm new to asking questions in stackoverflow and I'll make sure to open multiple questions next time :) . If the second point require clarity, would you please tell me how I can improve my question ? I hope that you don't get me wrong here, I realy try to both understand my miss behavior and address your points so I can improve in the future. – Mygntay Apr 03 '21 at 20:57
  • Finaly i'd love to have the links two answers of my 1st and 3rd questions you found elsewhere. That would realy help me to understand :) – Mygntay Apr 03 '21 at 21:13
  • Yes, I see that you're new here :-) Just try to get "educated" in asking questions... Regarding 2) you need to specify the tool you use since this is a tooling thing, not UML. Will see about the other links. – qwerty_so Apr 03 '21 at 21:19
  • https://stackoverflow.com/questions/43012322/what-is-navigability-in-uml-diagrams https://stackoverflow.com/questions/17725223/how-to-really-write-uml-cardinalities – qwerty_so Apr 03 '21 at 21:20
  • Thank you very much! I must say that those links might be more useful than I thought :D. From what I understand now, multiplicity and navigability are two diferent things even tho they are represented in the same called "association" link. Multiplicity always have the same "meaning" in associations (directed or not): "A "has" x B" & "B "has" y A". Navigability only specify wich class "know" about the other. would you please confirm that: "If I replace the * by 2 in the screenshot, that would mean that "exactly two Dress can have that relation" therefore limiting the number of dress to two"? – Mygntay Apr 03 '21 at 21:51
  • 1
    thank you for your feedback about my questions I'll make sure to be more explicit next time! :) – Mygntay Apr 03 '21 at 21:54

1 Answers1

1

1: When two class or a class and an enumeration are linked together with a directed association link like here what does the multiplicity under the none arrowhead part of the association means ?

the fact the relation is not navigable from TypeOfClothes to Dress does not imply it is not possible to have a restriction on the number of instances of Dress associated to TypeOfClothes. So the multiplicity is given and being here * that means any number from 0.

2: From what I understand, the attribute above the association means the same thing as the attribute under the class typeOfDress. however there is no attribute created in the model when given only with association. Am i wrong somewhere ?

it is legal to show both an association and an attribute having the same name in the class diagram, even this is redundant and only one of them is enough. From the standard formal/2017-12-05 page 206 :

Figure 11.31 shows that the attribute notation can be used for an Association end owned by a Class, because an Association end owned by a Class is also an attribute. Although it would typically be suppressed on grounds of redundancy, this notation may be used in conjunction with the association notation to make it perfectly clear that the attribute is also an Association end.

An attribute is an owned property, so if your class own the property you have the attribute even you do not mention it in the attribute compartment

3: If I had an attribute given on the none arrowhead side of the association what would that means ?

the relation is not navigable in that direction, so if you add a name near * it is just informative, it is not a property of TypeOfClothes, so better to not have it


Out of that typeOfDress is public because of the +, are you sure you want that ?

bruno
  • 32,421
  • 7
  • 25
  • 37
  • Thank you for your answer. i think I had an issue on the deffinition of "navigable". If I understood correctly, can I explain thes relation like so?: -Each dress allways have one TypeOfClothes atribute named typeOfDress -up to an infinity of Dress can have that relation – Mygntay Apr 03 '21 at 17:43
  • @Mygntay I just edited my answer for (3), I first do not understand well you question. Yes each dress has 1 and only 1 attribute of type TypeOfClothes, but the enumeration does not know the dress(es) referring to it – bruno Apr 03 '21 at 17:45
  • @Mygntay `up to an infinity of Dress can have that relation` yes, any number of dress – bruno Apr 03 '21 at 18:01
  • About the fact that typeOfDress is public, I must say that this is probably not what I want. I am actually thinking that as "I don't know yet" so I'd be better keeping it like so. That is probably not the way I shoud be doing ? thanks for edit on (3) and (1) it is more clear to me! last question to be sure I understood it properly, If I replace the * by 2 for example would that mean that "exactly two Dress can have that relation" therefore limiting the number of dress to two? – Mygntay Apr 03 '21 at 20:38
  • Answer 2 is incorrect. An association-end property can be owned by either the association or the class. When it is owned by the class, the property is both a class attribute and an association end, so having two attributes with the same name is illegal. – Jim L. Apr 04 '21 at 17:16
  • @JimL. There are not two attributes of the same name. The standard explicitly allows to show the attribute in the compartment of the class and draw the relation, I edited my answer to add the reference to the standard – bruno Apr 04 '21 at 17:35
  • I recommend saying "it is legal to *show* a property both as an association end and as an attribute" instead of "it is legal to *have* both the association and the attribute". – Jim L. Apr 04 '21 at 19:14
  • The OP may still believe that "the attribute above the association means the same thing as the attribute under the class typeOfDress". You should explain that the property shown above the association might not be the same as the property shown in the class' compartment. Both the Class *and* the Association could each own a separate property in a different name space! – Jim L. Apr 04 '21 at 19:24
  • Also this is not quite right: "the relation is not navigable in that direction". An association always has two end properties, even when a property is unnamed and unnavigable. If we transform an association into a reified class or database table, both ends would be present. The spec says, "Navigability means that instances participating in links at runtime (instances of an Association) can be accessed efficiently from instances at the other ends of the Association." – Jim L. Apr 04 '21 at 19:41