3

I don't understand what the relationship between the two tables in the linked picture mean. And how can I code it?

enter image description here

It's with

virtual public Propriete Proprietes { get; set; }

Gangnus
  • 24,044
  • 16
  • 90
  • 149
Heni
  • 156
  • 3
  • 12
  • 4
    Please, look here [http://stackoverflow.com/questions/1874049/uml-arrows-pointers-explanation](http://stackoverflow.com/questions/1874049/uml-arrows-pointers-explanation). – Franco Oct 27 '15 at 21:31
  • @Franco Look better, please. There is no explanation on what unidirectional arrow means. And the question there asks about all arrows except this one! – Gangnus Oct 28 '15 at 22:10
  • It is funny, but there is no question on such trivial element here. Really, it is almost out of use, according to the contemporary standard, but it can be used, so, it should be explained. +1. – Gangnus Oct 28 '15 at 22:12

2 Answers2

2

The arrow at the end of the Association between the Classes (not tables) indicates that this end is navigable.

This is defined as an operation the Property at the end of the Association. The definition in UML 2.5 specs says:

isNavigable() : Boolean The query isNavigable() indicates whether it is possible to navigate across the property.

body: not classifier->isEmpty() or association.navigableOwnedEnd->includes(self)

Furthermore it says about the Association Notation:

An open arrowhead on the end of an Association indicates the end is navigable. A small x on the end of an Association indicates the end is not navigable.

And about the Navigability on an Association

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. The precise mechanism by which such efficient access is achieved is implementation specific. If an end is not navigable, access from the other ends may or may not be possible, and if it is, it might not be efficient.

And to conclude something to keep in mind because this convention is still often used:

Navigability notation was often used in the past according to an informal convention, whereby non-navigable ends were assumed to be owned by the Association whereas navigable ends were assumed to be owned by the Classifier at the opposite end. This convention is now deprecated. Aggregation type, navigability, and end ownership are separate concepts, each with their own explicit notation. Association ends owned by classes are always navigable, while those owned by associations may be navigable or not.

So now you should know what it means. How to code it depends on the programming language, the company standards, the architectural layer, your creativity, etc..

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
2

Geert writes true things, but I think, you need more practical advice.

That one-directional arrow means, that the Enquette class has a field or method, that are of the class Propriete. In 99% it is a simply field of that type. Contemporary standard offers to use a point on the other side of the line for this.

The fact, that the arrow has no name on it, often means that the name of the field is propriete, or Propriete, according to the style accepted by the language and your company. (it is not required in UML standard, but it is widely used). According to the last paragraph of the question, it seems, your company uses this rule, too.

The fact, that there is no arrow on the other end of the line, does not mean, that there is no field or method in Propriete class that has a class of Enquette. (Though it meant that in 90-ties). It merely means we haven't decided yet if there are such fields or not. Or maybe, we consider it to be not important. I.e. it is undefined. The known lack of such connection must be shown by a cross instead of an arrowhead.

So, somewhere in Enquette you have a line:

Propriete propriete;

or

Propriete* Propriete; //if you are in C++

or even maybe

Propriete** Propriete;

or cited by you

virtual public Propriete Proprietes { get; set; } // apparently, C#

It could be either static/class field or instance field - it is not defined in the diagram.

And in the class Propriete there can exist the line:

Enquete enquete; // or some of the mentioned variants

And you are leaving the decision about its existence to the coder.

Notice, that a line without arrowheads means that really there are fields (or methods) for both ends. Simply we don't draw arrowheads at all if the line should show two of them.

So, really, you have a mistake in the question. It is NOT an unidirectional relationship. It is an unidirectional arrow showing a relationship, that MAY BE unidirectional.

Gangnus
  • 24,044
  • 16
  • 90
  • 149