Study Cards on attribute, multiplicity, editor

How do we read the Multivalued attribute?
We say that the author attribute is MULTIVALUED because the upper-bound is more than one.

When we read the attribute with the multiplicity, we can say, “There are ONE OR MORE authors” or “There is at least one author.”



When there is a lower-bound and an upper-bound for a multiplicity,

it is a requirement that Lower-bound ≤ upper-bound
Report
Why do we use a 0 in this figure?
Examine Fig. 10.3. We again depict the Book Class. This time, we allow there to be zero authors.

In the previous figure, we might have assumed that we would use “Anonymous” as the author of a book without authors.

More likely, the display software would automatically know that an empty author name should be displayed/printed as Anonymous.
Report


    Now examine Fig. 10.4.
    This figure is equivalent to the previous Fig. 10.3.

What does only the  *  means?
Using [*] alone in the multiplicity field is equal to using [0..*], allowing us to elide the “0” lower-bound.
Report
What could be a other format for : pages : Integer {>1}  ?

In Fig. 10.6, we restored the default format of Fig. 10.5.

We also added the constraint on the number of pages as discussed above.

In Chapter 6, Objects and Classes, we showed several alternative forms for indicating the constraint.

Another approach would be

pages :Integer {in 1..*}
Report
Remember that constraints are surrounded by ?

while multiplicity is surrounded by ?

In this constraint, we also use the ? that indicates a UML range.
Remember that constraints are surrounded by {}

while multiplicity is surrounded by [].

In this constraint, we also use the “..” that indicates a UML range.
Report
What can we say about the editor attribute?
We also added another attribute, editor.

This attribute also has the type of Person.

The multiplicity is shown as [0..1], indicating that the field is either there or not.

Some books do not have an editor.

We can say, “The editor attribute is optional” or “The Book MAY have an editor.” “May” is used to indicate that the lower bound is 0.
Report
  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart