Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » unidirection Association in class Diagramm(How to create unidirection association in class Diagramm? Default is bidirectional.)
unidirection Association in class Diagramm [message #1155001] Fri, 25 October 2013 16:14 Go to next message
Martin Heinrich is currently offline Martin HeinrichFriend
Messages: 4
Registered: October 2013
Junior Member
When I create an Association between two classes, I get always a bidirectional association, so that there are roles at every class.

But I want to create only an unidirectional association, where one class has an instance of the other, but the other class doesn't have an instance of this class. How can this be achieved?

Best Regards,
Martin
Re: unidirection Association in class Diagramm [message #1155153 is a reply to message #1155001] Fri, 25 October 2013 18:32 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Martin,

The Properies view lets you edit the navigability and other attributes
of the association's ends. So, you can just draw the association and
then make the appropriate end(s) non-navigable.

HTH,

Christian


On 2013-10-25 17:15:44 +0000, Martin Heinrich said:

> When I create an Association between two classes, I get always a
> bidirectional association, so that there are roles at every class.
> But I want to create only an unidirectional association, where one
> class has an instance of the other, but the other class doesn't have an
> instance of this class. How can this be achieved?
>
> Best Regards,
> Martin
Re: unidirection Association in class Diagramm [message #1156806 is a reply to message #1155153] Sat, 26 October 2013 21:09 Go to previous messageGo to next message
Martin Heinrich is currently offline Martin HeinrichFriend
Messages: 4
Registered: October 2013
Junior Member
Hi Christian,

Thanks for your answer.

I've done what you suggested, and as you can see in the picture, there is still a role for both classes (+ class3 and + class4), although both ends are non- navigable.

But actually I want to achieve an association without roles at the end(s). And this does not work with the navigable preference, does it?

Or do I missunderstand something?

Best Regards,
Martin
Re: unidirection Association in class Diagramm [message #1157817 is a reply to message #1156806] Sun, 27 October 2013 13:38 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Martin,


A UML Association needs at least two ends (each end is a Property). If you don't want these properties to belong to the class, you can make them "Owned by Association". If you want a unidirectional association, then maybe the first end should be owned by the Classifier, and the other one by the Association.

And if you really want a single Property, then you can just create a Property in the Classifier A, and type it with Classifier B (But then, this is not an Association anymore).


Regards,
Camille


Camille Letavernier
Re: unidirection Association in class Diagramm [message #1160569 is a reply to message #1157817] Tue, 29 October 2013 07:57 Go to previous messageGo to next message
Martin Heinrich is currently offline Martin HeinrichFriend
Messages: 4
Registered: October 2013
Junior Member
So that means, endings, that belong to the classifier, are a role, while endings belonging to the association, are not a role?
Re: unidirection Association in class Diagramm [message #1160588 is a reply to message #1160569] Tue, 29 October 2013 08:13 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi,


Both are roles. But depending on your code generation and target platform, they may or may not appear in the final product.

In a Database, for examples, some Associations are represented as Tables. The table typically needs the two ends. In a Java Class, associations are represented as Attributes (And sometimes, specific collections to ensure consistency with the opposite end).

My point is that the UML Model is (should be) an abstraction. It will always contain extra information (Useful in some specific cases, useless in other). So, there's no universal answer.

But for the simplest code generator, "owned by association" often means "ignored"; which is, if I understand correctly, what you want.


Regards,
Camille


Camille Letavernier
Previous Topic:Means to filter out associations from the model explorer
Next Topic:Changing grid spacing
Goto Forum:
  


Current Time: Sat Apr 27 03:31:04 GMT 2024

Powered by FUDForum. Page generated in 0.03279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top