2005 Spring CS157A Assignment 2

2005 Spring
Prof. Sin-Min Lee
CS157A Assignment 2
Due: Feb. 22, 2005 Tuesday
Sun
Mon
13
7
14
20
21
27
28
6
Tue
Wed
Thu
Fri
Sat
1
8
15
22
2
9
16
23
3
10
17
24
4
11
18
25
5
12
19
26
Readings:
Enhanced ER Diagrams
1 Specialization and Classes



ER diagrams consider entity types to be primitive objects
EER diagrams allow refinements within the structures of entity types
Specialization: top-down refinement into (super)classes and subclasses



Generalization groups entity types; bottom up synthesis
Subclasses inherit the attributes and relationships of their superclasses
EER diagrams don’t specify methods
2 Disjointness Constraints
Disjoint (d)
The subclasses must have disjoint sets of entities
Overlap (o)
The subclasses may have overlapping sets of entities
3 Completeness Constraints
Partial
An entity may not belong to any of the subclasses (single-line)
Total
Every entity in the superclass must be a member of some subclass (double-edge)
Note: disjointness and completeness constraints are independent.
4 Membership Constraints
Predicate defined subclasses
The subclass is defined through a predicate on the attributes of the superclass
Attribute defined subclasses
The subclasses in the specialization are all defined by the same attribute of the superclass
User defined subclasses
Membership in the subclasses is determined at the insertion operation level
5 Reasons for Specialization

Attributes only partially applying to superclasses

Relationship types only partially applicable to the superclass
6 Structures in Specialization
Multiple Specializations
Specialization Hierarchy
Each subclass belongs to at most one class
Lattice Specializations
A subclass may belong to more than one class
7 Categories



Associate more than one superclass to a subclass.
In categories, different entries of the subclass may inherit attributes from different
superclsses
In specializations, all the subclasses inherit all the attributes of the superclass
8 Example
Objective: The goal of this assignment is to provide you with some basic experience in database
design, and to introduce you to Enhanced Entity Relationship diagrams as a modeling tool.
1) to learn the basic Enhanced Entity Relationship (E-R) diagram components: subclass,
superclasses, generalization and specialization.
2) to develop data modeling skills,
3) to be able to interpret E-R diagrams as database blueprints
Develope an Enhanced ER diagram of a library database that you had developed in
Assignment 1. . Show your entities (there should be 5-7 of them) and relationships and at
least two or three attributes per entity. Indicate minimum and maximum numbers of items
for both sides of each relationship.
Investigate the following example before you do your
design
EER schemas can be expressed in a diagrammatic form called EER Diagram.
Entity-sets, relationship-sets, and attributes are represented graphically by
rectangles, diamonds, and ellipses, respectively. Every vertex is labeled by the
name of the object-set or attribute it represents; entity and relationship vertices
must be uniquely identified by their labels globally, while attribute vertices must
be uniquely identified by their labels only locally, with respect to their object-set.
Edges in an EER diagram are directed and represent the interaction of the
various object-sets and attributes. Thus, there are edges:
1. directed from vertices representing entity-sets or relationship-sets to vertices
representing attributes;
2. directed from vertices representing relationship-sets to vertices representing
entity-sets or other relationship-sets;
3. directed from vertices representing weak entity-sets to vertices representing other
entity-sets, labeled ID;
4. directed from vertices representing entity-sets to vertices representing other
entity-sets, labeled HAS or ALWAYS_HAS;
Figure 1: An Extended Entity-Relationship Diagram Example
5. directed from vertices representing specialization entity-sets to vertices
representing generic entity-sets, labeled ISA.
If entity-set E has an association-cardinality of one (respectively many) with
respect to relationship-set R, then the edge connecting the vertices representing
E
and R is associated with label 1 (respectively M). Mandatory involvement of
entity-sets in relationship-sets is represented graphically in an EER diagram by
double-line edges instead of the regular edges representing the non-mandatory
(optional) involvements.
Figure 1 contains an example of an EER diagram consisting of the following main
elements: PERSON, AUTHOR, PROJECT, REFERENCE, PUBLICATION, and SPONSOR
are entity-sets, relationship-set AUTHORED represents the association of authors
with references, relationship-set ASSIGNED represents the assignment of projects
to persons, HAS represents the project-sub-project relation, and SPONSORS
represents the sponsoring of projects. PERSON represents a generalization of
entity-set AUTHOR. The association cardinalities of relationship-set ASSIGNED
represent the restriction of a project being assigned to at most one person.
Identify the primary key for all the entities. Check whether they are special types
of attributes such as multi-valued, derived, composite etc.
Identify the relationship between entities and the cardinality constraints
(1:1/1:N/M:N) on these realtionships. You must list all the possible relationships
between entities and also remember that between any two entities there can be
only one relationship.
Identify the subclasses for your entities (if any). List the subclasses and show
their relationship with the superclasses. Identify the type of constraints on these
relationships (disjoint/nondisjoint/overlap, partial/total).
Use proper symbol for your entities, attributes and relationships and construct an
enchanced ER diagram. Use any avaliable graphics program to draw the EER
diagram instead of drawing it by hand (PowerPoint / Visio, etc). This will allow
you to modify the EER diagram later on if any change need to be made.
Clearly state all assumptions that you made in coming up with the EER diagram.
Turn in the following:


You have to provide (Part 1) the EER diagrams, (Part 2) an English description of each
entity and each attribute involved
The Enhanced ER Diagram for your database design. You may want to use a drawing
package to do your drawing. One such package is Visio. Another way is to use Power
Point. We have provided a Powerpoint slide showing how to use it to create ER
diagrams. Explore how its work.
Submit your assignment electronically to:
[email protected]