Docsity

Multivalued Dependencies and Generalized Dependencies, Study notes of Distributed Database Management Systems

Toggle sidebar
bg1
Multivalued Dependencies
In relation
R
,wesay MVD
X
!!
Y
holds if
whenever there are tuples
s
and
t
in
R
such that
๎˜™
X
(
s
)=
๎˜™
X
(
t
), then there is a tuple
r
in
r
such
that:
1.
๎˜™
XY
(
r
)=
๎˜™
XY
(
s
).
2.
๎˜™
(
R
,
Y
)
[
X
(
r
)=
๎˜™
(
R
,
Y
)
[
X
(
t
).
๎˜
I.e.,
r
agrees with
s
on the attributes
mentioned, and with
t
on
X
and all the
attributes not mentioned.
Example
Consider
CTHRSG
. In addition to the FD's
C
!
T
;
HR
!
C
;
HT
!
R
;
HS
!
R
;
CS
!
G
;
CH
!
R
,we might reasonably expect the MVD
C
!!
HR
.
๎˜
That is, given a course, the hour-ro om pairs
are independent of the teacher-student-grade
triples.
โœฆ
There will be a unique teacher for the
course, but student-grade information
should appear in combination with each
hour-room pair, since there is no logical
reason to assign di๎˜‹erent grades for
di๎˜‹erent hours and rooms.
Axiomatization of FD's + MVD's
Start with Armstrong's Axioms. Then add:
A4:
Complementation
.If
X
!!
Y
holds in
R
, then
X
!!
(
R
,
X
,
Y
).
A5:
MVD augmentation
.If
X
!!
Y
, then
XZ
!!
YZ
for any set of attributes
Z
.
A6:
MVD transitivity
.If
X
!!
Y
and
Y
!!
Z
, then
X
!!
(
Z
,
Y
).
A7:
Promotion
.If
X
!
Y
, then
X
!!
Y
.
A8: If
X
!!
Y
and
U
!
V
, where:
1.
U
is disjoint from
Y
, and
2.
V
๎˜’
Y
,
then
X
!
V
.
โœฆ
Example:
AB
!!
CDE
and
FG
!
C
imply
AB
!
C
.
1
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Multivalued Dependencies and Generalized Dependencies and more Study notes Distributed Database Management Systems in PDF only on Docsity!

Multivalued Dep endencies

In relation R, we say MVD X !!Y holds if whenever there are tuples s and t in R such that X (s) = X (t), then there is a tuple r in r such that:

  1. X Y (r ) = X Y (s).
  2. (RY )[ X (r ) = (RY )[ X (t).

 I.e., r agrees with s on the attributes mentioned, and with t on X and all the attributes not mentioned.

Example

Consider C T H RS G. In addition to the FD's C! T ; H R! C ; H T! R; H S! R; C S! G; C H! R, we might reasonably exp ect the MVD C !!H R.

 That is, given a course, the hour-ro om pairs are indep endent of the teacher-student-grade triples.

F There will b e a unique teacher for the course, but student-grade information should app ear in combination with each hour-ro om pair, since there is no logical reason to assign di erent grades for di erent hours and ro oms.

Axiomatization of FD's + MVD's

Start with Armstrong's Axioms. Then add:

A4: Complementation. If X !!Y holds in R, then X !!(R X Y ).

A5: MVD augmentation. If X !!Y , then X Z !!Y Z for any set of attributes Z.

A6: MVD transitivity. If X !!Y and Y !!Z , then X !!(Z Y ).

A7: Promotion. If X! Y , then X !!Y.

A8: If X !!Y and U! V , where:

  1. U is disjoint from Y , and
  2. V  Y ,

then X! V.

F Example: AB !!C D E and F G! C imply AB! C.

Decomp osition Rules

 For FD's, we know that if X! A 1    An , then we can \decomp ose" into X! A 1 ; : : : ; X! An.

 MVD's do not always allow right sides of size

 However, X !!(R X ) always holds by A (trivial FD's), A7, and A4. We can break R X into some disjoint partition, say

X !!Y 1 Y 2    Yk

such that X !!Z i Z is a union of some of the Yi 's.

Example

For C T H RS G, we have

C !!T H R S G

i.e., a course has a teacher (only one b ecause of the FD C! T ), a set of hour-ro om pairs, and a set of student-grade pairs.

Generalized Dep endencies

Unify FD's, MVD's, lossless joins, and inferences ab out dep endencies. A generalized dependency consists of:

  1. One or more hypothesis rows consisting of abstract symb ols, one for each attribute of the relation in question.
  2. A conclusion that is either another row or an equality b etween two symb ols. F If the conclusion is a row, then the GD is a tuple-generating dep endency (TGD); if an equality it is an equality-generating dep endency (EGD).

 We shall usually talk ab out typed dependencies, which means that a symb ol may not app ear in two di erent columns, and we may not equate (in the conclusion) symb ols from di erent columns.

 Usually, we talk ab out ful l dep endencies, meaning that the conclusion row of a TGD uses only symb ols that have app eared elsewhere.

 Start with a relation R consisting of the hyp othesis rows of G.

 Rep eatedly apply GD's H of G to the current relation:

a) If H is a TGD, map its hyp othesis rows to tuples of R in any way, and insert the mapp ed conclusion row of H into R.

b) If H is an EGD, map its hyp othesis rows to tuples of R in any way and equate the symb ols of R that H 's conclusion says are equal. F Rememb er to equate al l o ccurrences of the symb ols that the EGD says are equal. F Subtle p oint: if one or b oth of the equated symb ols app ear in the conclusion, change these o ccurrences as well; i.e., the desired conclusion must change as well as the tuples in the constructed relation.

 Since no new symb ols are ever generated (b ecause of the \full" assumption), eventually this pro cess stalls.

 At that time, if the conclusion row of G has b een added to R (in the case G is a TGD) or the symb ols that G says must b e equal have b een equated (in case G is an EGD), then conclude that G follows from G. If not, then not.

Pro of the Chase Works

 Soundness: Each inference made is sound, since it is a direct application of a given GD.

 Completeness: Supp ose the conclusion of G is not obtained. Then the nal R is a counterexample: F It satis es every GD in G , but do es not satisfy G.

Pro of That a Key Plus Relations From a Minimal Cover Have a Lossless Join

Supp ose we have a minimal cover F consisting of FD's Xi! Ai for i = 1 ; 2 ; : : : ; n, and we cho ose database schema

fX 1 A 1 ; : : : ; Xn An ; K g

where K is a key for the entire relation R.

 We need to infer from F (written as EGD's, if you like) the JD that says the join is lossless. This JD has:

  1. A conclusion row that has \unsubscripted" symb ols corresp onding to each attribute.
  2. For each relation schema, a hyp othesis row that has the unsubscripted symb ol for an attribute if that attribute is in the schema, and a unique symb ol bj if b is the symb ol for the attribute and j is the row numb er.

Example

Let F = fA! B ; C! D g. Recall the generated decomp osition is fAB ; AC ; C D g. The JD is:

A B C D a b c 1 d 1 a b 2 c d 2 a 3 b 3 c d a b c d

Pro of That This JD Follows From the FD's

 We know K +^ = R.

 An induction on the order in which attributes are added to K +^ says that in the row for K , each subscripted symb ol is equated to its unsubscripted version. F Key idea: if we use X! A to add A to K +^ , then in the row for K , all symb ols for the attributes in X have lost their subscripts. Therefore, we may apply X! A to the rows for K and X A to infer that aj = a, where j is the row numb er for X A.

 As a result, the row for K eventually loses all its subscripts, and b ecomes the conclusion row of the JD.