What's the difference between the CategorySection-Category relationship and the CategorySection-Categorization relationship?
CategorySection-Category has an
arrowhead and a black dot.
CategorySection-Categorization has
an arrowhead on both ends.
Both are supposed to be "has many" relationships but this diagram uses a different symbol to represent these two relationships.
It depends on tyhe notation you are using but typically:
the crowsfoot (arrow) indicates many
the black dot indicates required
the white dot indicates optional
Note that just because a diagram is drawn doesn't makes the relationships it shows sensible, or even possible.
Crowfeet on both ends indicate a many-to-many relationship.
One Category can have many
CategorySections, but one CategorySection can belong to one Category.
One Categorization can have many Categories, but one Category can belong to only one Categorization.
A Categorization can have many CategorySections and a CategorySection can belong to many Categorizations.
I think it tells someting like you can create many different categorizations that define different categories but categorysections can be shared among the different categories (and categorizations).
Related
How do you translate this ER relation to UML:
This is my attempt:
Is this the correct way of doing it? I feel a bit lost.
In an ERD diagram with Chen’s notation:
the rectangles are entities, which in UML would be translated into classes;
the diamonds are relations between entities, which in UML would translate to associations;
(the elipses are attributed, which in UML would be represented either as properties or as association with another class);
the cardinalities would translate to multiplicities that you would show on the end of an association.
So in UML you’d have a book, and a reflexive association line labeled “sequel” and with a 1 near both ends. Much simpler that what you showed.
For more explanations about the mapping and the subtle differences, as well as transforming the one into the other, you may have a look at this other SO answer.
Finally, I am not sure that your 1:1 relation in Chen’s ERD notation is completely equivalent to your tabular notation: the association table that you use corresponds to a many to many association (since the same book can appear in several “records”). Additional code would be needed to retrict its use to 1:1. But btw I’m not sure that the sequel association would be a one to one either (i.e one book has only one other book as sequel and vice versa).
I'm taking the Stanford edx course (Databases: Modeling and theory) and the lecturer mentioned this piece of information about association classes and what they imply in a diagram (in reference to an example of two classes "student" and "college" associated by a "applies to" association with the association class "appInfo" containing college application info):
Now what we're saying is that association is going to have affiliated with it a date and a decision. What we cannot describe in UML is the possibility of having more than one relationship or association between the same student and the same college.
So when we have an association, that assumes at most one relationship between two objects. So, for example, if we wanted to add the possibility that students could apply to the same college multiple times so maybe, you know, they wanted to apply for different majors, that would actually have to be captured quite differently. We'd have to add a separate class for the application information with separate relationships to the students and colleges.
but I didn't really get what she meant here, does having an association class create an automatic 1-1 coupling between two classes? or is it prohibited for two classes to have more than one relationship? or what exactly is being said here because it's a bit vague and I'm not experienced in UML data modeling.
The statement is either wrong or it’s taken out of a specific context that was not mentioned here. The reasons are:
there is no implicit one-to-one in an association; the multiplicities at both end of an association specifies if it’s a one to one, a one to many, a many to many association or anything in between.
the same applies to an association class, which is both: an association and a class at the same time.
in a many to many association, there can very well be several times a link between the same objects. In fact, in a one-to-many or many-to-many association, you need to add an explicit constraint if you want to avoid this.
More information:
in this other answer, there are some more explanation about the semantic of association classes
an here a question related to uniqueness. as you will see, it is not that obvious to avoid multiple occurrences
I'm taking a course that is going over UML diagrams. I have been assigned to change an ER diagram to a UML diagram. For the most part, I am getting the hang of it, but I have encountered two problems that are confusing to me:
How to represent an attribute of a relationship. Here is an example of what I mean.
I do not know where I would add the "Hours attribute", as in under the Employee or Project class.
Representing two difference relationships between a set of two entities. Sort of like this:
Can I have two associations connecting the classes similar to the image I showed above?
1) use an association class. It looks like a dashed line connecting a class containing an attribute to an association.
2) you can do these associations exactly the same way in UML. However, I would use one association with verb phrases as the association-end property names.
I have several use cases I have to represent in a UML class diagram. Apparently repeating classes is not encouraged, and several of my use cases reuse the same classes. I've one particular use case that reuses several classes I have already drawn up, without any unique new classes: does that mean I can leave that particular use case out?
Thank you.
Any diagram you create from a UML is an aspect of the whole model. To transport the whole picture you take many pictures from several aspects. Choosing the right number is an art as well as designing the model. A single diagram will in almost all cases not fit. So break them down and create e.g. a single or multiple diagrams per use case (one to highligh requirements, one for the actions, another one for the classes collaborating).
Further it is advisable to create a collaboration that realizes a use cases which holds and separates the realization of the requirements/descriptive part of a use case.
The core difficulty you have stems from an unclear understanding of the UML constructs and their interdependence.
A use case describes an interaction between an actor of the system to achieve a specific purpose. A class is a collection of system data and functions. Of course, different use cases make use of the same classes. Imagine a shop system. The class Product describing the products offered by the shop will be used by use cases like Show all products of a specific category, Show product details for a specific product, Order product, Generate bill for delivered product.
Fortunately, this repeated use of a class won't clutter your diagrams. In a use case diagram, you don't describe classes, and in a class diagram, you don't describe use cases.
A good approach comes from two directions. Use the input coming from your users to describe use cases: situations when they want to use the application, and the behavior they expect from it. Use your domain knowledge to describe data structures and operations to support these use cases, and describe these in a class model.
I have a problem with my UML diagram and I'll be happy if you help me. I have relationships like
Object A (1)<>----(0..*) Object B
Object B (1)<>----(0..*) Object A
and I'd like to unite them. How can I do it? Thanks a lot.
Can you please define the term "unite them"? What exactly would you like to achive? An example could probably help.
Meanwhile, I can try to guess and give you two possible solutions. Maybe they help you to rephrase your question or even to find the solution:
In the Solution 1, I've just made a single relationship that describes both of yours. This can be used if there is only a single and clear criterion of the linkage between the objects. A typical n..m relationship. Objects A will each hold a collection of related objects B and vice versa.
For example a Person (A on the diagram) can join several Clubs (B) and a Club can have several members - there is only one logical relation behind this situation - membership.
Solution 2 is where there are actually 2 different ways to relate between those elements, each one 1..n. So, A holds a collection of Bs and B holds collection of As, but they are unrelated.
Extending the same example - a Person (A) can join only 1 Club (B) and a Club can have many members and hold their reference (col_a on the diagram). In the same time, a Club can have only 1 owner, and a Person can own several Clubs (col_b). Here we have two different logical relations - membership and ownership.
Of course, other multiplicities and navigabilities are possible, this is just an example to give you an idea.
Does one of these situations sound like yours?
UPDATE (after the 1st comment):
So, here is the updated solution 1:
This is an aggregation used here, and this is more a Group-member relationship. It suits perfectly the description of my first solution up there. Members (B) can be "shared" between the Groups (A) and Gruop does not have any special control over their lifetime.
The real Whole-part relationship would employ composition instead of aggregation (visually depicted with a black diamond, instead of a white one). Its semantics it that Whole object has a full control over the life of the contained objects (parts). In consequence, the Parts cannot be shared between several Wholes and must be destroyed if the Whole itself is destroyed.
Now you just need to find out which situation describes your problem the best, pick-up on of this solutions and eventually fine tune the multiplicities.
Here is a way you could represent this scenario in UML.
One server can contain 0 or many Functions (ie. aggregate relationship).
Each function must belong to one server. Or if it is a distributed function then it can belong to many servers.