• No se han encontrado resultados

Caja con el techo deslizante con saltos discretos

5. Otras simulaciones

5.2 Caja con el techo deslizante con saltos discretos

� 0

The results for strong update anomalies and NLNF are the same as for update anomalies and BCNF in the RDM. In summary, the results obtained for NLNF generalise all results from Theorem 1 .4 for BCNF in the RDM.

3.4 Decomposition into NLNF

So far we have presented the Nested List Normal Form as a goal that is desirable to achieve in the database design process. We now tackle the problem how to actually obtain NLNF. This is an important problem since, in general, it cannot be expected that the first design of a large and complex database schema is already optimised. Having achieved an agreement on a suitable database schema that meets the requirements of all parties involved in the lengthy design process, one wants to avoid starting all over again just to satisfy design criteria. It is much more desirable to provide automatic tools that transform a first design into an equivalent database schema which is in normal form. Of couse, it cannot be expected at all that such tools exist.

There are two competing approaches to relational database design: the

decomposition

approach [70] and the

synthesis

approach [4 1 , 49] . For a discussion and comparison of these two approaches see [102, 181] . In this section, we will focus on applying the decomposition approach to NLNF.

3.4. 1 FDs and Decompositions

The first desirable property of a decomposition in relational databases is that it be a lossless join decomposition with respect to the given set of FDs. Informally, a decomposition

{R1 , . . . , Rn}

of a relation schema

R

is called lossless with respect to a given set E of FDs

on

R

if every relation that satisfies all FDs in E is the natural join of its projections on

the subschemata

Ri,

i.e.,

r

= 7rR1 (r) l><l • • • l><l

nRJr).

This implies that one can project

a relation onto the subschemata and then j oin the projections without losing or adding any information. In order to generalise this desirable property, we define the generalised natural join within our framework.

Definition 3.45. Let

N E

NA and

X, Y E Sub(N) .

Let r1 <;:

dom(X)

and

r2

<;:

dom (Y) .

Then

r1

l><l

r2

=

{ t

E

dam( X

U

Y) I :3t1

E

r1 , t2

E

r2.1r�uY (t)

=

t1

and

n9uY (t)

=

t2}

is called the

generalised natural join r1

l><l

r2 of r1

and

r2.

D

We will now show that any instance

r

<;:

dom (N)

that satisfies an FD

X

-+

Y

on

N

can be decomposed into its projections on

X

U

Y

and

X U

ye without loss of information.

The

projection 1r x ( r)

of

r

<;:

dam ( N)

on

X

E

Sub( N)

is defined as

{ 1r� ( t) I t

E

r}.

Theorem 3.46.

Let N

E N

A, r

<;:

dom (N) and X -+ Y an FD on N. If Fr X -+ Y,

then r

=

nxuy (r)

l><l

nxuyc (r) .

Proof.

One can see that

r

<;:

nxuy (r)

l><l

nxuyc (r)

is always satisfied. Let

t

E

nxuy (r)

l><l

nxuyc (r)

and

Fr X -+ Y.

We show that

t E r.

There are

t�

E

nxuy(r)

and

t;

E

nxuyc (r)

with

t�

=

n�uy(t)

and

t;

=

nfuyc (t).

That means there are

t1 , t2

E

r

with

t�

=

7r�uy(tl)

and

t;

=

nfuyc (t2),

i.e.,

7r�uy(t)

=

7r�uy(ti)

and

nfuyc (t)

=

nfuyc (t2).

In particular,

1r�(ti)

=

1r�(t2)

and as

t1, t2 E r

with

Fr X -+ Y

holds, we conclude

1r

:

(t1 )

=

nP'(t2)

as well. Therefore,

n�uy(ti)

=

7f�uy(t2)

by Lemma 3.9 and therefore also

n�uy (t)

=

7r�uy(t2)·

Since also

nfuyc (t)

=

nfuyc (t2)

holds we conclude

t

=

t2

by Lemma 3.9. This means,

t

E r. D

3.4. DECOMPOSITION INTO NLNF Sebastian Link Theorem 3.46 suggests that the decomposition approach may be successfully applied to the class of FDs in the context of lists. It is important to note that the converse of Theorem 3.46 is wrong. Consider N

= L(A, B, C)

with

r = { (a, b, c) , (a, b', c) }

and different

b, b'

E

dom(B) .

Obviously,

�r L(A) --+ L(B) ,

but 1f£(A,B)

(

r

) = { (a, b, ok) , (a, b', ok) }

and

1fL(A,c)

(

r

) = { (a, ok, c) } ,

i.e.,

r =

1f£(A,B)

(

r

)

txJ 1f£(A,c)

(

r

)

. 3.4.2 The Decomposition Algorithm

Given some nested attribute N and a set E of FDs defined on N, the decomposition approach aims at finding a set of subattributes of N each of which is in NLNF with respect to the corresponding set of all implied FDs on that subattribute. Moreover, any instance of

N

that satisfies all the FDs in E is the generalised natural join of its projections on all the subattributes, i.e. , every valid database on N can be decomposed without loss of information.

Definition 3.47. Let N E N A,

N1 ,

. . . , Nk E

Sub(N) ,

and E a set of FDs defined on N. The set

{ N1 ,

... , Nk

}

is called a

loss less join decomposition of N with respect to

E if and

only if N

= U{N1 ,

... , Nk

}

and

r =

7rN1

(r)

txJ ·•· txJ 7rNk

(

r

)

holds for all

r

dom (N)

with Fr E. The set

{N1 ,

. . . , Nk

}

is called a

lossless NLNF decomposition of

N

with

respect to

E if and only if

{ N1 ,

. . . , Nk

}

is a lossless join decomposition of N with respect to E and Ni is in NLNF with respect to 1fN; (E+) for every

i =

1 ,

. . . , k,

and where

1rM (E)

= {X --+

y E E

I X

u y :S

M}.

D

The lossless join property guarantees that the information of any legal instance over the original nested attribute can be obtained by joining the information on all decomposed subattributes. An NLNF decomposition guarantees moreover that every decomposed sub­ attribute is in NLNF with respect to the projected sets of dependencies.

We will now show that it is possible to obtain a lossless NLNF decomposition for any given nested attribute N and any given set of FDs on N. Whenever an FD in the current state of the output schema violates NLNF, the decomposition algorithm removes the cause for this violation of NLNF by replacing the offending parent subattribute by two of its proper child subattributes which can be joined losslessly to reconstruct their parent.

Algorithm 3.4. 1

(

Lossless NLNF decomposition

)

Input: N E N A, set E of FDs on N

Output: set S = { ( N1 , E1) , •••, (Nk, Ek) } where Ei is set of FDs on Ni E Sub(N)

and {N1, •• •, Nk} is lossless NLNF decomposition of N with respect to E

Method:

VAR

X,

Y E

Sub(N)

( 1 ) BEGIN

(2) IF N in NLNF with respect to E, THEN S : = { (N, E) } ;

(3) ELSE

(4) LET

X �

Y E E be not inevitable on N with respect to E and E

� X �

N; (5) N1

:= X

u Y ; (6) S

:=

DECOMPOSE(N1 ,

7rN1 (E+)) ;

(7) N2

:= X

u ye ; (8) S

:=

S U DECOMPOSE(N2 ,

7rN2 (E+) ) ;

(9) ENDIF; (10) RETURN(S) ; ( 1 1 ) END ;

Theorem 3.48.

Algorithm

3. 4 . 1

is correct.

0

Proof.

The algorithm terminates with an NLNF decomposition. In each decomposition step N1 U N2

=

N, i.e. , N = U { N1 , . . . , Nk } upon termination of the algorithm. Moreover, the algorithm continues the decomposition process whenever Ni is not in NLNF with respect to

1fNi (L'+ ) .

Therefore, { N1 , . . . , Nk} is an NLNF decomposition.

It remains to show that

r = 1fN1 (r)

[X] · · · [X]

1fNk (r)

holds for any

r

� dom(N) with

Fr

E as well. Therefore, we consider the case where

X �

Y is some FD on

M

which is not inevitable on

M

with respect to

7rM(E+)

and where

X

is not a superkey for

M

with respect to

7rM(E+) .

Since

F1rM(r) X �

Y, it follows that

7rM (r) = 7rxuy (7rM (r))

[X]

1fxuyc (7rM (r))

by Theorem 3.46. This, however, is equivalent t o

7rM (r)

=

Jrxuy (r)

[X]

7rxuyc (r) .

This shows

that the NLNF decomposition { N1 , . . . , Nk} is indeed lossless. D

One may replace line (5) of Algorithm 3.4 . 1 by N1

:= X U

yee . This would eliminate those non-maximal basis attributes of N in Y which do not have a superattribute in Y

that is also a maximal basis attribute of N. Such non-maximal basis attributes are also subattributes of ye , anyway. Since

X

� Y is not inevitable, at least one maximal basis

attribute of N is a subattribute of Y by Lemma 3.30, i.e . , yee =!= >.. The resulting algorithm is still correct as yee U ye = N and

Fr X �

Y implies

Fr X �

yee by the subattribute rule as yee :S Y . We illustrate Algorithm 3.4.1 with the following abstract example. We say that a set E of FDs is

covered

by another set fJ of FDs, if every FD in

E

is implied by e.

ExAMPLE 3 . 2 2 . Suppose N

= L(A, K[M(B, C, D)], P[Q[R(E, F)]])

with E

= {L(A) �

L (K[M(B, C)] , P[.A]) , L(K[M(D)]) � L(P[Q[R(E)]] )

} . Obviously, N is not in NLNF with respect to E. Neither of the two given FDs is inevitable nor are the two left­ hand sides superkeys for N with respect to E. We choose to decompose along

L (A) �

L(K[M(B, C)] , P[.A])

and obtain new nested attributes N1

= L(A, K[M(B, C, .A)] , P[.A])

and N'

= L(A, K[M(.A, .A, D)] , P[Q[R(E, F)]]) .

The projection of E on N1 is covered by

L(A)

L(K[M(B, C)] , P[.A]) ,

the projection on N' covered by

{L(K[M(D)]) �

Documento similar