intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Một mô hình dữ liệu với các truy vấn định lượng

Chia sẻ: Nguyễn Minh Vũ | Ngày: | Loại File: PDF | Số trang:8

36
lượt xem
2
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

We extend the relational model of data to consider classes as attribute values, thereby to allow eary and convernient the representation of quantified queries. Facts regarding object classes can be stored and manipulated in the same way as facts regarding object instances. Our model is upwards compatible with the standard relational model

Chủ đề:
Lưu

Nội dung Text: Một mô hình dữ liệu với các truy vấn định lượng

’<br /> Tap ch´ Tin hoc v` Diˆu khiˆn hoc, T.24, S.1 (2008), 42–49<br /> ı<br /> a `<br /> e<br /> e<br /> .<br /> .<br /> .<br /> <br /> ´<br /> ´<br /> ˆ<br /> ˆ INH DU. LIEU DOI VO.I CAC TRUY VAN DINH LU.O.NG<br /> ˜<br /> ˆ<br /> ˆ<br /> ´<br /> ´<br /> ˆ<br /> MOT MO H`<br /> .<br /> .<br /> .<br /> .<br /> ˜<br /> ˆ<br /> NGUYEN KIM ANH<br /> <br /> Khoa Cˆng nghˆ thˆng tin - Tru.o.ng Dai hoc B´ch khoa H` nˆi<br /> o<br /> e o<br /> `<br /> a<br /> a o<br /> .<br /> . .<br /> .<br /> Abstract. We extend the relational model of data to consider classes as attribute values, thereby<br /> to allow eary and convernient the representation of quantified queries. Facts regarding object classes<br /> can be stored and manipulated in the same way as facts regarding object instances. Our model is<br /> upwards compatible with the standard relational model.<br /> ´<br /> ’ o<br /> e a o<br /> T´m t˘t. Ch´ ng tˆi mo. rˆng mˆ h` d˜. liˆu quan hˆ dˆ cho ph´p c´c l´.p nhu. c´c gi´ tri thuˆc<br /> o<br /> a<br /> u<br /> o<br /> o ınh u e<br /> e e<br /> a<br /> a .<br /> o<br /> .<br /> .<br /> . ’<br /> .<br /> ’<br /> ˜ a<br /> ˜ a<br /> ´ .<br /> ’.i vˆy, cho ph´p biˆu diˆn c´c truy vˆn dinh lu.o.ng mˆt c´ch dˆ d`ng v` thuˆn tiˆn ho.n.<br /> t´ v` bo a<br /> ınh a<br /> e<br /> e<br /> e<br /> a<br /> o a<br /> e<br /> a<br /> a<br /> e<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ’<br /> ´<br /> ´<br /> o<br /> C´c su. kiˆn xem x´t c´c l´.p dˆi tu.o.ng c´ thˆ du.o.c lu.u tr˜. v` thao t´c giˆng nhu. c´c su. kiˆn xem<br /> a . e<br /> e a o<br /> o e<br /> u a<br /> a<br /> o<br /> a . e<br /> .<br /> .<br /> .<br /> .<br /> ’ .<br /> ’<br /> ´<br /> x´t c´c thˆ hiˆn dˆi tu.o.ng. Mˆ h` cua ch´ ng tˆi l` tu.o.ng th´ v´.i mˆ h` quan hˆ chuˆ n.<br /> e a<br /> e e o<br /> o ınh ’<br /> u<br /> o a<br /> ıch o<br /> o ınh<br /> e<br /> a<br /> .<br /> .<br /> <br /> ˆ<br /> ´.<br /> 1. GIO I THIEU<br /> .<br /> ´<br /> ’<br /> Ph´p chia l` mˆt ph´p to´n cua dai sˆ quan hˆ thu.c hiˆn mˆt thao t´c kiˆ m tra ch´.a<br /> e<br /> a o<br /> e<br /> a<br /> e .<br /> e<br /> o<br /> a<br /> e’<br /> u<br /> .<br /> . o<br /> .<br /> .<br /> .<br /> . dˆy, mˆt tˆp biˆ u diˆn mˆt nh´m c´c bˆ. Ph´p chia tˆ ng qu´t [5] mo. rˆng<br /> ’<br /> ˜<br /> `<br /> ’ o<br /> tˆp nhiˆu-mˆt, o a<br /> a<br /> e<br /> o ’<br /> o a<br /> e’<br /> e<br /> o<br /> o<br /> a o<br /> e<br /> o<br /> a<br /> .<br /> .<br /> . .<br /> .<br /> .<br /> .<br /> .`.ng v´.i viˆc thu.c hiˆn c´c thao t´c kiˆ m tra ch´.a tˆp nhiˆu-nhiˆu. Ph´p to´n<br /> `<br /> `<br /> ph´p chia thu o<br /> e<br /> o e<br /> e a<br /> a<br /> e’<br /> u a<br /> e<br /> e<br /> e<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .o.ng tu. nhu. ph´p kˆt nˆi ch´.a tˆp dˆi v´.i c´c co. so. d˜. liˆu quan hˆ (CSDL)<br /> ´ ´<br /> ´<br /> ’ u e<br /> e e o<br /> u a<br /> e<br /> n`y c˜ng tu<br /> a u<br /> o o a<br /> .<br /> .<br /> .<br /> .<br /> ’<br /> ’. dang chuˆ n 1. Hiˆn tai, khˆng mˆt ph´p chia n`o du.o.c c`i d˘t tu.`.ng minh trong<br /> khˆng o .<br /> o<br /> a<br /> e .<br /> o<br /> o<br /> e<br /> a<br /> o<br /> .<br /> .<br /> . a a<br /> .<br /> ´<br /> `<br /> ´ e<br /> ’<br /> c´c hˆ quan tri CSDL (DBMS), m˘c d` c´c ph´p to´n n`y giai quyˆt nhiˆu vˆ n dˆ u.ng dung<br /> a e ’<br /> a u a<br /> e<br /> a a<br /> e<br /> e a ` ´<br /> .<br /> .<br /> .<br /> .<br /> .c tiˆn. Nhu. ch´ng ta d˜ biˆt, c´c truy vˆ n dinh lu.o.ng, t´.c<br /> ´<br /> ´<br /> quan trong c´ y ngh˜ trong thu ˜<br /> o´<br /> ıa<br /> e<br /> u<br /> u<br /> a e a<br /> a .<br /> .<br /> .<br /> .<br /> .i lu.o.ng t`. hay han chˆ sˆ dˆu d`i hoi phai thu.c hiˆn mˆt ph´p chia c`ng<br /> ´<br /> ´ ´ e o ’<br /> ’<br /> l` c´c truy vˆ n v´<br /> a a<br /> a o<br /> u<br /> e o `<br /> e<br /> o<br /> e<br /> u<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .i mˆt ph´p kˆt tˆp n`o d´. Nh˜.ng ngu.`.i su. dung b` thu.`.ng hay khˆng chuyˆn nghiˆp<br /> ´ .<br /> o<br /> e e a a o<br /> o ’ .<br /> ınh<br /> o<br /> o<br /> e<br /> e<br /> v´<br /> o<br /> u<br /> .<br /> .<br /> .`.ng rˆ t kh´ kh˘n v` vˆ t va khi phai biˆ u diˆn c´c truy vˆ n dinh lu.o.ng. Ch´ng tˆi cho<br /> ’<br /> ˜ a<br /> ´<br /> ´<br /> ´<br /> ’<br /> thu o<br /> a<br /> o a a a ’<br /> e<br /> e<br /> a .<br /> u<br /> o<br /> .<br /> `<br /> ´<br /> r˘ ng, c´c u.ng dung quan tˆm dˆn lu.o.ng t`. s˜ ng`y c`ng t˘ng lˆn trong mˆt tu.o.ng lai khˆng<br /> a<br /> a ´<br /> a<br /> u e a a<br /> a<br /> e<br /> o<br /> o<br /> e<br /> .<br /> .<br /> .<br /> ´<br /> ’ o<br /> xa. B`i b´o n`y dˆ cˆp dˆn viˆc mo. rˆng mˆ h` d˜. liˆu quan hˆ cho ph´p c´c l´.p nhu. c´c<br /> a a a ` a e<br /> e .<br /> e<br /> o ınh u e<br /> e<br /> e a o<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .i vˆy, cho ph´p biˆ u diˆn c´c truy vˆ n dinh lu.o.ng mˆt c´ch dˆ d`ng<br /> ˜ a<br /> ˜ a<br /> ´<br /> gi´ tri thuˆc t´ v` bo a<br /> a .<br /> o ınh a ’ .<br /> e<br /> e’<br /> e<br /> a .<br /> o a<br /> e<br /> .<br /> .<br /> .<br /> .n.<br /> v` thuˆn tiˆn ho<br /> a<br /> a<br /> e<br /> .<br /> .<br /> . phˆn cˆ p du.o.c xem nhu. mˆt k˜ thuˆt cˆ u tr´c d˜. liˆu rˆ t phˆ biˆn. C´c cˆ u tr´c<br /> ’ ´<br /> ´<br /> ´<br /> ´<br /> Su<br /> a a<br /> o y<br /> a a<br /> u u e a<br /> o e<br /> a a<br /> u<br /> .<br /> .<br /> .<br /> . ´<br /> .<br /> . ngh˜ dˆi v´.i viˆc quan l´ c´c thˆng tin ph´.c<br /> ˜<br /> ´<br /> ´<br /> ’ y a<br /> cˆy cung cˆ p mˆt k˜ thuˆt biˆ u diˆn gi`u ng˜<br /> a<br /> a<br /> o y<br /> a<br /> e’<br /> e<br /> a<br /> u<br /> ıa o o e<br /> o<br /> u<br /> .<br /> .<br /> .<br /> . phˆn cˆ p c˜ng d˜ du.o.c dˆ nghi trong ng˜. canh thiˆt kˆ CSDL nhu. mˆt k˜ thuˆt<br /> ´<br /> ´ ´<br /> tap. Su<br /> a a u<br /> a<br /> e<br /> u ’<br /> e e<br /> o y<br /> a<br /> .<br /> .<br /> . `<br /> .<br /> .<br /> .<br /> ’u diˆn tri th´.c thˆ gi´.i thu.c. Trong b`i b´o n`y, ch´ng tˆi cˆ g˘ng du.a kh´i niˆm phˆn<br /> ˜<br /> ´<br /> ´ ´<br /> biˆ<br /> e<br /> e<br /> u<br /> e o<br /> a a a<br /> u<br /> o o a<br /> a e<br /> a<br /> .<br /> .<br /> ´<br /> cˆ p l´.p v`o mˆ h` quan hˆ thˆng qua viˆc cho ph´p c´c l´.p du.o.c su. dung nhu. c´c gi´ tri<br /> a o<br /> a<br /> o ınh<br /> e o<br /> e<br /> e a o<br /> a<br /> a .<br /> .<br /> .<br /> . ’ .<br /> .a v`o kh´i niˆm kh˘ng dinh ˆm<br /> ’<br /> thuˆc t´ trong mˆt quan hˆ. D˘c biˆt, ch´ng tˆi c˜ng du a<br /> o ınh<br /> o<br /> e<br /> a<br /> e<br /> u<br /> o u<br /> a e<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> . a<br /> ’<br /> dˆ cho ph´p c´c ngoai lˆ du.o.c xay ra. Hai ph´p to´n m´.i du.o.c yˆu cˆu l`: ph´p nh´m dˆ<br /> e’<br /> e a<br /> e<br /> e<br /> a<br /> o<br /> e ` a<br /> a<br /> e<br /> o<br /> e’<br /> . .<br /> .<br /> .<br /> <br /> ´<br /> ´<br /> ˆ<br /> ˆ INH DU. LIEU DOI VO.I CAC TRUY VAN DINH LU.O.NG<br /> ˜<br /> ˆ<br /> ˆ<br /> ´<br /> ´<br /> ˆ<br /> MOT MO H`<br /> .<br /> .<br /> .<br /> .<br /> <br /> 43<br /> <br /> `<br /> ’<br /> e’<br /> gˆp nhiˆu bˆ cua quan hˆ v`o mˆt v`i bˆ do.n v` ph´p mo. nh´m dˆ thu du.o.c mˆt thˆ hiˆn<br /> o<br /> e o ’<br /> e a<br /> o a o<br /> a e<br /> o<br /> o<br /> e’ e<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> . liˆu thu du.o.c l` tu.o.ng th´ v´.i mˆ h` quan hˆ chuˆ n.<br /> ’<br /> `<br /> ’ ’<br /> a<br /> ıch o<br /> o ınh<br /> e<br /> a<br /> dˆy du cua quan hˆ. Mˆ h` d˜ e<br /> a<br /> e<br /> o ınh u .<br /> .<br /> .<br /> .<br /> `<br /> ´<br /> ’ .<br /> C´c CSDL dang tˆ n tai c´ thˆ tiˆp tuc du.o.c su. dung theo mˆ h` cua ch´ng tˆi v` y ngh˜<br /> a<br /> o . o e’ e .<br /> o ınh ’<br /> u<br /> o a´<br /> ıa<br /> .<br /> .`.ng khˆng hˆ thay dˆ i.<br /> ’<br /> `<br /> ’ a<br /> cua c´c ph´p to´n quan hˆ thˆng thu o<br /> e<br /> a<br /> e o<br /> o<br /> e<br /> o<br /> .<br /> .u thˆ c´ thˆ dat du.o.c nh`. viˆc khai th´c su. phˆn cˆ p trong biˆ u diˆn d˜. liˆu [1].<br /> ˜ u e<br /> ´<br /> ´<br /> `<br /> e o e’ .<br /> o e<br /> a .<br /> a a<br /> e’<br /> e<br /> Nhiˆu u<br /> e<br /> .<br /> .<br /> .<br /> ’ lu.u tr˜. chı mˆt bˆ do.n v´.i tˆn cua l´.p dˆ thay thˆ cho nhiˆu bˆ v´.i c´c<br /> ’<br /> ´<br /> `<br /> ’ o<br /> Ch´ng ta c´ thˆ<br /> u<br /> o e<br /> u ’ o o<br /> o e<br /> e<br /> e<br /> e o o a<br /> .<br /> .<br /> .<br /> ’<br /> ´<br /> th`nh viˆn cˆ u th`nh nˆn l´.p d´. Mˆ h` d˜. liˆu du.o.c tr` b`y trong b`i b´o n`y c´ thˆ<br /> a<br /> e a<br /> a<br /> e o<br /> o<br /> o ınh u e<br /> ınh a<br /> a a a o e<br /> .<br /> .<br /> ’<br /> ´<br /> o<br /> e<br /> a a<br /> a a<br /> o<br /> o ınh<br /> e<br /> a o .<br /> xem nhu. mˆt giao diˆn cung cˆ p c´c thao t´c bˆc cao so v´.i mˆ h` quan hˆ chuˆ n v´.i su.<br /> .<br /> .<br /> .<br /> .<br /> . cua phˆn cˆ p c´c l´.p dˆi tu.o.ng. Viˆc cung cˆ p c´c thao t´c bˆc cao cho ph´p ngu.`.i<br /> ˜<br /> ´<br /> ´<br /> ´<br /> hˆ tro ’<br /> o .<br /> a a a o<br /> o<br /> e<br /> a a<br /> a a<br /> e<br /> o<br /> .<br /> .<br /> .<br /> .n gian ho.n v´.i ´ thao t´c ho.n v` ho.n n˜.a,<br /> ˜ a<br /> ´<br /> ’<br /> d`ng c´ thˆ biˆ u diˆn c´c truy vˆ n mˆt c´ch do<br /> u<br /> o e’ e’<br /> e<br /> a<br /> o a<br /> o ıt<br /> a<br /> a<br /> u<br /> .<br /> .o.c d´nh gi´ hiˆu qua ho.n.<br /> ´<br /> ’<br /> a e<br /> c´c truy vˆ n du . a<br /> a<br /> a<br /> .<br /> .o.c tr` b`y nhu. sau: phˆn 2 mo. dˆu v´.i mˆt sˆ kh´i niˆm co. ban<br /> `<br /> ’ `<br /> ’<br /> Nˆi dung b`i b´o du .<br /> o<br /> a a<br /> ınh a<br /> a<br /> a o<br /> o o a e<br /> . ´<br /> .<br /> .<br /> . liˆu mo. rˆng dˆi v´.i CSDL quan hˆ. Phˆn 3 tr` b`y c´c<br /> ´<br /> `<br /> ’ o<br /> v` dinh ngh˜ mˆt mˆ h` d˜ e<br /> a .<br /> ıa o<br /> o ınh u .<br /> o o<br /> e<br /> a<br /> ınh a a<br /> .<br /> .<br /> .<br /> ’<br /> ˜ a<br /> ´ dˆi v´.i mˆ h` d˜. liˆu mo. rˆng v` phˆn 4 biˆ u diˆn c´c truy vˆ n dinh<br /> ´ o<br /> `<br /> ´ .<br /> ’ o<br /> ph´p to´n dai sˆ o<br /> e<br /> a<br /> o ınh u e<br /> a a<br /> e<br /> e<br /> a<br /> . o<br /> .<br /> .<br /> ´<br /> ´<br /> `<br /> ’ .<br /> ’ o<br /> lu.o.ng su. dung c´c ph´p to´n dai sˆ cua mˆ h` d˜. liˆu mo. rˆng. Cuˆi c`ng, phˆn 5 du.a ra<br /> a<br /> e<br /> a<br /> o ınh u e<br /> o u<br /> a<br /> .<br /> . o ’<br /> .<br /> .<br /> ´ a<br /> mˆt v`i d´nh gi´ v` kˆt luˆn.<br /> o a a<br /> a a e<br /> .<br /> .<br /> ’<br /> ˆ INH DU. LIEU MO. RONG<br /> ˜<br /> ˆ<br /> ˆ<br /> 2. MO H`<br /> .<br /> .<br /> ´<br /> ´<br /> ’<br /> Tru.´.c tiˆn, ch´ng tˆi nh˘c lai ng˘n gon mˆt sˆ kh´i niˆm co. ban. Cho mˆt tˆp c´c<br /> o<br /> e<br /> u<br /> o<br /> a .<br /> a<br /> o o<br /> e<br /> o a a<br /> .<br /> . ´ a<br /> .<br /> . .<br /> ˜i thuˆc t´ Ai du.o.c kˆt ho.p v´.i mˆt miˆn Di v´.i<br /> ´ .<br /> `<br /> thuˆc t´ N = {A1, A2, ..., An}, mˆ<br /> o ınh<br /> o<br /> o ınh<br /> e<br /> o<br /> o<br /> e<br /> o<br /> .<br /> .<br /> .<br /> .<br /> `<br /> i = 1...n. K´ hiˆu D ∗ l` t´ Dˆ-c´c cua c´c miˆn. Mˆt quan hˆ x´c dinh trˆn tˆp thuˆc t´<br /> ı e<br /> a ıch ` a ’ a<br /> e<br /> e<br /> o<br /> e a .<br /> e a<br /> o ınh<br /> .<br /> .<br /> .<br /> .<br /> .<br /> {A1 , A2 , ..., An} l` mˆt tˆp con n`o d´ cua D ∗ v` mˆt bˆ cua quan hˆ l` mˆt ´nh xa t`. N<br /> a o a<br /> a o ’<br /> a o o ’<br /> e a o a<br /> . .<br /> .<br /> .<br /> .<br /> .<br /> . u<br /> ∗.<br /> ´<br /> dˆn D<br /> e<br /> ´<br /> ’<br /> ’ a<br /> Dˆi v´.i mˆt sˆ miˆn cua thuˆc t´<br /> o o<br /> o o `<br /> o ınh, d˘c biˆt l` miˆn cua c´c thuˆc t´ kh´a hay c´c<br /> a<br /> e a `<br /> e<br /> o ınh o<br /> a<br /> . ´ e<br /> .<br /> .<br /> .<br /> .<br /> .o.ng, ch´ng tˆi x´c dinh mˆt tˆp c´c miˆn con cua n´ u.ng v´.i<br /> ´<br /> `<br /> ’<br /> thuˆc t´ dinh danh dˆi tu .<br /> o ınh .<br /> o<br /> u<br /> o a .<br /> o a a<br /> e<br /> o ´<br /> o<br /> .<br /> . .<br /> . phˆn nh´m c´c dˆi tu.o.ng du.o.c x´c dinh b´.i thuˆc t´ n`y v` xˆy du.ng mˆt cˆ u<br /> ´<br /> ´<br /> mˆt su<br /> o .<br /> a<br /> o<br /> a o<br /> a .<br /> o<br /> o ınh a a a<br /> o a<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ´ ´<br /> `<br /> ´<br /> tr´c phˆn cˆ p dˆi v´.i c´c miˆn con hay c´c l´.p dˆi tu.o.ng n`y. Mˆt l´.p, theo ch´ng tˆi, l`<br /> u<br /> a a o o a<br /> e<br /> a o<br /> o<br /> a<br /> o o<br /> u<br /> o a<br /> .<br /> .<br /> .n gian l`<br /> ´<br /> ’ a<br /> ’<br /> mˆt tˆp C sao cho C ⊆ D(D l` miˆn cua thuˆc t´<br /> o a<br /> a `<br /> e<br /> o ınh). Ch´ng tˆi s˜ viˆt ∀C hay do<br /> u<br /> o e e<br /> . .<br /> .<br /> . gi´ tri cua thuˆc t´ n`y trong mˆt bˆ, diˆu n`y c´ ngh˜ l` quan hˆ phai ch´.a moi<br /> ’<br /> C nhu a . ’<br /> o ınh a<br /> o o `<br /> e a o<br /> ıa a<br /> e<br /> u<br /> .<br /> . .<br /> .<br /> .<br /> .ng v´.i mˆi gi´ tri x m` x ∈ C v´.i c´c gi´ tri trˆn c´c thuˆc t´ kh´c vˆn gi˜. nguyˆn.<br /> ˜<br /> ˜<br /> bˆ u<br /> o´<br /> o<br /> o a .<br /> a<br /> o a<br /> a . e a<br /> o ınh a a<br /> u<br /> e<br /> .<br /> .<br /> ´<br /> ´ ´<br /> `<br /> ´<br /> Cˆ u tr´c phˆn cˆ p dˆi v´.i mˆt miˆn D l` mˆt cˆ u tr´c cˆy v´.i gˆc cua cˆy ch´ l` miˆn D<br /> a<br /> u<br /> a a o o o<br /> e<br /> a o a<br /> u a o o ’ a<br /> ınh a `<br /> e<br /> .<br /> . ´<br /> . mˆt l´.p tˆ ng qu´t ho.n dˆn c´c l´.p d˘c biˆt ho.n cua n´. C´c gi´ tri thuˆc<br /> ’<br /> ´ a o<br /> ’ o a<br /> v` c´c canh di t` o o o<br /> a a .<br /> u .<br /> a<br /> e<br /> a<br /> e<br /> a .<br /> o<br /> .<br /> .<br /> .<br /> ´ o o<br /> ´<br /> ’ o<br /> D l` c´c l´.p chı c´ duy nhˆ t mˆt dˆi tu.o.ng v` du.o.c d˘t o. c´c n´t l´ cua cˆy.<br /> a a o<br /> a<br /> a<br /> a ’ a u a ’ a<br /> .<br /> .<br /> .<br /> .<br /> ’<br /> ´<br /> ´ ´<br /> ´<br /> ´<br /> ´<br /> ´ a<br /> Bˆ t kˆ mˆt cˆ g˘ng n`o dˆi v´.i viˆc tˆ ng qu´t h´a tri th´.c thˆ gi´.i thu.c tˆ t s˜ thˆ y cˆn<br /> a e’ o o a<br /> a o o e o<br /> a o<br /> u<br /> e o<br /> .<br /> .<br /> . a e a `<br /> .a v`o c´c ngoai lˆ. Mˆ h` d˜. liˆu cua ch´ng tˆi c˜ng cho ph´p mˆt dang ngoai lˆ thˆng<br /> ’<br /> du a a<br /> o ınh u e<br /> u<br /> o u<br /> e<br /> o .<br /> . e<br /> .<br /> .<br /> .<br /> . e o<br /> .<br /> .p mˆi bˆ v´.i mˆt gi´ tri chˆn l´. Mˆt bˆ du.o.c goi l` bˆ du.o.ng hay kh˘ng<br /> ˜ .<br /> ’<br /> ´<br /> qua viˆc kˆt ho<br /> e e .<br /> o o o<br /> o<br /> a . a y<br /> o o<br /> a o<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .o.ng nˆu gi´ tri chˆn l´ cua bˆ l` ‘true’ (d´ng), ngu.o.c lai, bˆ v´.i gi´ tri chˆn l´ ‘false’<br /> ´<br /> dinh du<br /> e<br /> a . a y ’ o a<br /> u<br /> o o a . a y<br /> .<br /> .<br /> . .<br /> .<br /> .o.c goi l` bˆ ˆm hay kh˘ng dinh ˆm. Tˆ t nhiˆn, c´c kh˘ng dinh ˆm u.ng v´.i c´c<br /> ’<br /> ’<br /> ´<br /> (sai) s˜ du .<br /> e<br /> a<br /> a<br /> e<br /> a<br /> a<br /> o a<br /> . a oa<br /> .<br /> . a<br /> . a ´<br /> . kiˆn khˆng tˆ n tai trong CSDL. V´.i su. c´ m˘t cua c´c kh˘ng dinh ˆm, mˆt bˆ x v´.i c´c<br /> ` .<br /> ’<br /> ’ a<br /> su e<br /> o<br /> o<br /> o . o a<br /> a<br /> o o<br /> o a<br /> . .<br /> .<br /> . a<br /> .<br /> .<br /> `<br /> ´<br /> ’<br /> gi´ tri nguyˆn tˆ du.o.c ch´.a trong mˆt bˆ du.o.ng cua quan hˆ chı l` d´ng khi khˆng tˆ n tai<br /> a .<br /> e o<br /> u<br /> o o<br /> e ’ a u<br /> o<br /> o .<br /> .<br /> .<br /> .<br /> .<br /> <br /> 44<br /> <br /> ˜<br /> ˆ<br /> NGUYEN KIM ANH<br /> <br /> ’<br /> ’<br /> u<br /> ıa o<br /> a<br /> a e<br /> mˆt kh˘ng dinh ˆm ch´.a x. Ch´ng ta c´ thˆ du.a ra mˆt dinh ngh˜ tˆ ng qu´t cho kh´i niˆm<br /> o<br /> a<br /> u<br /> o e’<br /> o .<br /> . a<br /> .<br /> .<br /> .<br /> . liˆu mo. rˆng nhu. sau.<br /> ’ o<br /> quan hˆ nh´m trong mˆ h` d˜ e<br /> e o<br /> o ınh u .<br /> .<br /> .<br /> ˜<br /> Dinh ngh˜ 1. Cho mˆt tˆp c´c thuˆc t´ N = {A1, A2, ..., An}, mˆi thuˆc t´ Ai du.o.c<br /> ıa<br /> o a a<br /> o ınh<br /> o<br /> o ınh<br /> . .<br /> .<br /> .<br /> .<br /> .<br /> `<br /> ´ o o a<br /> ´<br /> ´<br /> ´t ho.p v´.i mˆt miˆn Di v` c´ thˆ c´ mˆt cˆ u tr´c phˆn cˆ p HDi v´.i i = 1..n. K´ hiˆu<br /> o<br /> o<br /> e<br /> a o e<br /> u<br /> a a<br /> o<br /> ı e<br /> kˆ .<br /> e<br /> .<br /> .<br /> .<br /> +<br /> +<br /> ´t ca c´c n´t cua HDi dˆi v´.i c´c thuˆc t´ Ai c´ cˆ u tr´c phˆn cˆ p, Di = Di<br /> ´ o a<br /> ´<br /> ´<br /> ’ a u ’<br /> Di l` tˆp tˆ<br /> a a a<br /> o<br /> o ınh<br /> o a<br /> u<br /> a a<br /> .<br /> .<br /> ´<br /> ´<br /> ´<br /> dˆi v´.i c´c thuˆc t´ Ai khˆng c´ cˆ u tr´c phˆn cˆ p, T F = { true , f alse } v` k´ hiˆu D∗<br /> o o a<br /> o ınh<br /> o<br /> o a<br /> u<br /> a a<br /> a ı e<br /> .<br /> .<br /> +<br /> `<br /> l` t´ Dˆ-c´c cua c´c miˆn Di v` T F . Mˆt quan hˆ nh´m R x´c dinh trˆn tˆp thuˆc t´<br /> a ıch ` a ’ a<br /> e<br /> e<br /> a<br /> o<br /> e o<br /> a .<br /> e a<br /> o ınh<br /> .<br /> .<br /> .<br /> .<br /> a o o ’<br /> e a o a<br /> {A1 , A2 , ..., An, T } l` mˆt tˆp con n`o d´ cua D ∗ v` mˆt bˆ cua quan hˆ l` mˆt ´nh xa t`.<br /> a o a<br /> a o ’<br /> .<br /> .<br /> .<br /> .<br /> . u<br /> . .<br /> ∗ v´.i T ∈ N l` tˆn cua thuˆc t´<br /> ’ sung dˆ lu.u tr˜. gi´ tri chˆn l´ cua bˆ.<br /> ’<br /> ´<br /> N ∪ T dˆn D o<br /> e<br /> a e ’<br /> o ınh bˆ<br /> o<br /> e<br /> u a . a y ’ o<br /> .<br /> .<br /> ´ ´<br /> ’<br /> ´<br /> ´<br /> ´<br /> ˆ ˆ<br /> ´.<br /> ˆ INH DU. LIEU MO. RONG<br /> ˜<br /> ˆ<br /> ˆ<br /> 3. CAC PHEP TOAN DAI SO DOI VO I MO H`<br /> .<br /> .<br /> .<br /> `<br /> ’<br /> Trong phˆn tru.´.c, ch´ng ta d˜ du.a ra kh´i niˆm quan hˆ nh´m, mˆt su. mo. rˆng cua kh´i<br /> a<br /> o<br /> u<br /> a<br /> a e<br /> e o<br /> o . ’ o<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .`.ng ho.p tˆ t ca c´c thuˆc t´ cua mˆt quan hˆ nh´m dˆu<br /> `<br /> ´<br /> e’<br /> e<br /> niˆm quan hˆ kinh diˆ n. Trong tru o<br /> e<br /> e<br /> a ’ a<br /> o ınh ’<br /> o<br /> e o<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ´ u<br /> ´<br /> khˆng c´ cˆ u tr´c phˆn cˆ p v` gi´ tri chˆn l´ cua moi bˆ trong quan hˆ dˆu l` ’true’ th` quan<br /> o<br /> o a<br /> a a a a . a y ’<br /> o<br /> e ` a<br /> e<br /> ı<br /> . .<br /> .<br /> .i viˆc bˆ sung thˆm thuˆc t´ T nhˆn gi´ tri<br /> ’<br /> e o<br /> e<br /> o ınh<br /> a<br /> a .<br /> hˆ nh´m n`y ch´ l` quan hˆ kinh diˆ n v´<br /> e o<br /> a<br /> ınh a<br /> e<br /> e’ o<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .i moi bˆ cua quan hˆ. Ch´ng tˆi goi quan hˆ nh´m n`y l` quan hˆ nh´m nguyˆn<br /> ´<br /> ’true’ dˆi v´<br /> o o<br /> e<br /> u<br /> o .<br /> e o<br /> a a<br /> e o<br /> e<br /> . o ’<br /> .<br /> .<br /> .<br /> .<br /> ´ v` quan hˆ nh´m nguyˆn tˆ sau khi bo di thuˆc t´ T l` quan hˆ nguyˆn tˆ. Nhu. vˆy, c´<br /> ´<br /> ´<br /> ’<br /> a o<br /> tˆ a<br /> o<br /> e o<br /> e o<br /> o ınh<br /> a<br /> e<br /> e o<br /> .<br /> .<br /> .<br /> .<br /> ’ xem quan hˆ kinh diˆ n l` mˆt tru.`.ng ho.p d˘c biˆt cua quan hˆ nh´m tˆ ng qu´t. Trong<br /> ’ a o<br /> ’<br /> ’<br /> thˆ<br /> e<br /> e<br /> e<br /> o<br /> a<br /> e<br /> e o<br /> o<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> `<br /> ´<br /> phˆn n`y, ch´ng tˆi s˜ du.a ra c´c ph´p to´n dai sˆ trˆn mˆ h` mo. rˆng n`y. Hai ph´p to´n<br /> a a<br /> u<br /> o e<br /> a<br /> e<br /> a<br /> o e<br /> o ınh ’ o<br /> a<br /> e<br /> a<br /> .<br /> .<br /> .i: ph´p nh´m v` ph´p mo. nh´m l` cˆn thiˆt dˆ dinh ngh˜ c´c ph´p to´n dai sˆ trˆn c´c<br /> ´<br /> ´<br /> ’<br /> m´<br /> o<br /> e<br /> o<br /> a e<br /> o a `<br /> a<br /> e e’ .<br /> ıa a<br /> e<br /> a<br /> . o e a<br /> .o.ng du.o.ng v´.i mˆt quan hˆ nguyˆn<br /> ˜<br /> ’<br /> quan hˆ nh´m. Ch´ y r˘ ng, mˆi quan hˆ nh´m phai tu<br /> e o<br /> u´ `<br /> a<br /> o<br /> e o<br /> o<br /> o<br /> e<br /> e<br /> .<br /> .<br /> .<br /> .<br /> .i c´c cˆ u tr´c phˆn cˆ p d˜ cho. C´ ngh˜ l`, c´ mˆt mˆ h` duy nhˆ t v´.i<br /> ´<br /> ´ ´<br /> ´<br /> ´<br /> ´<br /> tˆ duy nhˆ t dˆi v´ a a<br /> o<br /> a o o<br /> u<br /> a a a<br /> o<br /> ıa a o o o ınh<br /> a o<br /> .<br /> ´ (c´c gi´ tri thuˆc miˆn gˆc cua thuˆc t´<br /> `<br /> ´ ’<br /> ’<br /> c´c gi´ tri nguyˆn tˆ a<br /> a<br /> a .<br /> e o<br /> a .<br /> o<br /> e o<br /> o ınh) thoa m˜n quan hˆ d˜ cho.<br /> a<br /> e a<br /> .<br /> .<br /> .<br /> ’ o<br /> ´t kˆ n´ du.o.c thu.c hiˆn<br /> e<br /> Mˆt ph´p to´n n`o d´ trˆn c´c quan hˆ nh´m s˜ c´ c`ng t´c dˆng bˆ e<br /> o<br /> e<br /> a a o e a<br /> e o<br /> e o u<br /> a o<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ´<br /> trˆn c´c quan hˆ nh´m hay trˆn c´c quan hˆ nguyˆn tˆ tu.o.ng du.o.ng. Theo ngh˜ n`y, ng˜.<br /> e a<br /> e o<br /> e a<br /> e<br /> e o<br /> ıa a<br /> u<br /> .<br /> .<br /> .`.ng ho.p v´.i c´c quan<br /> ’<br /> ’<br /> ngh˜ cua c´c ph´p to´n quan hˆ l` khˆng bi thay dˆ i ngay ca trong tru o<br /> ıa ’ a<br /> e<br /> a<br /> e a o<br /> o<br /> o a<br /> .<br /> .<br /> .<br /> hˆ nh´m.<br /> e o<br /> .<br /> Dˆ tr` b`y c´c ph´p to´n trˆn c´c quan hˆ nh´m, tru.´.c tiˆn, ch´ng tˆi tr` b`y mˆt<br /> e’ ınh a a<br /> e<br /> a<br /> e a<br /> e o<br /> o<br /> e<br /> u<br /> o ınh a<br /> o<br /> .<br /> .<br /> .n gian cho ph´p dich mˆt tˆp c´c gi´ tri trong mˆt D+ v´.i HD tu.o.ng u.ng<br /> ’<br /> thuˆt to´n kh´ do<br /> a<br /> a<br /> a<br /> e .<br /> o a a<br /> a .<br /> o<br /> o<br /> ´<br /> . .<br /> .<br /> .<br /> ’<br /> ’<br /> cua mˆt thuˆc t´ A n`o d´ th`nh c´c l´.p tˆ ng qu´t ho.n trong HD v` cho ph´p c´ ngoai<br /> o<br /> o ınh<br /> a o a<br /> a o o<br /> a<br /> a<br /> e o<br /> .<br /> .<br /> .<br /> .i c´c loai cˆu truy vˆ n dinh lu.o.ng kh´c nhau, ch´ng ta c´ thˆ su. dung c´c thuˆt to´n<br /> ’ ’ .<br /> ´ .<br /> a<br /> a<br /> u<br /> o e<br /> a<br /> a<br /> a<br /> lˆ. V´ a<br /> e o<br /> .<br /> . a<br /> .<br /> .<br /> .i c´c tiˆu ch´ nh´m kh´c nhau. O. dˆy, ch´ng tˆi chı quan tˆm dˆn c´c truy<br /> ’ a<br /> ´ a<br /> ’<br /> dich kh´c nhau v´ a e<br /> a<br /> o<br /> ı o<br /> a<br /> u<br /> o<br /> a<br /> e<br /> .<br /> ´<br /> ´<br /> ’<br /> vˆ n v´.i lu.o.ng t`. ∀ v` bo.i vˆy, tiˆu ch´ nh´m cua ch´ng tˆi l` nh´m tˆ t ca c´c n´t du.o.ng<br /> a o<br /> u<br /> a ’ a<br /> e<br /> ı o<br /> u<br /> o a o<br /> a ’ a u<br /> .<br /> .<br /> ´<br /> ´<br /> ’<br /> ’<br /> c´ c`ng cha lai khi sˆ c´c ngoai lˆ hay c´c n´t ˆm cua ch´ng l` nho ho.n. Trong thu.c tˆ, v´.i<br /> o u<br /> o a<br /> a u a<br /> u<br /> a<br /> .<br /> . e<br /> .<br /> . e o<br /> . phˆn nh´m c´c dˆi tu.o.ng ho.p l´, sˆ c´c ngoai lˆ thu.`.ng l` kh´ nho hay thu.c chˆ t l`<br /> ´<br /> ´<br /> ´<br /> ’<br /> mˆt su a<br /> o .<br /> o<br /> a o<br /> o<br /> a a<br /> a a<br /> .<br /> .<br /> . y o a<br /> . e<br /> .<br /> .<br /> ’.<br /> khˆng d´ng kˆ<br /> o<br /> a<br /> e<br /> ´<br /> `<br /> ´<br /> Cho mˆt thuˆc t´ A du.o.c kˆt ho.p v´.i miˆn D c´ mˆt cˆ u tr´c phˆn cˆ p HD v` S ⊂ D+<br /> o<br /> o ınh<br /> e<br /> o o a<br /> a a<br /> a<br /> .<br /> .<br /> . e . o<br /> . ´ u<br /> .i D+ - k´ hiˆu tˆp tˆ t ca c´c n´t cua HD .<br /> v´<br /> o<br /> ı e a a ’ a u ’<br /> . . ´<br /> ’<br /> Thuˆt to´n 1. T´ c´c l´.p tˆ ng qu´t cua S ⊂ D+ v` c´c ngoai lˆ.<br /> a<br /> a<br /> ınh a o o<br /> a ’<br /> a a<br /> . e<br /> .<br /> .<br /> <br /> ´<br /> ´<br /> ˆ<br /> ˆ INH DU. LIEU DOI VO.I CAC TRUY VAN DINH LU.O.NG<br /> ˜<br /> ˆ<br /> ˆ<br /> ´<br /> ´<br /> ˆ<br /> MOT MO H`<br /> .<br /> .<br /> .<br /> .<br /> <br /> 45<br /> <br /> `<br /> ´<br /> ´<br /> V`o: Thuˆc t´ A, miˆn D, cˆ u tr´c phˆn cˆ p HD v` S ⊂ D+ .<br /> a<br /> o ınh<br /> e<br /> a<br /> u<br /> a a<br /> a<br /> .<br /> .p (S) v` N gL(S).<br /> Ra: T´ L´<br /> ınh o<br /> a<br /> C´ch t´<br /> a<br /> ınh:<br /> ´<br /> ´<br /> ’<br /> o o<br /> • T` n´t cha chung nho nhˆ t cua S dˆi v´.i HD v` k´ hiˆu n´t n`y l` Rt.<br /> ım u<br /> a ’<br /> a ı e u a a<br /> .<br /> ´ a<br /> ’ a HD v´.i n´t gˆc l` Rt v` c´c n´t l´ l` c´c n´t ho˘c thuˆc S ho˘c l` c´c<br /> • K´ hiˆu cˆy con cu<br /> ı e a<br /> o u o<br /> a a u a a a u<br /> a<br /> o<br /> a a a<br /> .<br /> .<br /> .<br /> .<br /> ’ a u<br /> n´t anh em cua c´c n´t trong S l` T.<br /> u<br /> a<br /> ´<br /> a<br /> a a u a<br /> o<br /> a<br /> • D´nh dˆ u c´c n´t l´ thuˆc S l` +<br /> .<br /> ´<br /> • D´nh dˆ u c´c n´t l´ khˆng thuˆc S l` −<br /> a<br /> a a u a o<br /> o<br /> a<br /> .<br /> +<br /> ˜<br /> ´<br /> ´<br /> ’<br /> ’<br /> o o<br /> o u<br /> ı e a<br /> o .<br /> a<br /> a ı e<br /> a<br /> • Dˆi v´.i mˆi n´t trong N cua T , k´ hiˆu cˆy con cua T gˆc tai N l` TN v` k´ hiˆu SN l`<br /> .<br /> .<br /> .o.c d´nh dˆ u +, S − l` tˆp c´c n´t l´ du.o.c d´nh dˆ u - dˆi v´.i T . T´<br /> ´<br /> ´<br /> ´<br /> tˆp c´c n´t l´ du .<br /> a a u a<br /> a<br /> a<br /> a<br /> a<br /> o o N<br /> ınh<br /> .<br /> . a u a<br /> .<br /> N a a<br /> +<br /> −<br /> .o.c goi l` n´t tˆt, ngu.o.c lai du.o.c goi l` n´t<br /> ´<br /> x = |SN | v` y = |SN |. Mˆt n´t N c´ x > y du .<br /> a<br /> o u<br /> o<br /> .<br /> . a u o<br /> . .<br /> .<br /> . a u<br /> `<br /> tˆ i.<br /> o<br /> +<br /> −<br /> ’ .<br /> • D˘t N := Rt. Goi thu tuc Chon (N, TN , SN , SN )<br /> a<br /> .<br /> .<br /> .<br /> +<br /> −<br /> ’ .<br /> • Thu tuc chon n´t Chon (N, TN , SN , SN ):<br /> . u<br /> .<br /> +<br /> +<br /> ´<br /> ´<br /> a<br /> ı o<br /> 1) Nˆu N l` n´t l´ v` du.o.c d´nh dˆ u + th` L´.p(SN ) = N, N gL(SN ) = ∅<br /> e<br /> a u a a<br /> . a<br /> ’<br /> ´<br /> ´<br /> ´<br /> ´<br /> 2) Nˆu N l` n´t tˆt c´ m con tru.c tiˆp l` N1, N2, ...., Nm v` khˆng mˆ t t´ tˆ ng qu´t,<br /> e<br /> a u o o<br /> e a<br /> a o<br /> a ınh o<br /> a<br /> .<br /> . N , N , ...., N l` c´c n´t tˆ i v` N , N , ...., N l` c´c n´t tˆt.<br /> ` a k+1 2<br /> ´<br /> ’ ’<br /> gia su 1 2<br /> u o<br /> u o<br /> k a a<br /> m a a<br /> k<br /> k<br /> .i x = |S + | v` y = |S − | th` L´.p(S + ) = N, N gL(S +) =<br /> ´<br /> ı o<br /> Nˆu 1+ 1 yi < m−k+ 1 xi v´ i<br /> e<br /> o<br /> Ni a i<br /> Ni<br /> N<br /> N<br /> −<br /> ´t th´c.<br /> SN v` kˆ<br /> a e<br /> u<br /> +<br /> −<br /> +<br /> Ngu.o.c lai, thu.c hiˆn Chon (Ni, TN i, SN i, SN i) v´.i i = 1..m v` d˘t L´.p(SN ) = ∪m<br /> e<br /> o<br /> a a o<br /> . .<br /> .<br /> .<br /> .<br /> .<br /> 1<br /> +<br /> +<br /> +<br /> L´.p(SN i), N gL(SN ) = ∪m N gL(SN i).<br /> o<br /> 1<br /> +<br /> −<br /> `<br /> ´<br /> ´<br /> e<br /> 3) Nˆu N l` n´t tˆ i c´ m con tru.c tiˆp l` N1 , N2, ...., Nm, thu.c hiˆn Chon(Ni, TN i, SN i, SN i)<br /> e<br /> a u o o<br /> . e a<br /> .<br /> .<br /> .<br /> +<br /> +<br /> +<br /> +<br /> v´.i i = 1..m v` d˘t L´.p(SN ) = ∪m L´.p(SN i), N gL(SN ) = ∪m N gL(SN i).<br /> o<br /> a a o<br /> o<br /> .<br /> 1<br /> 1<br /> +<br /> +<br /> • D˘t L´.p(S) = L´.p(SRt) v` N gL(S) = N gL(SRt)<br /> a o<br /> o<br /> a<br /> .<br /> `<br /> ´<br /> `<br /> ´<br /> Mˆnh dˆ 1. Cho mˆt thuˆc t´ A du.o.c kˆt ho.p v´.i miˆn D c´ mˆt cˆ u tr´c phˆn cˆ p<br /> e<br /> e<br /> o<br /> o ınh<br /> e .<br /> o<br /> e<br /> o o a<br /> u<br /> a a<br /> .<br /> .<br /> .<br /> . ´<br /> .<br /> + . K´ hiˆu DTu.o.ng (S) l` tˆp tˆ t ca c´c dˆ i tu.o.ng thuˆc c´c l´.p trong S th`<br /> ´<br /> a a a ’ a o<br /> o a o<br /> ı<br /> HD v` S ⊂ D<br /> a<br /> ı e<br /> .<br /> . ´<br /> .<br /> .<br /> .<br /> .o.ng (S) = DTu.o.ng (L´.p(S)) \ DTu.o.ng (NgL(S)).<br /> DTu .<br /> o<br /> .<br /> .<br /> .ng minh. Dˆ thˆ y, do cˆ u tr´c phˆn cˆ p H , tˆp tˆ t ca c´c dˆi tu.o.ng thuˆc mˆt l´.p<br /> ˜ a<br /> ´<br /> ´<br /> ´<br /> ´<br /> Ch´<br /> u<br /> e ´<br /> a<br /> u<br /> a a<br /> a a ’ a o<br /> o<br /> o o<br /> D<br /> .<br /> .<br /> .<br /> .<br /> .p cua tˆp tˆ t ca c´c dˆi tu.o.ng thuˆc c´c l´.p con cua n´. Bo.i vˆy, ch´ng ta c´<br /> ´<br /> ´<br /> ’ a a ’ a o<br /> ’<br /> ’ a<br /> ch´ l` ho<br /> ınh a .<br /> o a o<br /> o<br /> u<br /> o<br /> .<br /> .<br /> .<br /> .<br /> .o.ng (L´.p(S )) = DTu.o.ng (S ) ∪DTu.o.ng (N gL(S)). Ho.n n˜.a, DTu.o.ng (S) v` DTu.o.ng<br /> DTu .<br /> o<br /> u<br /> a<br /> .<br /> .<br /> .<br /> .<br /> ’<br /> (N gL(S)) l` r`.i nhau. Do vˆy, ta c´ diˆu phai ch´.ng minh.<br /> a o<br /> a<br /> o `<br /> e<br /> u<br /> .<br /> . nh´m: Cho quan hˆ nh´m R(X, Y, T ) v´.i c´c thuˆc t´ A ∈ Y du.o.c kˆt ho.p v´.i<br /> ´<br /> ’<br /> Ph´p mo<br /> e<br /> o<br /> e o<br /> o a<br /> o ınh<br /> o<br /> .<br /> .<br /> . e .<br /> .o.c kˆt<br /> `<br /> ´<br /> ´<br /> mˆt miˆn D v` c´ mˆt cˆ u tr´c phˆn cˆ p HD v` c´c thuˆc t´ thuˆc X khˆng du .<br /> o<br /> e<br /> a o o a<br /> u<br /> a a<br /> a a<br /> o ınh<br /> o<br /> o<br /> e<br /> .<br /> . ´<br /> .<br /> .<br /> .p v´.i mˆt cˆ u tr´c phˆn cˆ p n`o. X ho˘c Y c´ thˆ b˘ ng ∅ nhu.ng XY = ∅.<br /> ’ `<br /> ´<br /> ho o o a<br /> u<br /> a a a<br /> a<br /> o e a<br /> .<br /> . ´<br /> .<br /> . Y = {A , A , ..., A }, v[Y ] = (C , C , ..., C ) v` mˆt bˆ nguyˆn tˆ t[Y ] =<br /> ´<br /> ’ ’<br /> Gia su<br /> a o o<br /> e o<br /> 1<br /> 2<br /> k<br /> 1<br /> 2<br /> k<br /> .<br /> .<br /> .i c ∈ D - miˆn cua A . Ch´ng ta viˆt t[Y ] ∈ v[Y ] nˆu v´.i i = 1..k th`<br /> `<br /> ´<br /> ´ o<br /> ’<br /> (c1 , c2 , ..., ck) v´ i<br /> o<br /> e<br /> u<br /> e<br /> e<br /> ı<br /> i<br /> i<br /> ´ o<br /> ’. nh´m dˆi v´.i quan hˆ nh´m R, k´ hiˆu l` Mo.Nh´m(R) du.o.c dinh ngh˜<br /> ’ o<br /> ci ∈ Ci . Ph´p mo<br /> e<br /> o<br /> o<br /> e o<br /> ı e a<br /> ıa<br /> .<br /> .<br /> .<br /> .<br /> nhu. sau:<br /> ’ o<br /> Mo.Nh´m(R) = {t[XY ]/∃v ∈ R(t[X] = v[X] ∧ t[Y ] = y ∧ y ∈ v[Y ] ∧ v[T ] = ‘true ∧ ∃v ∈<br /> <br /> 46<br /> <br /> ˜<br /> ˆ<br /> NGUYEN KIM ANH<br /> <br /> R (v [X] = v[X] ∧ v [T ] = ‘f alse ∧ y ∈ v [Y ]))}.<br /> ´<br /> ´<br /> ’<br /> ’ . e<br /> ’ a o<br /> Ch´ ´: Ph´p mo. nh´m tra lai kˆt qua l` mˆt quan hˆ nguyˆn tˆ thˆng thu.`.ng, quan hˆ chı<br /> uy<br /> e<br /> o<br /> e<br /> e o o<br /> o<br /> e ’<br /> .<br /> .<br /> .<br /> .a c´c gi´ tri nguyˆn tˆ v` khˆng ch´.a thuˆc t´ T lu.u gi´ tri chˆn l´ cua bˆ. Ho.n n˜.a,<br /> ´<br /> ch´ a<br /> u<br /> a .<br /> e o a o<br /> u<br /> o ınh<br /> a . a y ’ o<br /> u<br /> .<br /> .<br /> .Nh´m dam bao mˆi quan hˆ nh´m l` tu.o.ng du.o.ng v´.i mˆt quan hˆ nguyˆn tˆ<br /> ˜<br /> ´<br /> ’<br /> ’<br /> ’<br /> ph´p to´n Mo o<br /> e<br /> a<br /> o<br /> e o a<br /> o o<br /> e<br /> e o<br /> .<br /> .<br /> .<br /> .i c´c cˆ u tr´c phˆn cˆ p d˜ cho.<br /> ´ ´<br /> ´<br /> ´<br /> duy nhˆ t dˆi v´ a a<br /> a o o<br /> u<br /> a a a<br /> Ph´p nh´m: Cho mˆt quan hˆ nh´m R x´c dinh trˆn tˆp thuˆc t´ U v´.i mˆt thuˆc t´<br /> e<br /> o<br /> o<br /> e o<br /> a .<br /> e a<br /> o ınh<br /> o<br /> o<br /> o ınh<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ´<br /> `<br /> ´<br /> ´<br /> e .<br /> o o<br /> e<br /> a o o a<br /> u<br /> a a<br /> ı e<br /> A ∈ U n`o d´ du.o.c kˆt ho.p v´.i mˆt miˆn D v` c´ mˆt cˆ u tr´c phˆn cˆ p HD . K´ hiˆu R+<br /> a o<br /> .<br /> .<br /> .<br /> .<br /> ’<br /> ’<br /> l` tˆp c´c bˆ du.o.ng cua R v` R l` tˆp c´c bˆ ˆm cua R. Ph´p nh´m quan hˆ nh´m R theo<br /> a a a o<br /> a<br /> a a a oa<br /> e<br /> o<br /> e o<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ıa<br /> thuˆc t´ A, k´ hiˆu l` Nh´mA (R) du.o.c dinh ngh˜ nhu. sau:<br /> o ınh<br /> ı e a<br /> o<br /> . .<br /> .<br /> .<br /> Nh´mA (R+ ) = {t/(v ∈ R+ (t[U \T A] = v[U \T A] ∧ ((t[A] = {C/∃C ∈ L´.p (S)} ∧ t[T ] =<br /> o<br /> o<br /> .i c´c v ∈ R+ thoa<br /> ’<br /> ‘true ) ∨ (t[A] = {C/∃C ∈ N gL(S)} ∧ t[T ] = ‘f alse )) ∧ S = ∪v[A] v´ a<br /> o<br /> t[U \A] = v[U \A])}.<br /> Nh´mA (R) = Nh´mA (R+ ) ∪ R− .<br /> o<br /> o<br /> <br /> ´ ´<br /> `<br /> ´<br /> Ch´ ´: Trong qu´ tr` nh´m, ch´ng ta luˆn cˆ g˘ng nh´m nhiˆu nhˆ t c´ thˆ c´c l´.p con<br /> uy<br /> a ınh o<br /> u<br /> o o a<br /> o<br /> e<br /> a o e’ a o<br /> .o.ng th`nh mˆt l´.p tˆ ng qu´t ho.n v´.i viˆc chˆ p<br /> ’<br /> ´ e<br /> ´<br /> ’ a o<br /> xuˆ t hiˆn trong thuˆc t´ A cua c´c bˆ du<br /> a<br /> o ınh<br /> a<br /> o o o<br /> a<br /> o e<br /> a<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ’ e a a o<br /> ´ ngoai lˆ khˆng d´ng kˆ nˆn tˆp c´c bˆ thuˆc Nh´mA (R+ ) v` R− l` r`.i nhau.<br /> nhˆn mˆt sˆ<br /> a<br /> o o<br /> a<br /> e<br /> o<br /> o<br /> a<br /> a o<br /> .<br /> .<br /> . e o<br /> .<br /> .<br /> .<br /> .<br /> `<br /> `<br /> ’<br /> ’<br /> Mˆnh dˆ 2. Ph´p to´n Nh´m bao to`n nˆi dung thˆng tin cua quan hˆ nh´m ban dˆu.<br /> e<br /> e<br /> e<br /> a<br /> o<br /> a<br /> o<br /> o<br /> e o<br /> a<br /> .<br /> .<br /> .<br /> ´<br /> ´<br /> C´ ngh˜ l` v´.i mˆt quan hˆ nh´m R v` mˆt thuˆc t´ A c´ mˆt cˆ u tr´c phˆn cˆ p th`<br /> o<br /> ıa a o<br /> o<br /> e o<br /> a o<br /> o ınh<br /> o o a<br /> u<br /> a a<br /> ı<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .Nh´m(Nh´mA(R)) = Mo.Nh´m(R).<br /> ’<br /> ’ o<br /> Mo o<br /> o<br /> ´<br /> ’<br /> ’ o<br /> Ch´.ng minh. Theo dinh ngh˜ cua c´c ph´p to´n Mo.Nh´m, Nh´m v` t´ d´ng d˘n cua<br /> u<br /> ıa ’ a<br /> e<br /> a<br /> o<br /> a ınh u<br /> a<br /> .<br /> .o.c kh˘ng dinh trong mˆnh dˆ 1, mˆi bˆ x v´.i c´c gi´ tri nguyˆn tˆ thuˆc<br /> ˜ o<br /> ’<br /> ´<br /> `<br /> a<br /> a .<br /> e o<br /> o<br /> Thuˆt to´n 1 du .<br /> a<br /> a<br /> e<br /> e<br /> o .<br /> o a<br /> .<br /> .<br /> .<br /> .<br /> ’.Nh´m(Nh´mA (R)) c˜ng thuˆc Mo.Nh´m(R) v` ngu.o.c lai.<br /> ’ o<br /> Mo o<br /> o<br /> u<br /> o<br /> a<br /> .<br /> . .<br /> ´<br /> ’<br /> Hˆ qua 1. Cho R l` quan hˆ nh´m nguyˆn tˆ v` mˆt thuˆc t´ A c´ mˆt cˆ u tr´c phˆn<br /> e<br /> a<br /> e o<br /> e o a o<br /> o ınh<br /> o o a<br /> u<br /> a<br /> .<br /> .<br /> .<br /> . ´<br /> .<br /> .i R th` Mo.Nh´m(Nh´mA(R)) = R’.<br /> ´<br /> ´ ´<br /> cˆ p. Goi R’ l` quan hˆ nguyˆn tˆ dˆi v´<br /> a<br /> a<br /> e<br /> e o o o<br /> ı ’ o<br /> o<br /> .<br /> .<br /> ´<br /> `<br /> e u e<br /> Hˆ qua 1 du.o.c suy ra tru.c tiˆp t`. Mˆnh dˆ 2.<br /> e ’<br /> e<br /> .<br /> .<br /> .<br /> .<br /> ´ ´<br /> Ph´p kˆt nˆi tu. nhiˆn: Cho hai quan hˆ nh´m R(U ) v` S(V ) v´.i U ∩ V = Y Z v` Y =<br /> e e o .<br /> e<br /> e<br /> o<br /> a<br /> o<br /> a<br /> .<br /> .o.c kˆt ho.p v´.i mˆt miˆn Di v` c´ mˆt cˆ u tr´c<br /> ´ .<br /> `<br /> ´<br /> {A1 , A2 , ..., Ak}. C´c thuˆc t´ Ai ∈ Y du . e<br /> a<br /> o ınh<br /> o<br /> o<br /> e<br /> a o o a<br /> u<br /> .<br /> .<br /> .<br /> ´<br /> ´<br /> ´<br /> phˆn cˆ p HDi, i = 1..k. C´c thuˆc t´ thuˆc Z khˆng du.o.c kˆt ho.p v´.i mˆt cˆ u tr´c phˆn<br /> a a<br /> a<br /> o ınh<br /> o<br /> o<br /> e .<br /> o o a<br /> u<br /> a<br /> .<br /> .<br /> .<br /> .<br /> ´<br /> ´ ´<br /> cˆ p n`o. Z c´ thˆ b˘ ng ∅ v` k c´ thˆ b˘ ng 0. Ph´p kˆt nˆi tu. nhiˆn cua 2 quan hˆ nh´m R<br /> a a<br /> o e’ `<br /> a<br /> a<br /> o e’ `<br /> a<br /> e e o .<br /> e ’<br /> e o<br /> .<br /> .o.c dinh ngh˜ nhu. sau:<br /> v` S , k´ hiˆu l` R ∗ S du . .<br /> a<br /> ı e a<br /> ıa<br /> .<br /> R ∗ S = {t[U V ]/∃u ∈ R∃v ∈ S(t[U \Y T ] = u[U \Y T ] ∧ t[V \Y T ] = v[V \Y T ] ∧ (t[Ai ] =<br /> ’ a<br /> u[Ai ] ∩ v[Ai], i = 1..k) ∧ t[T ] = u[T ] ∗ v[T ]}, o. dˆy ‘true ∗ ‘true = ‘true v` ‘true ∗ ‘f alse =<br /> a<br /> ‘f alse ∗ ‘true = ‘f alse .<br /> ´<br /> ´<br /> Ph´p chiˆu: Cho quan hˆ nh´m R(X, Y, T ) v´.i c´c thuˆc t´ A ∈ Y du.o.c kˆt ho.p v´.i mˆt<br /> e<br /> e<br /> e o<br /> o a<br /> o ınh<br /> o o<br /> .<br /> .<br /> . e .<br /> .<br /> .o.c kˆt ho.p v´.i<br /> `<br /> ´<br /> ´<br /> ´<br /> miˆn D v` c´ mˆt cˆ u tr´c phˆn cˆ p HD v` c´c thuˆc t´ thuˆc X khˆng du . e .<br /> e<br /> a o o a<br /> u<br /> a a<br /> a a<br /> o ınh<br /> o<br /> o<br /> o<br /> .<br /> .<br /> .<br /> ´ a<br /> ´<br /> mˆt cˆ u tr´c phˆn cˆ p n`o. X v` Y c´ thˆ b˘ ng ∅. Ch´ng tˆi dinh ngh˜ hai ph´p chiˆu<br /> o a<br /> u<br /> a a<br /> a<br /> o e’ `<br /> a<br /> u<br /> o .<br /> ıa<br /> e<br /> e<br /> . ´<br /> ´u: Π0 l` ph´p chiˆu v´.i tˆp thuˆc<br /> ´ o a<br /> trˆn quan hˆ nh´m R phu thuˆc v`o tˆp thuˆc t´ chiˆ<br /> e<br /> e o<br /> o a a<br /> o ınh<br /> e<br /> a e<br /> e<br /> o<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> .<br /> ´u chı liˆn quan dˆn c´c thuˆc t´ khˆng c´ cˆ u tr´c phˆn cˆ p v` Π1 l` ph´p chiˆu<br /> ´ a<br /> ´<br /> ´ a<br /> ´<br /> ’ e<br /> t´ chiˆ<br /> ınh<br /> e<br /> e<br /> o ınh o<br /> o a<br /> u<br /> a a<br /> a e<br /> e<br /> .<br /> ´<br /> ´<br /> ´<br /> ´<br /> v´.i tˆp thuˆc t´ chiˆu c´ liˆn quan dˆn c´c thuˆc t´ c´ cˆ u tr´c phˆn cˆ p.<br /> o a<br /> o ınh<br /> e o e<br /> e a<br /> o ınh o a<br /> u<br /> a a<br /> .<br /> .<br /> .<br /> <br />
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2