Sei sulla pagina 1di 29

CH4.

Relationships
Arcs, Recursive, Hierarchical

Study Objectives
This lesson covers the following objectives:
Define the term "constraint" as it applies to
data modeling
Identify an exclusive OR relationship in a
business scenario
Diagram an arc constraint to represent an
exclusive OR relationship
Distinguish between the use of an arc and a
subtype in the data model

Purpose
Arcs in data modeling help designers
clarify an exclusive OR across
relationships. The more explicitly you can
define the client's requirements, the more
accurate your final implementation will be.

What is a Constraint?
Every business has restrictions on which
attribute values and which relationships
are allowed. These restrictions are called
constraints. They may refer to a single
attribute of an entity, or to relationships
between entities.

What is a Constraint?
We already know about several kinds of
constraints; for example, every
EMPLOYEE must work in one and only
one DEPARTMENT. In this lesson, we will
see another kind of constraintan
exclusive OR constraint.

Exclusive OR Relationship
Mutually exclusive
relationships
(sometimes called
exclusive OR *
relationships) often
exist.

Exclusive OR Relationship
For example: A
billboard is an
advertising space
that can feature a
movie, a product, or
a public
announcement. It
may contain
advertising about
only one of these at a
time.

Exclusive OR Relationship
Each feature has its
own characteristics
or attributes. * In
many programming
languages, exclusive
OR is a logical
operator that returns
a true value if one,
but not both, of its
operands is true.

Exclusive OR Relationship
* In many
programming
languages,
exclusive
OR is a logical
operator that
returns
a true value if one,
but not both, of its
operands is true.

Representing Exclusive OR
Relationships in the ERD
Arcs are a way to represent
mutually exclusive
relationships in the ERD.

The arc represents the


exclusive OR relationship -each EVENT must be held
at one PRIVATE HOME or
must be held at one
PUBLIC SPACE, but not
both.

Arcs
An arc always belongs to one entity.
Arcs can include more than two relationships.
Not all relationships of an entity need to be included
in an arc.
An entity may have several arcs.
An arc should always consist of relationships of the
same optionality
All relationships in an arc must be mandatory or all
must be optional.
Relationships in an arc may be of different
cardinality, although this is rare.

Arcs

Arcs

Arcs
Arcs can sometimes be drawn
as Supertypes or Subtypes.

Arcs
Supertypes and subtypes
can sometimes be drawn
as arcs. The Supertype
PARTNER in the DJ
model is represented as
an arc in this diagram.

Terminology
Key terms used in this lesson included:
Arc
Constraint
Exclusive OR relationship
Mutually exclusive relationship

Summary
In this lesson, you should have learned how
to:
Define the term "constraint" as it applies to
data modeling
Identify an exclusive OR relationship in a
business scenario
Diagram an arc constraint to represent an
exclusive OR relationship
Distinguish between the use of an arc and a
subtype in the data model

CH4. Relationships
Hierarchies and Recursive Relationships

Study Objectives
This lesson covers the following objectives:
Define and give an example of a hierarchical
relationship
Identify the UIDs in a hierarchical model
Define and give an example of a recursive
relationship
Represent a recursive relationship in an ERD
given a scenario
Construct a model using both recursion and
hierarchies to express the same conceptual
meaning

Purpose
Often, roles are organized by hierarchy at
work or in school. Hierarchical data is very
common. Understanding it will help you
model:
Business organizational charts
Building structures
Family trees
and many other hierarchies found in the
real world.

Relationships in an
Organizational Chart
An organizational chart can be
represented by this data model. What are
the UIDs for each entity?

Hierarchical relationship
Hierarchical
relationship: A series
of relationships that
reflect entities
organized into
successive levels.
An organizational chart
can be represented by
this data model. What
are the UIDs for each
entity?

Hierarchical relationship
Hierarchical structures
are more explicit and
are easier for most
people to understand
because they are very
similar to an
organizational chart.

Recursive relationship
Recursive relationship: A
relationship between an
entity and itself. Explain
that the mandatory
attributes specific to an
entity (bonus plan, car
plan, and budget)
become optional in the
recursive model.

Recursive relationship
Recursive relationships
tend to be simpler
because you are using
only one entity. Your
diagram will be less
busy. However, they are
less specific you
cannot have mandatory
attributes or relationships
unless they are
mandatory in all
instances of the entity.

Example
These two models are
not identical. In the
hierarchical model, it is
clear that every
employee except the
president must report to
someone. In the
recursive model, the
fully optional
relationship implies that
it is possible that no
employees report to
someone.

Recursive Relationship
DJs on Demand
Business Scenario
The project manager has
overall responsibility for
an event and manages
the other employees
(event planner, DJ)
working on the event.

Recursive Relationship
Automobile
Manufacturing
Business
For an automobile
manufacturing
organization, consider all
elementary parts,
subassemblies,
assemblies, and products
as instances of an entity
called COMPONENT.

Terminology
Key terms used in this lesson included:
Hierarchal relationship
Recursive relationship

Potrebbero piacerti anche