Professional Documents
Culture Documents
Lecture 5
Lecture 5
Global
database
Relational
Database 1
Relational
Database n Integrated
schema
113/04/12 3
Step 1 Resolve conflicts among EER model
Loan
Customer ====> Customer Customer
Borrower
name name name name
date date open-acct-date loan-begin-date
113/04/12 5
Resolve conflicts on data types
n 1
Ax Ca Cx == ==> Ca R Cx
1 1
Ax Ca .C x == ==> Ca R .C x
Ax n m
Ay .C a Cx == ==> Ay Ca R Cx
113/04/12 6
Example
Schema A Schema B
Transformed schema A
A B A A'
n 1
customer
Loan name
==>
type Loan book
name
Customer Customer
type Contract Contract
113/04/12 7
Resolve conflicts on key
113/04/12 8
Example
name name
Customer
name
Customer customer#
===> Customer customer#
customer#
113/04/12 9
Resolve conflicts on cardinality
1 1 1 n 1 n
Entity x
R Entity y
Entity x
R Entity y ====> Entity x R Entity y
113/04/12 10
Example
113/04/12 11
Resolve conflicts on weak entity
Schema A Schema B Transformed schema A'
A1 B1 A1
A2 n A2
n
A2 n
Entityy Attrb Attra Attra
Entityyy Attrb Entityyy
Attrb
113/04/12 12
Example
113/04/12 13
Resolve conflicts on subtype entity
Schema A
A1 Schema B Schema X
1 A2 B1 B2 X1 X2
1 1
Entityx R Entityy Entityx R Entityy Entityx R Entityy
113/04/12 14
Example
113/04/12 15
Step 2 Merge entities
113/04/12 16
Example
customer#
A B x customer#
address customer# address
phone Customer Customer age ==> Customer phone
age
113/04/12 17
Merge EER models by Generalization
Schema A Schema B Schema X
X
A B Attrk
Entityz
Entityx Attrk Entityy Attrk
======>
User d=disjoint
supervision d
X1 X2
name x
Local Overseas Customer
Customer Customer ======>
x1 x2
Commerical mortgage_rate
Mortgage
prime_rate
loan_amt
Loan Loan
Borrower
Figure 8 Merge EER models by genealisation loan_amt Borrower
113/04/12 19
Merge EER models by Subtype
Relationship
113/04/12 20
Example
S chem a B S chem a X
S chem a A
B X1 X2
A
In te re s t F ix e d In te re s t K K F ix e d
K
R a te R a te K ====> R a te is a R a te
113/04/12 21
Merge entities by Aggregation
Schema A Schema B
Schema X
A B
X1
1 n
1 n
Entityx Entityy R Entityz ==> Entityy R1 Entityz
R2
Entityx X2
113/04/12 22
Example
Schema X
Schema A Schema B
A B2 X1
B1 B
1 n 1 n
Loan Loan Loan
Customer book Customer book
Security Contract ==> Contract
1
secured
by
n
Loan
X2
Security
113/04/12 23
Merge entities by categorization
Schema A Schema B
Schema X
X1
B Xc2
A1 A2 Xc1
Entity Z X2
113/04/12 24
Example
Schema X
Schema A Schema B
X1
A1 A2 B
Xc1 Xc2
Mortgage Commercial Loan Mortgage Commercial
loan loan Contract ==> loan loan
C=categorisation C
Loan
X2
Contract
113/04/12 25
Merge entities by Implied Binary
Relationship
X1 Schema X
Schema A Schema B Attr X X2
A B
n 1
Attr X
Entity a Entity b Attr X ====> Entity a R Entity b
Schema X
Schema A Schema B X1 Attr Y Attr X
A B X2
Attr X 1 1
Attr Y ====> Entity b
Entity a Entity b Attr X Entity a R
Attr Y
113/04/12 26
Example
Schema A Schema B Schema X
X2
A B X1
Loan Loan n 1
Customer ==> book Customer
Contract Contract
loan#
customer# customer# loan# customer#
Loan Loan 1 1
Customer ==> book Customer
Contract Contract
loan# loan#
customer# customer# loan# customer#
113/04/12 27
Step 3 Merge relationships
Merge relationships by subtype relationship
Schema A Schema B
Schema X
A1 A A2 B1 B2 X1 X X3
1 1 1 1
EntityX R EntityY EntityX R EntityY EntityX R EntityZ
isa
X2 EntityY
113/04/12 28
Example
113/04/12 29
Merge relationships by overlap generalization
Schema A Schema B
Schema X
A1 A A2 B1 B2
1 n 1 1 n X1
Entity X R1 Entity Y Entity X R2 Entity Y ===> Entity X
1 1
R1 R2
n n
X3 Entity X4 Entity
Z1
O
Z2
Entity Y
X2
113/04/12 30
Example
Schema A Schema B Schema X
A B X1
A1 A2 B1 B2
1 n 1 n Bank
Bank
home
Customer Bank
auto
Customer ===> 1
loan loan 1
home auto
loan loan
X3 n n X4
Home loan Auto loan
borrower borrower
o=overlap generalisation O
X2
Customer
113/04/12 31
Absorbing Lower degree
Relationship into a Higher degree
Relationship
Schema A
Schema B
Schema X
A1 A2 B1 B2
X1 X2
m : n 1 1 n
Entity X Entity Y Entity X R2 Entity Y ===> m : n
Entity X Entity Y
m R1 m
m R1 m
:
: :
n :
n n
Entity Z n
113/04/12 X3 Entity Z 32
Example
113/04/12 33
Case Study: In a bank, there are existing databases with different
schemas: one for the customers, another for the mortgage loan contracts
and a third for the index interest rate. However, there is a need to
integrate them together for an international banking loan system.
loan contract#
begin_date
Mortgage mature_date ID#
ID# Customer customer_name
loan contract loan-status date
1 1
1 1
1
1
1 1 (0,n) 1 n
n
Mortgage
Mortgage Loan
Loan Mortgage
Mortgage loan
loan
loan interest
interest loan
loan account
drawdown
drawdown type
type balance
balance history
loan contract# past loan# account#
loan contract# Loan_contract#
loan_bal_date past_loan_status
drawdown_date Interest_effective_date
drawdown_amt fixed_rate balance_amt
accurred_interest Mortgage
Mortgage
loan
loan
repayment
index Interest_effective_date
repayment
interest index_rate
loan contract# type accured interest
repayment_date
repayment
113/04/12 34
Step 2 Merge entities by Implied binary relationship and Generalization
Since data ID# appears in entity Mortgage Loan Contract and entity
Customer, they are in one-to-many cardinality with foreign key on the
“many” side. loan contract#
begin_date m ID#
Mortgage 1
mature_date book Customer customer_name
loan contract date
Since Fixed and Index Interest Rate both have the same key,
Interest_effective_date, they can be generalized disjointed as either
fixed or index rate.
Loan
interest
type
Interest_effective_date
Interest_type
d
fixed index
interest interest
rate type
Interest_effective_date
Interest_effective_date Index_rate
113/04/12 fixed_rate Index_name 35
accured_interest accured_interest
Thus, we can derive cardinality from the implied relationship between
these entities, and integrate the two schemas into one EER model.
loan contract#
begin_date m ID#
Mortgage 1
mature_date book Customer customer_name
loan contract date
1 1
1 1
1
1
fixed index
interest interest
rate type
Loan_contract# Loan_contract#
Interest_effective_date Interest_effective_date
fixed_rate Index_rate
accured_interest accured_interest
113/04/12 36
Reading assignment
“Information Systems Reengineering and
Integration” by Joseph Fong, published by
Springer Verlag, 2006, pp. 282-310.
113/04/12 37
Review question 3
Can two Relational Schemas be integrated into one
Relational Schema? Explain your answer.
113/04/12 38
Tutorial question 3
Provide an integrated schema for the following two views which are merged to create a bibliographic database. During
identification of correspondences between the two views, the users discover the followings:
RESEARCHER and AUTHOR are synonyms,
CONTRIBUTED_BY and WRITTEN_IN are synonyms,
ARTICLES belongs to a SUBJECT.
ARTICLES and BOOK can be generalized as PUBLICATION.
Hints: Given two subclass entities have same relationship(s). The two subclasses entities can be generalized into a
superclass entity and the subclass relationship(s) can also be generalized into a superclass relationship..
View 1
Title
n 1 Volume
ARTICLE Published_in JOURNAL
Size Number
Contributed_by
Full_Name RESEARCHER
View 2
Title
n 1 Classification_id
BOOK Belongs_to SUBJECT
Publisher Name
n
Written_in
m
Full_Name AUTHOR
113/04/12 39