We again consider the simple data management problem that we have considered before. So, again, the purpose of our app is to manage information about books. But now we have four additional enumeration attributes, as shown in the UML class diagram in Figure 6.5 below:
the single-valued mandatory attribute
originalLanguage
with the enumeration datatype
LanguageEL
as its range,
the multi-valued optional attribute
otherAvailableLanguages
with range
LanguageEL
,
the single-valued mandatory attribute category
with range BookCategoryEL
the multi-valued mandatory attribute
publicationForms
with range
PublicationFormEL
Notice that the attributes otherAvailableLanguages
and
publicationForms
are multivalued, as indicated by their multiplicity
expressions [*] and [1..*]. This means that the possible values of these
attributes are sets of enumeration literals, such as the set {ePub, PDF},
which can be represented in JavaScript as a corresponding array list of
enumeration literals, [PublicationFormEL.EPUB,
PublicationFormEL.PDF]
.
The meaning of the design model and its enumeration attributes can be illustrated by a sample data population:
Table 6.2. Sample data for Book
ISBN | Title | Original language | Other languages | Category | Publication forms |
---|---|---|---|---|---|
0553345842 | The Mind's I | English (en) | de, es, fr | novel | paperback, ePub, PDF |
1463794762 | The Critique of Pure Reason | German (de) | de, es, fr, pt, ru | other | paperback, PDF |
1928565379 | The Critique of Practical Reason | German (de) | de, es, fr, pt, ru | other | paperback |
0465030793 | I Am A Strange Loop | English (en) | es | textbook | hardcover, ePub |