Top Banner
Data Modeling Advanced Concepts
19

Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Data Modeling

Advanced Concepts

Page 2: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Common Modeling Situations

Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities Associative or Intersection Entities Supertypes and Subtypes

Page 3: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Degree of Relationship

Degree Number of entity types that participate in a

relationship Three cases

Unary A relationship between two instances of one entity type

Binary A relationship between the instances of two entity types

Ternary A simultaneous relationship among the instances of three

entity types Not the same as three binary relationships

Page 4: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Figure 10-6Example relationships of different degrees

Page 5: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Which type of relationship is this?

Customers(Parent)

cust_id cust_name

100 Slick Willy, Inc.

200 George_W, Co.

300 Gore, Ltd.…

ord no cust_id ord_date

2100 200 13-Sep-2000

2101 100 14-Nov-20002102 100 23-Dec-20002103 100 24-Dec-2000…

Orders(Child)

A customer places many orders. An order is placed by only one customer.“An instance of the entity customer is related to one or many instances of orders. An instance of order is related to only one instance of customer.”

Page 6: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Which type of relationship is this?

Are these the same statements?A CD appears on several orders.An order may have many CDS on it.

Page 7: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Entity-Relationship (E-R) ModelingKey Terms

Attributive or Weak Entity An entity than cannot exist without the existence of

another entity. Examples. What would be a weak entity for

A DePaul Course? An employee? A product?

Associative entity An entity type that associates the instances of one or

more entity types and contains attributes that are peculiar to the relationship between those entity instances

Page 8: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Multivalued Attributes

How do we model the situation where an entity has an attribute describing it, but The attribute may take on more than one value

for each entity instance The multivalued attribute can be represented

on an E-R Diagram in two ways: double-lined ellipse weak entity

Page 9: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Depicting Multivalued Attributes

See pages 316-317.Which way is better?

What should the identifier of

DEPENDENT be?

Page 10: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Depicting Associative Entities

See pages 323-324.Which way is better?

What should the identifier of

CERTIFICATE be?

Page 11: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Depicting M:M relationships

1. Create an intersection entity

(line item).

3. The “1” side goes

on the original

entities.

2. Move the “M’s” are adjacent to

the intersection entity.

Page 12: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Supertypes and Subtypes

A supertype is a generic entity type that has a relationship with one or more subtypes.

A subtype is a subgrouping of the entities in an entity type that is meaningful to the organization and that shares common attributes or relationships distinct from other subgroupings.

Examples Customers and Preferred Customers Students, graduate, PhD, undergraduate, full-time,

part-time Why bother?

Page 13: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Supertype/Subtype Rules

Specialization Does the instance of the supertype have to

be a member of a subtype? If yes, Total Specialization (double line) If no, Partial Specialization (single line)

It says supertypes are allowed not to belong to a subtype.

Examples—which rule of specialization applies? Customers and Preferred Customers Students, graduate, PhD, undergraduate, full-

time, part-time

Page 14: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Supertype/Subtype Rules

Disjoint/Overlap

Can an instance of the supertype be a member of more than one subtype? If yes, Overlap (letter “o”) If no, Disjoint (letter “d”)

Examples—which rule of specialization applies? Friends, countrymen, Romans Students, graduate, PhD, undergraduate, full-

time, part-time

Page 15: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Supertype/Subtype Example

Page 326.Is this diagram

correct?

What about the

“Is assigned” relationship?

Page 16: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Another example.

Page 327.Does the model

allow for:

Student Employees?

Staff members teaching?

Simultaneous Grad/undergrad

students?

A “non-employee/alumnus/student” PERSON?

Page 17: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Business Rules

Entity integrity Each entity instance has a unique identifier. The identifier value cannot be empty.

Referential integrity The value or existence of an attribute in one

relation depends on the value or existence of the same attribute occurring in another relation

More on this in IS422 Domains Triggering operations

Page 18: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Domains

The set of all data types and ranges of values that an attribute can assume

Several advantages1. Verify that the values for an attribute are

valid2. Ensure that various data manipulation

operations are logical3. Help conserve effort in describing attribute

characteristics

Page 19: Data Modeling Advanced Concepts. Common Modeling Situations Unary relationships Binary relationships Ternary relationships Attributive or Weak Entities.

Triggering Operations An assertion or rule that governs the validity of data manipulation

operations such as insert, update and delete Includes the following components:

User rule Statement of the business rule to be enforced by the trigger

Event Data manipulation operation that initiates the operation

Entity Name Name of entity being accessed or modified

Condition Condition that causes the operation to be triggered

Action Action taken when the operation is triggered

Where would you say the responsibility for data integrity lies—in the application programs or the database management system?