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 12:14 Go to next message
Martin Heinrich is currently offline Martin Heinrich
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 14:32 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 768
Registered: July 2009
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 17:09 Go to previous messageGo to next message
Martin Heinrich is currently offline Martin Heinrich
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 09:38 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille Letavernier
Messages: 439
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
Re: unidirection Association in class Diagramm [message #1160569 is a reply to message #1157817] Tue, 29 October 2013 03:57 Go to previous messageGo to next message
Martin Heinrich is currently offline Martin Heinrich
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 04:13 Go to previous message
Camille Letavernier is currently offline Camille Letavernier
Messages: 439
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
Previous Topic:Means to filter out associations from the model explorer
Next Topic:Changing grid spacing
Goto Forum:
  


Current Time: Fri Aug 22 04:01:07 EDT 2014

Powered by FUDForum. Page generated in 0.04050 seconds