second is to name the attribute in terms of the role it plays in
the entity type. Either of these might appear more natural
in particular circumstances. The second approach is taken in
Figure 2-6.
In order to save space in diagrams, EXPRESS-G allows the
base type or defined type symbol for an attribute to be omitted
(the case where just the “lollipop” is shown). However, even this
form can lead to cluttered and potentially
confusing diagrams. Therefore, I sometimes
use the third option shown: This is not stan-
dard EXPRESS-G, but it borrows from
IDEF1X and other entity-relationship nota-
tions in that it lists the attributes by name
within the box that represents the entity
data type.
2.5.3 Reading Relationships and
Cardinalities
I will now take a closer look at reading
relationship types and the meaning of the
various symbols around them.
Figure 2-7 illustrates the default and
explicit specification of the cardinality of a
relationship and Figure 2-8 shows the
default cardinality for the inverse of a rela-
tionship. The relationship type between
two entity types can be read in either
direction as shown in Figure 2-9 and
Figure 2-10.
This is often as much as is required for
business use; however, the diagrams do say
more about the number of entities
(instances) at one end of a relationship
type that may or must be involved with an
instance at the other end. This is referred
to as the cardinality of a relationship type.
The representation of some different
options is explained in Figures 2-11 and
2-12.
Optional relationship types are drawn
with a dashed line as shown in Figure 2-13.
Optional relationship types are read as
illustrated in Figure 2-14.
person
• Each person has a name that is a STRING.
name
STRING
Figure 2-6 Attributes.
A
• Express-G specifies the cardinality of an attribute
relationship in terms of an aggregation (SET, BAG,
ARRAY, LIST
.
role
B
A
role S[1:?]
exactly one B for each A
one or many B for each A
B
Figure 2-7 Cardinalities.
A
• Every relationship has an inverse.
• Default is that the inverse relationship is not named,
and that the cardinality is zero, one, or many.
• Naming the inverse allows this to be constrained.
role
B
exactly one B for each A
default inverse:
zero, one or many A
for each B
Figure 2-8 Default inverse relationships.
Chapter 2 ENTITY RELATIONSHIP MODEL BASICS 15