If you want to make money online : Register now

[Solved]: A relationship in a UML class diagram

, , No Comments
Problem Detail: 

I am investigating a small database in a paper: enter image description here

Each line is a selling record. For instance, Line 2 expresses that Store 100 in Week 383 sold Product 653; for this selling, the move was 16 and the price was 2.19, thus the profit was 16*2.19*2=7.01 (the other columns are not very important).

The authors then show a UML class diagram as follows: enter image description here

What I cannot understand (and is not explained in the paper) is the relationship between OnSaleKey and DetergentKey. Could anyone tell me what it is about in a UML diagram language?

Asked By : SoftTimur

Answered By : Vitalij Zadneprovskij

You can have many sales of the same product in the same store and in the same week. Also, a detergent can be sold in different weeks in different stores.

This means that you have to create a class Sale, that associates an OnSaleKey to a DetergentKey.

The Sale class is an association class.

From here you can find an explanation:

An association may be refined to have its own set of features; that is, features that do not belong to any of the connected classifiers but rather to the association itself. Such an association is called an association class. It is both an association, connecting a set of classifiers and a class, and as such could have features and might be included in other associations.

An association class can be seen as an association that also has class properties, or as a class that also has association properties.

An association class is shown as a class symbol attached to the association path by a dashed line. The association path and the association class symbol represent the same underlying model element, which has a single name. The association name may be placed on the path, in the class symbol, or on both, but they must be the same name.

In this case it is easier to think about the Sale class as a table in a database that associates an id from OnSaleKey to an id from DetergentKey.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/29997

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback