You are on page 1of 39

Architecture of multiple databases integration

Global
database
Relational
Database 1

: Step 3. Data Integration Look Up


Table
:

Relational
Database n Integrated
schema

Step 2. Schema Integration

EER Model ............ EER Model


1 n

Step 1. Reverse Engineering


(for Schema Translation)
............
Relational Relational
schema 1 Schema n
113/04/12 1
Data Integration Concepts
• Data semantics define the relationships between data for
user’s data requirements.
• Data semantics are presented in database conceptual schema
such as EER model and DTD Graph.
• Only relevant data can be integrated for an application.
• Data relevance depends on user’s data requirements for an
application.
• Data consistency are the standard of data domain value and
format. Inconsistent data must be transformed before data
integration.
• User supervision means users input for user’s data
requirements, and which are for database design and schema
integration
113/04/12 2
Schema integration of EER models

Begin For each existing database do


Begin If its conceptual schema does not exist
then reconstruct its EER model by reverse engineering;
For each pair of existing databases’ EER models schema A and schema B do
begin resolve semantic conflicts between EER model A and EER model
B;/step1/
Merge classes between EER model A and EER model B; /*step2*/
Merge relationships between EER model A and EER model B; /*step3*/
end
end

113/04/12 3
Step 1 Resolve conflicts among EER model

Resolve conflicts on synonyms and homonyms

Schema A Schema B Schema A' Schema B'

Entitya Entityb ====> Entitya Entitya


User
supervision
Attributex Attributex Attributex1 Attributex2

(note: Classa and Classb are synonyms, Attributex are


homonyms)
113/04/12 4
Example

Schema A Schema B Schema A' Schema B'

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

S chem a A S chem a B T ransfo rm ed S chem a A '

n 1
Ax Ca Cx == ==> Ca R Cx

S chem a A S chem a B T ransfo rm ed S chem a A '

1 1
Ax Ca .C x == ==> Ca R .C x

S ch em a A S ch em a B Tra nsform ed S chem a A '

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

Schema A Schema B Transformed schema A


A B A A'
1 1
Loan type
name
==> Loan book
name
customer Customer Customer
type Contract Contract

Schema A Schema B Transformed schema A


A B A A'
n m
Loan type
customer name ==> Loan book
name
Customer Customer
type Contract Contract

113/04/12 7
Resolve conflicts on key

Schema A Schema B Transformed Schema X


Ay Ay Ay
Az Cx Cyx Az ====>
User Cx
.Az
supervision

113/04/12 8
Example

Schema A Schema B Transformed schema A


A B A

name name
Customer
name
Customer customer#
===> Customer customer#
customer#

113/04/12 9
Resolve conflicts on cardinality

Schema A Schema B Transformed Schema A'

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

Entityx Attra Entityx Attra Entityx Attra


1 1
1 1
1 =====>
R
A R R
A A

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

Merge classes by Union

Schema A Schema B Schema X


Attr a
Attr a Entity Entity Attr b ===> Entity x
x x Attr b

113/04/12 16
Example

Schema A Schema B Schema X

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

Attrk Entityx Attrk Entityy

Schema A Schema B Schema X


A B
Entityz Attrk
Entityx Attr Entityy Attrk
k
======>
O=overlap
o
X1 X2
Attrk
113/04/12 Entityx Attrk Entityy18
Example
Schema A Schema B Schema X

name x
Local Overseas Customer
Customer Customer ======>

name name d=disjoint generalisation


local_addr overseas_addr d x2
x1
Local overseas_addr
Overseas
local_addr
Customer Customer

Schema A Schema B Schema X


x
Loan
Commercial Mortgage name
Borrower
Loan Loan
Borrower Borrower ======>
name name
o=overlap generalisation
loan_amt loan_amt
prime_rate mortgage_rate
o

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

Schema A Schema B Schema X


A B X1 X2
==>
Entity x Entity y Entity x R Entity y
User
supervision

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 X Entity Y Entity Z ===> Entity X Entity Y


User
supervision C=categorization
C

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#

Schema A Schema B Schema X


X2
A B X1

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

draw accure repaid balanced accumulate opened

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

draw accure repaid balanced accumulate opened


n
1 (0,n) 1 n
Mortgage
Mortgage n
loan
loan
Loan
Loan Mortgage
Mortgage Mortgage
Mortgage loan
drawdown
drawdown interest
interest loan
loan loan
loan account
loan contract# Loan_contract#
type
type repayment
repayment balance
balance history
drawdown_date Interest_effective_date loan contract# loan contract# account#
drawdown_amt Interest_type past loan#
repayment_date loan_bal_date
past_loan_status
d repayment balance_amt

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.

Which steps need user supervision for integrating


two Extended Entity Relationship Models into one
Extended Entity Relationship Model? 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

You might also like