The purpose of the app to be built is managing information about countries.
The app deals with just one object type:
Country, as depicted in the diagram
below. In the subsequent parts of the tutorial, you will extend this simple app by adding
enumeration-valued attributes, as well as further model classes and the associations between
In this model, the following constraints have been expressed:
Due to the fact that the
name attribute is declared to be the standard identifier of
Country, it is mandatory and unique.
name attribute has a string length constraint requiring its values to have at least 3 and
at most 50 characters.
population attribute is mandatory, as indicated by the multiplicity expression  appended
to the attribute name.
lifeExpectancy attribute is also mandatory and has an interval constraint: its values must be less than or
equal to 100.
Notice that the
attribute is not mandatory, but optional, as indicated by its
multiplicity expression [0..1].
In addition to the constraints described in this
list, there are the implicit range constraints defined by assigning the datatypes
militaryExpenditure (hint: a percentage value is a
constraints are encoded in the model class within property-specific check functions.
You can use the following sample data for testing your app:
Table 7.2. Sample country data
|Name||Population||Life expectancy||Military expend. (% GDP)|
More data about countries can be found in the CIA World Factbook.