1. Trang chủ
  2. » Thể loại khác

DSpace at VNU: Functional dependencies with context dependent Null values in relational databases

14 101 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 14
Dung lượng 7,05 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

DSpace at VNU: Functional dependencies with context dependent Null values in relational databases tài liệu, giáo án, bài...

Trang 1

V N U J O U R N A L OF SCIENCE, Nat Sci , t XV, 1999

F U N C T I O N A L D E P E N D E N C I E S W I T H C O N T E X T

D E P E N D E N T N U L L V A L U E S I N R E L A T I O N A L D A T A B A S E S

B u i T h i T h u y H i e n

F a c u i i v o f Mri thcinat ics, MccliHuics riud InforjjiHtics

C ol l eg e o f N^tìiỉ ỉìl S ci e nc e s - V N Ư

N g u y e n C a t H o

Ij i st i t j i t e o f IiiỉoriỉỊíưioii T e c h n o l o g y Nỉitíoỉiỉìl C e n t e r for S ci cnc e a/id Technol ogy.

A b s t r a c t T h e a n n o f flits p i i p t r /.s to J)7'e,s€7it a n cxtcìLsi.oìi o f t h e c o n c e p t oj

f m i c i t o i i a i d e p c i i d e r i c y in a (iafaha.se Ĩ71 wfitch t h e p r e s e n c e o f c o i i i t s i d e p e n d e n t , n u l l values IS allowed If IS sliowv that the set of A n n s h v i i g ' s nifere.nce rules fo rm s

a s o u n d a n d c o m p l e t e axtoin s y s t e m f o r f u n c t i o n a l (lepeĩìdencies u n d e r a suitabl e

s e i n a i i t i c o f conftJ'-f 7ỈUỈỈS S o m e r u l e s a n d a l g o r t i h i n s f o r n i a m p u l a f i n g c o n t e x t n u l l

values are also nitrodacejl a n d t x a v i i i i t d

1 IN T R O D U C T IO N

In the theory of lelatioiiHl d atab ase (lesion, the iiitPgỉiỉ>’ (‘Onstiaiiits play a crucial role and have been de(*pl>' investigatt'd in tlu' fiaiiK’work of (latat)ase relations without

null values In such a fiaiiiewoik funcitovai (lepcjide/ncies (FDb) are the m ost a a tiiial

and ust'ful The* not ion o f a kr\' ((l('ri\'ctl tioin a Si't ot F D s ) is f u iu l a m e n t a l t o t h e

le lH t.lO lia i ia u d i * L A ^i>Uluì i iu d ( u í i i Ị í l r l t ' (ix'io iii MV.slrui I'oi F D h W(US f i i h t i y i l l [1] aiiv\ iii

known as Armstioiif^’s axiom systi^n Many aiithois, M Levone [11], Lirn[12], Atzoiii and Morfuiii [2], [3j, [4] Maun' [i;3] have coiksidtHiHl FDs in d atah así' rf'lations containing unm arked null values, which semantically int(‘r p n 'to d as "unknow n'’ [11], [\''\^ (-)I

“no infoim atiou” [12], [2], [3], [4] Lien Atzeni an d Morfuni have iutiocluced a sound iUid

complete axiom system for F D s by dropping th e tra n sitiv ity rule an d a d din g th e union and decomposition rules to A rm stro n g ’s axiom system To m aintain th e satisfaction of

FD s in relational d atab a se s w ith incomplete inform ation, Maier [13] has in tro d uce d and investigated m arked null values

T he aim of this pap^'i is to present an extension of rho concept of functional d ep e n ­

dency in a d a ta b a s e in which the presence of co ntex t dependent null values is allowed It

is shown th a t th e set of A rnistron g ’s inference rules forms a so u n d and com plete axiom system for functional (lepeiulencies under a su itable semantic of co ntext null Some rules and algorithms to m an ip ulate context null values are also introduced and exam ined

14

Trang 2

F u n c tio na l d e p e n d e n c i e s w i t h c o n t e x t d e p e n d e n t nu ll va lu es 15

2 BASIC D E F IN IT IO N S

Let R ( A \ , , , ) be a relational scheme defined over a set of a ttrib u te s Ax, , Ar^.

l lio duniaiii of each a tt r i b u t e A, is denoted by Doĩn{A^) T h e dom ain of R consists of the

C aitP isian p ro d u c t Do7n.(/1i) X DoiniA-z) ^ .X D o m ị An ) Sihd denoted by Dom,{R).

We extend each d o m ain D(mi{A,) to an extended dom ain Dorri*{A^) by adding a finite set of null symbols, nam ely D o 77 ỉ*{Aj) — Doĩĩĩ ịA, ) u A,J u A i2 u {due}, where

- is the set of optni context nulls denoted by

- dne riioaus it "does not exit'’ context null.

- D o 7 n ( A , ) A , , , A,.^, {(hie) are the disjoint sets.

T he ext en de d d o m ain Dorii*{R) of R consists of the Cartersiaii p ro d uct

D o ì ì ì ^ ( A ị ) X X D oì ĩ l* ( A n )

A relation of a scheiiio /? is a subset of Doĩn^^iR) Such instances are denoted by

lower ca.se letters such as r i ,

A K'latioii c oj it ai ns no or s o m e null values is called a p ar t ia l relafAon T h e set o f all

partial relations over schouio ỈĨ is bv R cl]{R).

A K'latioii w ith o uf null values calltHÌ a total relation, the set of all to ta l relations

ov'(M sclu‘iiH' is clenottHl bv Rcl{R) A fuplo of an iiKstance r is called ail elem^nit of

\ \ ( ' (h'uotr tuph's by letf(‘is such ais If f is a tuple of a relation ĩ\ then f[A, (Iciioti's th(‘ i onipuiiont of t wliicli coMespoiids to the a ttr ib u te A, If ^[.4,] is not null we

wnio /[-4,]!

VV(' US(‘ rlic n o ta tio n 0 ]>eri to refor an open context imll, and no tation unk to ivĩei

a l l t i u k n c n v i i c o u t i ' x t n u l l

A n u n h i i u w i i U 1 0 Ị M ‘ 11 t o u t c x l n u l l i; I t i l l c i l t i l l i i u U - f i u i l r V d l i u ' i i i n l c\ I I O I I n u l l V r t l i i f

<)1 a fhic null is (‘rilli'd a (l(’íiiiit(' \'alii(’.

3 KU.\X"TIONAL D E P E N D E N C IE S W IT H C O N T E X T NULL

In the classical theory, a functional dependency (FD) is a statem en t f X Y

satisfies J (wi‘ SHV also t hat / holds in ;■ ) if for (‘ach pair o f t uples f \ J 2 Ễ ^ such that

/i[.V] = we havt^ 1 ~ ^‘l ị y ■

Let f] and Ỷ 2 two tuples (m ay contains context nulls) over scheme R and A be

an a ttiib u le \Vf‘ sliall w iirc ^|[.4j —— t- 2 [A]) if

1 h [-4]!, f2[-4]! aiul /ị[.4ì =: or

2 t i [ A] — — ồỊ h i k I / ^ y, o r

3 t \[A] — J p ^2[A] — d, aiul i — 7, 01'

4 ^i[^4] = (hie and

By t [ [ X ==^ we u n d e ista n d fx[A] = = Ỷ 2 A , for all A e X.

Trang 3

ì(i B u i Thi T h a y Hieiiy N g u y e n C ai Ho

'1'ln'ít ' l u i ĩIh' uH'aiiiiijj, ot (■(>iii]>ai isoii í)])('i atoi —“ is just t o ( tli(’ syinì)olic

(IIi(

Cuiitiarv to coiuiiai 1MJ1I ui)í'iai()i - is the c oi n p a i i s o n o p n a t o i Foi ('XiiiUỊilc :ị / = 4 ; ^ = / = = / = , i

-In (latahas('s w i t h iiicoiiipl('l(' i u ĩ oi ui al i on .1 natural (lucstiou arises at tliis jniK tUI('

IS llial; what is tli(' t n i t h valiK' of /■ = ỊJ if' 01 fi 01 both ;u(‘ null'.^ [11 Ị9Ị Co<l(l lias

lu l r o d i u r d a t Incr-valiK'd lo^lc {0.^' 1} foi nsiii^; t o exploi t data from (lat ahascs tliat inav

( O i i l a i i i I i n l i V i i l u c s , l u t l i ( ' c i i s c o l C o i i t c x r n u l l s WI ' a < l o p t a l i v c - v a l i i c d ! ( ) - i c I o c o i u p a i <' 1 l i c

v a lu e s in a contc'Xt n u l l (lat a l ) a s ( ‘ ' ĩ h c f o l l o w i n g trtl)lc a llo w s US t h o t n i t l i v a l u e as,siíi,uiu('iii U) S U( li ( oiuỊ)ai isoii:

Fuị., ỉ

I(’ W(‘ (1('1Ì1U' / ’ a I r u t h \'alu(’ assiji,iiiiunit t o a < uui])Hrisou ì)('t w('('ii iiuy t w o valiK's iu a

c o n t c x l n u U (la t,aha.s(' W(' h a v e r{<i = b) = 0 ; r((i - - (liic) ~ 0 : r ( ồ , = / > , ) = ^ ; ì' (ò, =

t , ) = I '(11 — n) = 1; t ’{di ì c = d i i f ) = 1; .

W(‘ now ('Xt(‘ii(l the C'0ii('('pt of f unctional clcpíMuloiKẠ' ill a con text null (latal)H.S('.

D i - f l l i i t i o i i 1 L - t n { U ) a I v - i n ■: V c ' ' ■ > > ' - '1 ' ' " t l ' ^

saui t o be (L f i i v c t i o i K i l (IfpciKlc'iKi/ with ((Iiitc.rl iittJIs OIIKV R ( U ) ( c i i F D ) 1Í f o i e a c h

(■(Iiit('xt I iiill K 'la tio u /■ o ve r n ( U) an d fo r I'ach I>air oi' tu p le s /1 /'i € r such th a t I '( i | [ v ] ^ 'ji-V]) > e, W(- havo r ( i | [ y ] = t 2 [y'\) > £■ 11’ f = ^ instead OÍ V )

P r o p o s i t i o n 1 = t '2 Ầ ) > Í it Hijci only it /^i[A] = = t -2 X ■

Proof T he proof is clin'ctly tUHlucod from the (lofiiiition of function r and coiupaiisoii

(j])(n<itor = = .'O’

F i o i i i P r o p o s i t i o n 1 it tollovv.s tiu it D i ' f i n i t i o i i 1 IS C (|iiiv a len t t o t h e follt)wiiifi, o n e:

D e f i n i t i o n 2 Let R{U) bo a K'latiun scheiiiP and X , Y c U \ f : X Y IS soul to

hr a f n nc t lo n a l uniìì coiitc.ii 'ĩi.ìdls over f ì { ư ) ( c i i FD ) if for oacli coiitpxt null

relation r ov('i R{U) and for oacli pail of tuplf's t \ f 2 £ I' sikIi th a t ^i[vY] = = we

have ^1 [ y] = = ^i[ F

In t liis p a p e r , w e 1 ('Strict o m s o l v p s t o i n v e s t i g a t e f u n c t i o n a l d i ' p c r u l e n c i e s midcn

CDiitoxt nulls X ^ Y w ith f = c i.e., cnF D s of the foiiii X —> Y.

Trang 4

F u n c t i o n a l d e p e n d e n c i e s w ith c o n t e x t d e p e n d e n t nu ll v a lu es . 17

Fig 2.

E x a m p l e 1 T[i(> Iplation r given in Fig 2 satisfies functional dependency B.

Let F be a set of (lata dpponclencies, a d a t a dependence / is callod a logical conse­ quence of F if any relation r satisfies F then it also satisfies /

w v cloiiotp F* = { / I / is a logical consoquence of F}

Gi v en a S('t o f infeieiico lilies, set f + = { 7 I / is d e d u c e d from p by m e a n s o f the

iiifpiencp rules }.

Th(> set of iiiforeiKT rules is said to be sound if ( F + c F*) and to be com plete if

(F + = F ‘ )

It is well known th a t for functional deppiicleiicies in th e reJatioiial moiiel without mills, the followiiio is a sound and coiiipletp set of irifpieiice rules;

-4i) K'Hcxivify: If Y c X tlu'u A' ^ Y

From rules ^ 1, A' 2 , A 3 we can deduce the following two rules:

Ẩ.j) union: If X — Y and X -* z then Y — Y Z

.4s) d(H'oniposition: If Y ^ y z then A' —► Y.

A ccoidin” tu Dc'fiiiitioii 1 (or Dctiiiitioii 2) it is easy to S(‘(' t hat icHi'xivitv

auftincuta-tioii, trausiti\'itV uiiiou and iloroniposit iou nih's ai(> s ound also for fuiK tional (lppf'iid('iici('s witli co nt ex t nulls.

For couvcnioiici', W(' lecal l here the following notion: T h e closun* A'+ o f a set of

Httrihutcs A with lespoct to u H('t F of tuuctional (If'pciulencies with coiiti'xt Iiulls is

di'tiiicd as tullows:

l ỉ y the rulf's of union and il('C()iii])ositiuii, it is cloai tluit A' —> is (l('(luc('(i

/■ I n ’ m e a n s ( i t t l i ( ' I i i l i ' s i f a n d o i i l \ ' i f V c A '*”

T heorem 1 The rules A i , A 2 ,A ị foim a sound and complete set o f inference ivies for

ĩnnctioiiRÌ d e p e n d e n c i e s w i t h c o n t e x t 1ÌUỈỈS.

Proof, a) Souiuliu’ss of tlu'se rult's has hccii shown above.

b) Coiijplctf'iK'ss: Let F he a set-of iuuctional (lf'p('iul(’ncÌPS with context nulls over a srliomo R(U ), F* = { / I / is logical consoqiH'iicf' of F }, = { / I / is ileducpd from F by

iiK'aiis o f A i , A- 2 /l.'i}- SiiK't' 4 ; , ,4;j ai(' s o i i i u l , W(> h a v ( ‘ F~^ c . It r e n i a i i i s t o p r o v o

th a t F* c F + , ^ h a t means wo need to show: if / € F* thon / G F + This is equivalpiit to show th a t if / ^ then ị F *

Assunu' tliar (Ị : X —+ 1 is a ciiF'D and (j Ệ Let ;■ be « two tuple iT'lation

• ^ 2 } , w I k ' K '

V/1, G u, tht'ij ^i[.4,j = 1 or

ii[A ,l = Ố

Trang 5

OI-18 B u i Thi T h u y H i e n , N g u y e n C a t H o

/i[.4,] = d, IJI

^ Ị/1,Ị = line.

\/A, e A'+ tlicn /■.>[.4,] = = /1 4,

V.4, € u \ -V+ tli('ii / j[.4,] = / = h[.4,

(1) r satisiics all til*' tlejK'iulcncies in /•’: Let ( \ ' -* u ) G f , as.sinní' V' u is not

satisfied by r i.e., ^[V"] = = tọịv] and /i[v r] = / = ^2ỊU■j From ^i[V'] = = t-,[V] we h a w

V c From / i [ i v ] = / = it iinpli('s tliat II' nmst cont ai n at least ou(' att,iihiiti'

in Ư \ say 4 Thvis 3.4 G \ v such th at A ị A' ■ (*) Since r c A '' W(' concliulc that

so w c A'^ Blit, it is iiupossiblc l)(‘caus(* of (*) Hence, r satisfies all the (lcp('iul('iinc>

in F

(2) r does not satisfy fi : A s s ui u c the c o i it ra iv th at /• SHtisfi<'S (/ : X y From

implies by defimtioii of t i t ’i th a t Y c x ^ So, (A' ^ y') G F a (‘on ti ad ict ion.

Therefore F* c Coinbinin^ with c F* \ VP hav(‘ F* — F ^ \ ộ

4 SO M E RULES T O M AINTAIN T H E SATISFA CTIO X

O F F U N C T IO N A L D E P E N D E N C IE S IN C O N T E X T NULL DATABASES

A c co rd in g to the Si'iiiantir a pproach to co n te xt nulls, c-ontext null valvK'S is (Iciinod

b v well -known information T l u ‘ set OÍ f unct ional (l(*p(‘iulenci(\s a i ( \ o f course, very i m p o r ­

t a n t well -known i nf o in i at io u to defino conti^xt nulls T h a t m ea n s, c‘ont(*xt nulls have to be

defined and haiulled to onsiin* tliat the (latal)ase w ith cOiiti'xt nulls uiulri cousideiatioii still satisfies a given set of fiuK'tioiial (li'pi'ndiMicies Hoỉicí\ wliik' im phnnenting tlie (lata

u p d a te procedures, tlu' system has to m aintain thí' satisfaction of functional (l(^pend(Mi(‘U‘s

in the database To obtain íliih' obj('Ctiv(' S011U' Mili's for iiandliug contoxt nulls luvil to

ho oV>oyr*il

D e f i n i t i o n 3 l e t r he in R d ^ { R ) X -* A hv a n i F D OYVI R J i and Ỷ 2 be two tupN's of

r such th a t /ỉ[X]

- If ^i[>4]! t ‘i[A]\ and f\\A] ~ / = ^)[-4Ị then r has a hard violation of X —^ 4 airi

o pen context null then r has a hard violation O Ĩ X A.

least one of two side of (*) is null fhen r has a soft violation OĨ X A and, /i and f .2 are said to cause a soft violation 0 Ĩ X A.

E x a m p l e 2 Let >1 is a cnF D over R an d consider two tuples an d t 2 of r and

- if ti[A] = = 3 then r has a h a rd violation OĨ X A

- if f\ A] = dne, to[A] — 1 then r has a hard violation of X —^ A

Trang 6

- if ^i[^] ~ (Inc, to[A] = l ị then /' has a soft violation of A' —* A

F u n c t i o n a l d e p e n d e n c i e s w i t h c o n t e x t d e p e n d e n t null v al u es 19

T h e function VIOLATION in A lgorithm 1 will ch(Tk whothoi two tuples /1 a n d Ỷ 2

causo a violation of the ciiFD X A.

A l g o r i t h m 1 V I O L A T I O N { r , f x , Ì 2 s X > 4)

I n p u t : V E Re l i ^ ( R ) , X A is ‘A c n F D ov('r R J \ and Ỷ 2 are an v two t uples o f r

such th a t ^i[A'] = = t-2[x

O u t p u t ; 2 if /] and cause a liaid violation of X —» /i; 1 if /ỉ aiui Ì 2 cause a soft

violation of F ; 0 otherwise.

Begin

if (/i[.4Ị! and ^>[.4]! and ^i[.4] - / = /2[.4j) then V I O L A T I O N ;= 2

else if (^i[/l] — Ị ~ /'2Ị-4]) and ((/i[*4] diic

then V I O L A T I O N 2:

else if (^[.4] - / = t 2 [A]) then V I O L A T I O N 1;

End,

D e f i n i t i o n 4 A conicxt null (latabase is said to bf' consistent with a given set F of

iuiK’tiuiiiil ílt'Ị)íUKlí'ii('ị('s if iIk 'k ' is not any hard 01 soft violation uf F in thí' database*.

D e f i n i t i o n 5 Li't D B 1)(’ a cuiitoxt null databa8(' and r h(‘ H n^lation in D B aiul F he

a set o f c i i F D s o\'('i R A ss ui i u' tliHt t \ a n d /2 ai(' a n y t wo t u p l i ' s ill r t h a t <‘aiis(^ a soft

\ iolati<m of a n .V — 4 in /■’ A soft v i o l a t i o n i‘(‘iuo\' al t h a t is cHusi'd 1)V t i a n d f ) in r (or

111 i ) i U is (l('fiiK'd a.'> follows;

1 II' tíiit' OÍ tlio twt) valiK's t \ { A ] a n d is n ot null, (sav / i [ / l ] ) aiul t h (‘ o t h e r (/íỊ.4]) is ('iilit'i ;iii I i n k n o u ’ii coiiicxT mill in a n OJX’II con tt 'xt null, t h e n v\' (n \ occurroĩicí^ DÍ’ thi' mill t y[A] iu /■ (or iu D B ) is I'lianj^ed l)V

‘J 1 Í < >1 ii (>1 t 1 1 < t w o \ a l u c : / J A a l it I t Ỉ / 1 ] i (■ it 1 1(1 a <i m i m l l t n <111 111 k n o w 11 t o u t c : v t

null (sav /i[.-l]) a]i<l tlir uIIh'i vahu* (/2[.4]) is an oị:ìími coiiU'xt ĩiull tlu'ii (’V('IV occiiin'iK’i'

OỈ ili(' mill (/ )[/i]) in /■ (or in 1)1^) is ỉ>y /][/l

3 11 1)01 li ;ui(í r ai(' (‘it lu’i Iiiiknuvvii contf'xt nulls OI couti'xt nulls,

tlif'ii ('\‘('iy tx'curn'iict' ui thf’ 01H' with iiuli'X (sa\' i } /1Ì) ill r (or in 1)B) is cluiii^cd

bv the o th e i w i t h s maller index (^i[-4j).

E x a m p l e 3 Ill íhí' cas('s ỉ)('!t)\v tlìí' soft \io laiio n s ill r (or D R ) will be iPiiioved as

tolluws:

If and /'iỊ/l] = llicii ocí iỉi'iriic(' of h, ill /■ (or ill D B ) is rhaugíHỈ h\'

h[ A]

If a n d f ị [ A] = ii, tlii'ii V t x ' c m n ’Tic(' OÍ J , HI /■ (or in D B ) is cliaii^^rd 1)V

If /] [-4] ” d i i v a n d ^2[.4] = li, t h e n ('vt'i'v o c c u n e i u o of :^ị in /’ (^or 111D B ) is cliau^íHÌ

h\' (ỉììe.

If and ^J[/1Ị = ‘i/ ilu'ii ('Very ov c n n v n c c OỈ ijj ill r (or ill D B ) is chauj.Ợ'(l

1) V Í) ,

Trang 7

20 Bill Thi T h u y Hieii, N g u y e n C a t H o

If f \ [Ạ] — iuiil Ỉ < j IIhmi v v o i v uccul I ('net' of dị ill r (or in Ỉ ) B ) is changed by Ồ,.

I f / i [ - 4 ] = /:/, , ^ 2 [ * 4 ] = iii a i n l / < J t h r u ( ' v n v o c c ' i i i r c i u ' ( ' OỈ .i J i l l r ( o i i n D Ị Ì ) IS

c hanged 1)V i,.

prf'sriitiii^ an algoiithin for rPinoviiio a soft violation th a t a p p ra rs in a

relation or in a DB l(‘t us iiist show an algoiitliiii wliicii cliang<\^ ọxviy ocv un vu vv of a

mill value ill a li'latioii (or in a DB) to a ck*tinit(' valiu' t)i to a luorc inioMuation null valiu'

T h e algoiiihiu C H A N G E ill Algorithm 2 changes all the value HÍ th(‘ colum n of attrihiiK'

A ill M { M — I' Ơ1 M = D B ) to valiu' Ị.Ị.

A l g o r i t h m 2 c H A N G E ( r , A, M y)

I n p u t ; r 6 R c ỉ ị ( R X M is a cont ext Iiuli databasí' or M is a rel ation r , A is an

attril)iito (’ohiiiin undi'r consideration T and y ai(‘ two \'ahu\s (may b(' null)

a t tIk' a t n i h u t o c ol uiii n A

O u t p u t : Chaiij>(' vvvvv IM'CUM(‘lire of \-alu(' /■ at a tĩriìm li' coliiiiiii 4 ill M to vahu* ij

Begin

For each relation r in M do

For each tuple f in Ì' do

if ^[.4] = = :r then f[A] //;

End,

T h e algoiithin for a soft violation in a If'lafion oi ill a DB is presenti'd as Algorithm, 3

A l g o r i t h m 3 R E M U V E V I O ( M J X A)

I n p u t ; r G R e l \ { R ) , M is a (‘ontt'xt null claíabas(' or M is a relatio n f \ X ^ is a

c i i F D over R and, /i and t -2 ai(' tuples vvliicii causf' a soft violation of X ^ A

O u t p u t : Reniov'i' tlio soft violation caus('(l by and Ỉ 2 -

Begin

begin /■ f 2 [ A ] ; C H A N G E ( r , A , M j ị [ A ] ) , end;

if t ‘ 2 [A]\ and ^i[.4] = = iink then

begin r :='ti [ A ] \ C H A N G E ( i \ 4, M , end;

if ^i[-4]! and /2(^4] oj)e7i then

begin X := t 2 [ A \ ' , C H A N G E { x , A , M M [ A ] ) \ end;

if /j[^4]! and / ị [ ^ ] ‘= — open then

begin :r : = t i [ A ] : C H A N G E{: ĩ \ A M J - M ] ) ’ end:

if ^i[^] “ = due and /2[^4] —= opev then

begin X t 2 [ A ] ; C H A N G E { : r , A, M , d n c ) ; end,

if /ịỊ/1] = — u v k and t 2 [Ả] = — opcm then

begin :r t 2 [A];y := C H A N G E { x , A, M^y): end;

if ^2[>l] (Ỉ 1 ĨC and tị[A] = = open then

begin T t i [ A ] ; C H A N G E { T , A M^dn e); end,

if /2(^1 = — and f\{A] —= open then

begin X \= t\[A]; y := f -2 A]: C H A N G E { x A A/, y)\ end;

Trang 8

if (^i[-4] = — and ^2[.4Ị —= u.ilk) or (^[[/l] = = opt'ii and (fpcif) then

begin

if tn(lc:r{.r) > ịn.(ỉ(í.r(y) then C Ỉ I A N G E { r , A, M , Ịj)

else C H A N G E { i j A / M , r )

end;

End

L e m m a 1 Let r he in ĩỉ('/J (R), F i>e a set UÍ ciiFDs over R I f two tiiples f] and Ỷ 2 o f Ì' Cr ỉ i / s e a s o f t vìoÌHtioii o f F Ỉ^ÌKÌ r ' is t h e r c h t i o i i ( ỉ c d ì ì c c d f io iii r h y m o v i n g t h e s o f t VÌOÌHÌÌOÌI CHìiseil hy fị riiid tj then r' > r ộ

Proof Bv Definition 5 if a soft violation is removed then:

(i) Tlio definite values in /■ an' nuchanged

(ii) Each null value in r is either unchanged or clianged to a definite value or d ian g ed

to a more iiifoiIllation null value

Conibiniug (i) a n d (ii) we have r' > T.Ộ

T h e o r e m 2 Let D D i>e H context liỉỉìì (ÌHtHÌmse, r he ri relỉĩtỉon ill D B a/id F ỉ)e a set

o f ciiFDs ovei R I f the toilowiug conditỉoỉis hold:

1 In D B , f/jei'c is ÌÌOĨ a n y ÌIÌÌKỈ v i ohi tion o f F.

2 AU tiic soft vioiritioiis o f F t h a t r ippear s in D B CHii he veiiioved Siich t ỉ ìãt ill D B

t he r e is n ot ỉiỉiy hĩirt \'io/atiơJi o f F.

rhcji Dĩỉoìti c DBncu ■

Proof D i K ' d l v (1(h1uc('c1 iruui Linnnia 1.Ộ

L e n i i i i a 2 L a r i)€ ]ii R r l ị ( R ) F he ỈÌ set o f ciiFDs o w i n j J ) e a tìipìe over R I f the

following coiKÌiiious hold:

- hctwceii f a n d r t l ic r c is not ỈÌÌIV ỉ ì ã i d vioỈHtion o f F\

' / > e t \ v e c i i t ỉiỉKỈ r t ìì Cĩ v is a s o f t vioÌHtỉoìi o f F ,

ỉ ì í t cỉ i v i i i u v i n g t i i i s s o f t Vì oì i ì t ì on. VV'C ijHve:

(i) ill /■ tììCỉv is n o t HỉiỴ ìiHid vioìrìtioii o f F,

(ii) b e t w e e n f a n d r t h e r e is n o t a n y h a r d v i oi a t i o n o f F.

KMiioviug a soft violation i)Otwf‘cn f arid 1' , th ere aro two the following possibilities:

C a s e Ỉ: T h e t u p l e t IS to be c h a n g e d a t t h e v a l u e t A] a n d t h e t u p l e f ' IS k e p t unchanged:

In this case, t h e rol ati on 7' is not chaug(H] B y t he first con di ti on o f tho a s s u m p t i o n

wo have (i)

To prove (ii), we suppose the coiitiaiv, t h a t there is a tuple f\ of 7' such th a t f and

tị cause a hard violation (HV) of F Since t is only be changed at value t\A] and in the

initial relation r th ere is not any HV, so if f and f\ cause a HV of F then such HV must

bo HV of cnF D X -+ A Since after lonioving th e soft violation (SV) between t and f' wo

F u n c ti o n a l d e p e n d e n c i e s w i th c o n t e x t d e p e n d e n t n u ll v a lu es 21

Trang 9

22 B u i Thi T h u y Hieriị N g u y e n C a t H o

also must caus(‘ a HV of c iiH ) .Y ^ A This conitaclicts (i).

Ca.se 2: The tuple f' is changed at value f' A a n d the faj)la t I,.s kapi Uiichaiigcd:

(i): On th(' cout iHiw s u p p o s e th(‘ ass('itioii (i) d o e s not hold.

By thí' first comlitioii of the assuni])tioii, tlu'ie is not anv HV in r tliei(*foi(\ if a

HV that appt'ais ill V ai'ti'i loinoviiig the s v between f and f th en such IIV m ust bí' ĩli('

HV aiul a tuplí' of Sinct* is only c hanged at valu(‘ /^[^4], tho HV betw(‘('ii

and t\ must ho of ciiFD A' —^ A Siiici‘ after liunoviu^ rli(‘ s v h(‘t\v('(‘u f and t' \vv hav(‘

/[ 4] /^[^4] a n d ^[A'] —— if a n d f ị caus( ' a H V o f c i i F D A' 4 t Hiul /|

CMUSÍ' also a HV o f c i i F D X — 4 Cli'ailv, is \ hv t uple o f / Ix'lou' iciii oviu^ tln' s \ ’

'.)x t\xvvu t aiul f ' This fon tim licts assmiipriun th a t f and V do not cause any l i v of F.

(ii): Siucí' tlio tuple i is kept micliaiigíHl so for any f\ G r \ and if Ỷ ^ t] do

MUÍ t aius<* anv HV of F It remains to rlHH'k th a t whoth(‘i f and V cause a HV of F or not'.''

Suppose / Hiul caus(‘ a HV of ciiFD Y B Because aftci reuioviiig ĩlu' s v ỈK‘t\v(*(*ii

also a HV of c i i F D Y ^ B T h is co i it ia di c ts the s(H-oncl f o u d i t i o n o f t he a s s n i n p t i o i i ộ

T h e o r e m 3 Let r />e j]j / ? c / | ( / ? ) , F he tlic set o t c u F D s o v e r R , t b e ft t u p l e o v e r s c h e m e

R I f the following coiiditioiis m e satisfied:

- in V theve is n o t riiiv soft o r ÌÌỈÌHÌ violati on o f F.

- /jcfu'cej] f riiid r t he r e is n ot Hỉi\' lìỉtid \'iuIrìtioỉj oí F tlìciì iiftvi ivỉii uviti g rill tliv

soft vioỈHtioiìs ỉìppcíìi hewecn i i-ìiicì r, \\v liỉìvc:

(i) In r t l i c i v is ììot rỉ/u' ìiHrd vioìiìtioỉi oi F.

(iì) Between t aiỉd r tììeiv is ỉiut Hiiy lìnid viohìtiun ot F,

(Ui) ỉn r there is not i^ìiv soft violiìtioỉi o f F.

Y j \ L i U11U<V 2 t i i t i i u m o v i n g : , V j \ \ a Uv i i i i / , \ i n \ / ' , Vv'<’ \ i a v c

- in /■ íliOK' is not aii\' IIV.

- Ix’tWiH'ii r aiul / ílicK' is not any 11V.

Applying*, Li'iniiui 2 to the tuplí' / and thí' ri'lation r until all tli(‘ SVs hotwoon t

r arc Kuuoved, we ob tain (i) and (ii)

(iii): Assume the contrary, th a t after removing all the SVs between t and 7’, thviv

m v a c i i F D A' A in F aiitl two t u p k ’s i' and ^1 of r such that Hiid f\ faus(' a s\^ OÍ

X 4 TIhmi, = = ^ 1 ~ / = (U- Siiicr is not any s v 111 tli('

initial K'latioii /', t h e app(‘HiaiiC(‘ of tlu' s v l)et\veeu ì' and s h o w s tiiat at such a tiiiií'

eitluT ị' and i or and t tlo caiusi* a s v of ciiFD X —+ A Iud(H*(l suppose* the co n tia rv

th a t, b oth f' and t\ and t (Iocs not cause any s v of ciiFD X A u shows t h a t thv

values /[.4] aiul f\[A] art' not cliaii^otl Since tholo is not any s v in tlio initial relation r, if

/ '[ x j Hieu ^'[.4] — /i[*4j which contradicts (1) Therefoie at such a tiluo (Mtlii'r

all tlii^ SVs l)(»tw(‘(ni f and r liavo Kunovetl an d A[yY] we ịyot /[,4] = = f' [A and f A] = = tị A ỉt follows th a t f \ A ] = — a contradiction to ( l ) ộ

Trang 10

Bv tho TheoiiMii 2 and th(‘ Thi'OK'Mi 3, in Older to m a in t ai n tlu' <oii.sist(Mu V of a

c o n t e x t null da t ab as o, it is nocessaiV to introcluce t he followiijg t wo rules foi u p d a t i n g and inserting (lata:

R u l e 1 (For updaUnq data)

Lr*t D B 1k' a (*ont(‘xt luill (JHtal)as(' and r !)(‘ a lolafion in DB; F b(‘ a set of cnFDs

ov(n R , [j'i f b(* a t uplo of V that ne(*(ls to u p d a t e d to b e c o m e /j:

(i) If th eiv is a tiipl(‘ f' in r \ {^} th a t ti an d cause a h ard violation of F the

system will not iinpleuHMit th(' u p d a te procedure for the tuple f.

C o n ve i s (‘ly, if (i) is not satisfied:

(ii) For each X A in F tlio system will iiuplement checking:

For (*ach tuplp f' in r \ {^} if /] and caiiso a soft violation of F then the svsĩern

will renioví' that soft viol ation.

When all soft violations between r \ {/} and the tuple /i have been removed, the

system will im plem ent u p d atin g the tuple t to become the tuple ti.

T h e a im of R ul e 1 is t o m a in t ai n the d a t a b a s e under cons idera ti on to b e consist ent

with a givcni set F of fmictioiial dep(‘ndeiicies, i.e., Rule 1 ensures th a t u p d a tin g procedure

d o e s not caus e aiiv v i o l a t io n o f F Hence, tho R ul e 1 is said to be coiTPCt if it realizes this

aim.

P r o p o s i t i o n 2 TììC R u l e Ỉ is coiiect.

Proof The proof of (i) is straightforwarcl.

For (ii): L('t / — r \ {f} Rule* 1 shows th at:

- TI k ' h ' is not a n y HV and a n y sv in

- / and r d o v s not caus e any H V of F,

13y a pp licati on OÍ Tlii'oiein 3 to t h e rolatÌDii r and thí' tỉiph' all t h e S V s hetwpeu

r and t can \)V all r em o v e d so that:

( i ) ' ĩ l i o r o n o t ‘A n y H V o f F i l l r '

(ii) Thero is not any HV of F between r and f.

(iii) T hcro is not a n y s v of F in r '

Rule 1 is c'oiK'ct, by HuKHoin 3.Ộ

Algoritlim 4 below uses Rule 1 to u p d a te a tuple t of relation r to become a tuple

A l g o r i t h m 4 Ư P D A T E { ĩ \ F j j i )

I n p u t : r G / ĩ c / |( / ? ) , a livA of caP'Ds F ovf'i /?, a tuple tị over /Ỉ, a tuple t of r that

need to b e u p d a t e d to b e c o m e t h e tupl(' ^1

O u t p u t : U p d ate th e tuple f to become fị if there is not any HV of F t h a t appears

between r \ and ^1, do not u p d a te if otheiwise

Begin

r '

For each A” 4 in F do

For each tuple f in r' do

then

F u n c ti o n a l d e p e n d e n c i e s wi th c o n t e x t d e p e n d e n t null va lu es . ‘23

Ngày đăng: 15/12/2017, 00:49