CS 325 - Week 6 Lecture 2 - 2016-09-29
* more discussion of concepts from Reading Packet 5 -
Entity-Relationship Modeling, part 2
* NOTE: there are example E-R diagrams in the
reading packet -- SOME related to examples
drawn on the white board during lecture... 8-)
* recursive relationships
* a relationship line that begins and ends at
the same entity class rectangle
* weak entities/weak entity classes --
these are EXTRA-dependent on the existence of another entity
class; they may even derive their identity from
an instance of another entity class;
* be careful not to over-think these;
* often these are indicated in an ERD with a
different entity rectangle --
we'll go with a double-line entity class rectangle
* and don't be surprised if these don't happen
to have any identifying attributes in their
entity-attribute lists
* SUPERTYPES and SUBTYPES
* these model "is-a" relationships...
one entity class instance IS also an instance of another entity
class;
An Account instance may also be a Savings-Account instance;
another Account instance may also be a Checking-Account instance;
* Account, above, is an example of a supertype entity class,
and Savings-Account and Checking-Account are examples
of subtype entity classes;
* several ways to tell, as you are modeling,
if there are some of these lurking, struggling to
reveal themselves:
* when an entity class has DISTINCT subsets of
seemingly-"optional" attributes
...these may be for subtype entity classes of
that now-supertype entity class;
* if several entity classes seem to share significant
common attributes -
...there may be a common superclass
entity class for these;
* another indication is relationships --
if you notice you have multiple relationship
lines that really "feel" like the same relationship --
...that MAY mean there's a supertype entity class
that should be related to instead
OR -- when you are looking an entity class,
and realize there's a relationship that's
really important -- but just for a certain
class of instances of that entity class;
...that might indicate that's a subtype
entity class
* sort of 3 categories of these:
overlapping subtypes of a supertype,
disjoint subtypes of a supertype,
and so-called "union" supertype of subtypes
* overlapping: when a supertype instance can possibly
also be an instance of MORE THAN ONE of the
subtypes
* put an "o" in the relationship circle
* disjoint: when a supertype instance can also at MOST be
an instance of ONE of the subtypes
* put a "d" in the relationship circle
* union: when the supertype entity classes are actually
pretty distinct, but they nevertheless share a
relationship
* put a "u" in the relationship circle
* see examples of these,
and how to depict them in an E-R diagram,
in Reading Packet 5!