Presentation is loading. Please wait.

Presentation is loading. Please wait.

Degrees of Data Abstraction

Similar presentations


Presentation on theme: "Degrees of Data Abstraction"— Presentation transcript:

1 Degrees of Data Abstraction
Database designer starts with abstracted view, then adds details ANSI Standards Planning and Requirements Committee (SPARC) Defined a framework for data modeling based on degrees of data abstraction (1970s): External Conceptual Internal Database Systems, 9th Edition

2 The External Model End users’ view of the data environment
ER diagrams represent external views External schema: specific representation of an external view Entities Relationships Processes Constraints Database Systems, 9th Edition

3 Database Systems, 9th Edition

4 The External Model (cont’d.)
Easy to identify specific data required to support each business unit’s operations Facilitates designer’s job by providing feedback about the model’s adequacy Ensures security constraints in database design Simplifies application program development Database Systems, 9th Edition

5 What are entities here ? Relationships? Do you see entity attributes ?
Database Systems, 9th Edition

6 Database Systems, 9th Edition

7 Any examples of the last bullet action?
The Internal Model Representation of the database as “seen” by the DBMS Maps the conceptual model to the DBMS Internal schema depicts a specific representation of an internal model Depends on specific database software Change in DBMS software requires internal model be changed Logical independence: change internal model without affecting conceptual model Any examples of the last bullet action? Database Systems, 9th Edition

8 Database Systems, 9th Edition

9 The Physical Model Operates at lowest level of abstraction
Describes the way data are saved on storage media such as disks or tapes Requires the definition of physical storage and data access methods Relational model aimed at logical level Does not require physical-level details Physical independence: changes in physical model do not affect internal model Database Systems, 9th Edition

10 Database Systems, 9th Edition

11 Summary A data model is an abstraction of a complex real-world data environment Basic data modeling components: Entities Attributes Relationships Constraints Business rules identify and define basic modeling components Database Systems, 9th Edition

12 Summary (cont’d.) Hierarchical model Network data model
Set of one-to-many (1:M) relationships between a parent and its children segments Network data model Uses sets to represent 1:M relationships between record types Relational model Current database implementation standard ER model is a tool for data modeling Complements relational model Database Systems, 9th Edition

13 Summary (cont’d.) Object-oriented data model: object is basic modeling structure Relational model adopted object-oriented extensions: extended relational data model (ERDM) OO data models depicted using UML Data-modeling requirements are a function of different data views and abstraction levels Three abstraction levels: external, conceptual, internal Database Systems, 9th Edition

14 Entity and Attribute-Level Data Integrity Constraints
At the conceptual tier of data modeling, two types of data integrity constraints pertaining to entity types and attributes are specified The domain constraint imposed on an attribute to ensure that its observed value is not outside the defined domain The key (or uniqueness) constraint that requires entities of an entity type to be uniquely identifiable Chapter 2 – Foundation Concepts

15 Exercise Draw data models for the following entities:
Ship: A ship has a name, registration code, gross tonnage, and a year of construction. Ships are classified as cargo or passenger. Car: A car has a manufacturer, range name, and style code (e.g., a Honda Accord DX, where Honda is the manufacturer, Accord is the range, and DX is the style). A car also has an identification code, registration code, and color. Restaurant: A restaurant has an address, seating capacity, phone number, and a style of food. For each data model, identify domain and key constraints. For each of the cases above – specify domain contraint ( mark it with “d”) and key constraints ( mark it with “k”). Type your answers. Chapter 2 – Foundation Concepts

16 More on E-R Modeling Grammar Relationship Type
Conceptualization of association between object types Binary (degree = 2); ternary (degree = 3); n-ary (degree = n); unary [recursive] (degree = 1) Chapter 2 – Foundation Concepts

17 n-ary Relationships Chapter 2 – Foundation Concepts

18 n-ary Relationships (continued)
Example 1. Professor Einstein teaching Physics using Introduction to Physics. Example 2. Professor Einstein teaching Physics using Principles of Physics. Example 3. Professor Einstein teaching Math using Principles of Calculus. Example 4. Professor Chu teaching Math using Introduction to Calculus.

19 n-ary Relationships (continued)
Example 1. Dr. Fields prescribes Advil to treat Sharon Moore for a headache. Example 2. Dr. Fields prescribes Advil to treat Michelle Li for a headache.

20 n-ary Relationships (continued)
Chapter 2 – Foundation Concepts

21 Relationships have Role Names
Chapter 2 – Foundation Concepts

22 Structural Constraints of a Relationship Type
Two structural constraints define a relationship type Cardinality constraint (ratio) specifies the maximum number of instances of an entity type that relate to a single instance of an associated entity type through a binary relationship type (i.e., 1:1, 1:n, n:m = maximum cardinality) Participation constraint is based on whether, in order to exist, an entity of that entity type needs to be related to an entity of the other entity type through a binary relationship type (i.e., total/mandatory or partial/optional = minimum cardinality); total participation = existence dependency Chapter 2 – Foundation Concepts

23 Cardinality Constraint (Ratio)
Chapter 2 – Foundation Concepts

24 Cardinality Constraint (Ratio) (continued)
Chapter 2 – Foundation Concepts

25 Cardinality Constraint (Ratio) (continued)
Chapter 2 – Foundation Concepts

26 Participation Constraint
Chapter 2 – Foundation Concepts

27 Participation Constraint (continued)
Chapter 2 – Foundation Concepts

28 Cardinality Ratio and Participation Constraints

29 Cardinality Ratio and Participation Constraints
(continued)

30 Cardinality Ratio and Participation Constraints
(continued)

31 Cardinality Ratio and Participation Constraints
(continued)

32 Cardinality Ratio and Participation Constraints
(continued) Chapter 2 – Foundation Concepts

33 Something To Think About
Think of each entity type and relationship type as a separate table for right now For example: Vendor VenID VenName Joe Inc Bill Inc Supplies VenID ProdID Cost 2 25 7 1 24 8 1 25 7 Product ProdID ProdName Soup Noodles Chocolate Chapter 2 – Foundation Concepts

34 Base/Strong vs. Weak Entity Types
Chapter 2 – Foundation Concepts

35 Base/Strong vs. Weak Entity Types (continued)
Base (or strong) entity types are those where the entities have independent existence (i.e., each entity is unique) A base entity type has a unique identifier Weak entity types are those where entities have a dependent existence (i.e., duplicate entity instance may be present) A weak entity type does not have a unique identifier A weak entity type has an “identifying relationship” with an identifying parent entity type A weak entity type has a “partial key” – also known as a “discriminator” Chapter 2 – Foundation Concepts

36 Partial Key (Discriminator) Defined
An attribute, atomic or composite, in a weak entity type, which in conjunction with a unique identifier of the parent entity type in the identifying relationship type, uniquely identifies weak entities is called the partial key of a weak entity type. Chapter 2 – Foundation Concepts

37 Figure 2.23 Weak entity type: an example
Sample Data Sets for BUILDING and APARTMENT Building Data Set Bldg_no #Floors Size (sq. ft) Vacancy S S N N APARTMENT Data Set* Apt_no #bedrooms #bathrooms Size (sq. ft) Rent *The first four apartments listed are located in Building Number S51 while the fifth apartment is located in Building Number N51. Figure 2.23 Weak entity type: an example

38 Exercises What will be a relationship cardinality in the following cases ? A farmer can have many cows, but a cow belongs to only one farmer. A nation can have many states and a state many cities. A patient can have many physicians, and a physician can have many patients. A dairy farmer has several herds of cows. He has assigned each cow to a particular herd. In each herd, the farmer has one cow that is his favorite. For each data model, identify cardinality ratio, participation constraints, as well as domain and key constraints Chapter 2 – Foundation Concepts

39 Vignette 1 Chapter 2 – Foundation Concepts

40 Vignette 1 (continued) Chapter 2 – Foundation Concepts

41 Vignette 1 (continued) Semantic Problems:
A college offers many courses and also has several instructors. The attribute Name occurs twice in the COLLEGE entity type. Chapter 2 – Foundation Concepts

42 Vignette 1 (continued) Chapter 2 – Foundation Concepts

43 Vignette 1 (continued) Another semantic problem:
An instructor is capable of teaching a variety of courses, but this is not shown in Figure 2.28b. Chapter 2 – Foundation Concepts

44 Vignette 1 (continued) Chapter 2 – Foundation Concepts

45 Vignette 1 (continued) Syntactic problem:
While Figure 2.28c depicts a relationship between courses and instructors, a syntactical rule of the ER modeling grammar is violated. A relationship between attributes of an entity type is not permitted in the grammar. Chapter 2 – Foundation Concepts

46 Vignette 1 (continued) Chapter 2 – Foundation Concepts

47 Vignette 1 (continued) The syntactic error in Figure 2.28c is corrected by modeling COURSE and INSTRUCTOR as independent entity types related to the COLLEGE entity type, and establishing a relationship between the COURSE and INSTRUCTOR entity types. In addition, since courses are offered every term, Term is modeled as an optional multi-valued attribute of COURSE. Chapter 2 – Foundation Concepts

48 Vignette 1 (continued) Chapter 2 – Foundation Concepts

49 Vignette 1 (continued) Chapter 2 – Foundation Concepts

50 Vignette 1 (continued) Figure 2.28f is good, but the fact that courses are offered over the four terms, and in each term one or more of the courses are offered, is yet to be incorporated in the ER diagram. In addition, the business rule that the same course is never taught by more than one instructor in a specific term is not incorporated in the conceptual model either. Chapter 2 – Foundation Concepts

51 Vignette 1 (continued) Chapter 2 – Foundation Concepts

52 Vignette 1 (continued) Note that a syntactic error is created in the attempt to convey the business rule that says the same course is never taught by more than one instructor in a specific term. It is illegal to express a relationship between the relationship type Assigned and another relationship type Offered. Chapter 2 – Foundation Concepts

53 Vignette 1 (continued) Chapter 2 – Foundation Concepts

54 Quick Quiz What is an object type and how different/similar it is from an object? Give example of an object type and an object which belongs to it. What is an entity ? What is a property ? What if an attribute ? WER: Data integrity. : attribute What is the mandatory attribute ? Optional attribute ? Give examples for an entity you choose. ANSWER: Hierarchical. What is a relationship ? Give an example. ANSWER: Relational. ANSWER: Entity-Relationship (ER) diagrams.

55 Quick Quiz What is a cardinality constraint ? ANSWER: True SWER: File.
What would be the domain of the attribute County_Name in the state of Texas ? WER: Data integrity. : attribute What is the difference between a relationship that exhibits a 1:1 cardinality constraint and a binary relationship which exhibits a 1:N cardinality constraint? ANSWER: Hierarchical. Why roles names are important to describe the participation of an entity type in a relationship type ? ANSWER: True ANSWER: SQL

56 Quick Quiz Give an example or recursive relationship of 1:1 type, 1:N type. What is a business rule and how does an analysts /database designer determine business rules in a business ? What is a value of a model if any ? What database model types do you know ? What is a conceptual model ? ANSWER: True SWER: File.


Download ppt "Degrees of Data Abstraction"

Similar presentations


Ads by Google