Attribute link with association class?

0 votes
asked Oct 19, 2018 in Question / help by PaulRein

Hi!

As per the answer to the question about links to class members, you can use 

Foo::field1 --> Bar::field3 : foo

to make associations between fields of a class. This works great. However, I now had reason to want an association-class with such a link (I might be abusing UML/PlantUML now)  but the documented way with parenthesis does not work with such links.

As a minimal non-working example I modified the association class example from the documentation:

@startuml
class Student {
  Name
}
Student::Name "0..*" - "1..*" Course
(Student::Name, Course) .. Enrollment

class Enrollment {
  drop()
  cancel()
}
@enduml

The link itself works as expected (if I comment out the next line) but the attempt at an association class is a syntax error. I tried to put quotes around the offending part but that did not help.

(Note that I am fully aware that, in this example, it makes no semantic sense to want a link between a Student::Name and a Course. As I said, I just tweaked the example from the manual as a minimal demonstration of the issue)

Can this be made to work ?

commented Oct 24, 2018 by mgrol (2,800 points)
Hi,
I know you asked to link  Student::Name and Course. If you remove the ::Name and link classes Student and Course, this would work.
Please see here:
http://www.plantuml.com/plantuml/uml/DSuz3i8m30NWtQTuojGYY63jL0cnid22AF7c92W_4yhT2SZTdZzPzjjhSwNrAEJ5rOfNwu5JmuU0fujCWvIsxJV3NAqz6LnWRlzmpxrKfaMtpWehhCKZbImI9vEUFqG_X9BVoqg0Tycpp3XevnHcdoy0

BR,
Michael
commented Nov 29, 2018 by mgrol (2,800 points)
Hi,

did this help even if this was not exactly the answer you where asking for? I would be appreciated if you could give a short feedback. Thank you in advance.
BR,
Michael

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...