Database Lossless Connection decomposition

Source: Internet
Author: User

The form of lossless connection decomposition is defined as follows: Set R is a relational pattern, and F is a set of function dependencies (FD) on R. R decomposed into database schema Δ={r1,......, Rk}. If each of the R's relationship R satisfies F has the following form:

Then the decomposition δ phase is "lossless connection decomposition" for F, otherwise called "Loss connection decomposition".  which represents a natural connection. From the above-mentioned form definition, if the definition is directly based on whether a decomposition has a non-destructive connectivity, then the "R in each of the relationship R to meet F" to test to see whether the above equation is satisfied, this is obviously not operational, because "each of the R in the relationship R to meet F" test means " It is obviously impossible to test all R "R" that satisfies the f relationship.  The word "relationship" here refers to a specific table. Therefore, other operational methods must be sought to discriminate the non-destructive connectivity of decomposition. 2. Common discriminant method of non-destructive connection decomposition--tabular methodSet the relationship mode r=a1 a decomposition p={r1,..., Rk} of FD set F,r established on the,..., an,r. The steps to determine the non-destructive connection decomposition are as follows: (1) construct a table of k rows n columns, one for each attribute AJ (1≤j≤n), one for each pattern ri (1≤i≤k) for each row.  If AJ is in RI, then fill in the symbol AJ in column J of Table I, otherwise fill in the symbol BIJ. (2) Consider the table as a relationship of mode R, and repeatedly check if each FD in F is set up in the table, and if not, modify the elements in the table. The modification method is as follows: for a fd:x→y in F, if two rows in the table are equal on the X component and not equal on the Y component, then the two lines are changed to equal on the Y component.  If one of the components of Y is AJ, the other changes to AJ, and if there is no AJ, replace the other one with one of the bij (try to change the IJ to a smaller number, i.e. the one with the smaller I value). If in the process of modification, found a row in the table is all a, that is, A1,a2,..., An, then you can immediately conclude that P-phase for F is lossless connection decomposition, at this time no longer need to continue to modify. If the table does not have a row full of a, then the decomposition is lossy, after several modifications until the form cannot be modified.  It is important to note that there is a process of looping over and over again, because one modification can cause the table to continue to be modified. In the process of modification, it is important to note that if a bij is changed, all bij in its column need to be changed accordingly. To make this clear, an example is illustrated. For example, we based on FD "H→i", "
K→l "To modify the table before the table as shown in table 1 (has been modified several times, non-initial table, empty cell representation omitted): Table 1
H I J K L
R1 B12 B35
R2 A1 A2 A4 B25
R3 A1 B12 A4 B35
R4 B12 B35
R2, R3 the H component of the row is A1, according to the FD "H→i", the corresponding I component of the two lines need to be modified, and the R2 row of the I component is A2, so, to the R3 row of the I component B12 to A2, notice that R1, R4 row of the H component is also B12, therefore, The corresponding I component of these two lines must also be modified to A2. R2, R3 the K component of the row is A4, according to the FD "k→l", need to modify the corresponding L component of the two lines, so R3 in the row of L component B35 modified to a smaller b25, while noting that R1, R4 row of the L component is also b35, therefore, The corresponding L component of these two lines must also be modified to B25. The modified table is shown in table 2: Table 2
H I J K L
R1 A2 B25
R2 A1 A2 A4 B25
R3 A1 A2 A4 B25
R4 A2 B25
"Examples" (software Designer 2002 morning test paper)Set the relationship mode R to R (h,i,j,k,l), a function dependency set on R is F={h→j,j→k,i→j,jl→h}, decomposition (38)
is a non-destructive connection. Alternative answers:A. P={hk,hi,ij,jkl,hl} B. P={hil,ikl,ijl} C. P={hj,ik,hl} D. P={hi,jk,hl} Analysis of test questions:Based on the above method, we list the initial table of option B (decomposed into three relational patterns R1 (HIL), R2 (IKL), R3 (IJL)) as shown in Table 3: Table 3, option B, initial table
H I J K L
Hil A1 A2 B13 B14 A5
IKL B21 A2 B23 A4 A5
IJL B31 A2 A3 B34 A5
For the h→j and j→k of the function dependency set, table 3 cannot be modified because there are no identical elements on attribute column H and attribute column J. But for I→j on the 1, 2, and 3 rows corresponding to the attribute column I, the A2 element is all, so the first row of the attribute column J B13 and the second row B23 to A3. The modifications are shown in table 4:

Table 4 Intermediate table for option B

H I J K L
Hil A1 A2 A3 B14 A5
IKL B21 A2 A3 A4 A5
IJL B31 A2 A3 B34 A5
For a function-dependent set of jl→h on Rows 1, 2, and 3 on the attribute column J and L, the A3, A5 elements are the same, so the second row of the attribute column H B21 and the third row B31 to A1. The modifications are shown in table 5: Table 5 result table for option B
H I J K L
Hil A1 A2 A3 B14 A5
IKL A1 A2 A3 A4 A5
IJL A1 A2 A3 B34 A5
As can be seen from table 5, the second behavior A1, A2, A3, A4, A5, so decomposition P is lossless. There is a special case to note: The decomposition of each relationship pattern 22 has no public properties. Because it is a pattern decomposition, the set of properties that are overwritten by any one by one decomposed relational patterns cannot be the entire property of U before decomposition, so there are no rows in the initial table that are all a. It is also noted that the decomposition of each relationship pattern 22 has no public properties, indicating that either row does not have the same component on either column, which causes the entire table to be unmodified and remain in its original state.  And the initial state does not exist all the rows of a, so the decomposition of this particular case is lossy. For example, if a function relies on set FD and the relational mode R (ABCDEF) is decomposed into R1 (AB), R2 (CDE), R3 (F), then this decomposition is certainly lossy. This may happen in exams, so you can determine the results at a glance and save time. 3. Fast Discriminant method for non-destructive connection decompositionFirst of all to affirm that this shortcut method is a prerequisite, the premise is that after the decomposition of the relationship model only two. The content is: set Ρ={R1,R2} is a decomposition of R, F is an FD set on R, then decomposition ρ phase for f is a non-destructive decomposition of the sufficient necessary condition is: (R1∩R2) → (R1–R2) or (r1∩r2) → (r2–r1). This "or" word is very important, here means (r1∩r2) → (R1–R2), (r1∩r2) → (r2–r1) As long as there is a set on the line. The object of the intersection and subtraction operations here is the attribute of the relational schema. "Examples"Relationship mode R (u,f), where u={w,x,y,z},f={wx→y,w→x, x→z,y→w}. Then the following decomposition is non-destructive decomposition is. Alternative answers:A.P={R1 (WY), R2 (XZ)} b.p={r1 (WZ), R2 (XY)} c.p={r1 (WXY), R2 (XZ)} d.p={r1 (WX), R2 (YZ)} Analysis of test questions:A option, R1∩r2 is empty, certainly does not meet the conditions.  The b option, R1∩r2 is empty, certainly does not satisfy the condition.  c option, r1∩r2={x},r1-r2={wy},r2-r1={z}, according to the function dependency set, X→Z is established, so satisfies the condition. d option, R1∩r2 is empty, certainly does not meet the conditions. 4. SummaryThe source of non-destructive discriminant of mode decomposition is still a common tabular method. This quick method is simply inferred from this tabular method and is a special column of it. But this quick approach is often very useful.

Database Lossless Connection decomposition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.