4NF, Multivalued Dependencies without Functional Dependencies

冷暖自知 提交于 2019-12-14 03:05:01

问题


Sorry for asking a question one might consider a basic one)

Suppose we have a relation R(A,B,C,D,E) with multivalued dependencies:

A->>B B->>D.

Relation R doesn't have any functional dependencies. Next, suppose we decompose R into 4NF.

My considerations:

Since we don't have any functional dependencies, the only key is all attributes (A,B,C,D,E). There are two ways we can decompose our relation R:

  1. R1(A,B) R2(A,C,D,E)
  2. R3(B,D) R4(A,B,C,E)

My question is - are these 2 decompositions final? Looks like they are since there are no nontrivial multivalued dependencies left. Or am I missing something?


回答1:


Assuming that the MVDs holding in R are those in the transitive closure of {A ↠ B, B ↠ D} then:

In 1 R1(A,B) R2(A,C,D,E), R = R1 JOIN R2 and both R1 & R2 are in 4NF and the join will always satisfy A ↠ B. But there is still a constraint that B ↠ D in the join that can't be removed by further normalization because neither R1 nor R2 contain both B and D. Ie we can't use an MVD in R2 to express that constraint. We say that the MVD B ↠ D is "not preserved" and the decomposition to R1 & R2 "does not preserve MVDs". Given some alleged values for R1 & R2, to check whether they are sensible in the sense that B ↠ D holds in R we have to check whether R = R1 JOIN R2.

In 2 R3(B,D) R4(A,B,C,E), R = R3 JOIN R4 and both R3 & R4 are in 4NF and the join will always satisfy B ↠ D. But there is still a constraint that A ↠ B in the join. B ↠ D will also be enforced in the join to R if we enforce it in R4. It is enforced when we decompose R4 = BD JOIN ACE. Because the MVDs in the original are enforced by each appearing in a component, we say these decompositions "preserve MVDs". Given some alleged values for R1 & R2, it must be the case that B ↠ D holds in R1 JOIN R2 because R = R1 JOIN R2.

PS 1 The 4NF decomposition must be to three components

MVDs always come in pairs. Suppose MVD X ↠ Y holds in a relation with attributes S, normalized to components XY & X(S-Y). Notice that S-XY is the set of non-X non-Y attributes, and X(S-Y) = X(S-XY). Then there is also an MVD X ↠ S-XY, normalized to components X(S-XY) & X(S-(S-XY)), ie X(S-XY) & XY, ie X(S-Y) & XY. Why? Notice that both MVDs give the same component pair. Ie both MVDs describe the same condition, that S = XY JOIN X(S-XY). So when an MVD holds, that partner holds too. We can write the condition expressed by each of the MVDs using the special explicit & symmetrical notation X ↠ Y | S-XY.

We say a JD (join dependency) of some components of S holds if and only if they join to S. So if S = XY JOIN X(S-Y) = XY JOIN X(S-XY) then the JD *{XY, X(S-XY)} holds. Ie the condition that both MVDs describe is that JD. So a certain MVD and a certain binary JD correspond. That's one way of seeing why normalizing an MVD away involves a 2-way join and why MVDs come in pairs. The JDs that cause a 4NF relation to not be in 5NF are those that do not correspond to MVDs.

Your example involves two MVDs that aren't partners, so you know that the final form of a lossless decomposition will involve two joins, one for each MVD pair.

PS 2 Ambiguity of "Suppose we have a relation with these multi-valued dependencies"

When decomposing per FDs (functional dependencies) we are usually given a canonical/minimal cover for the relation, ie a set in a certain form whose transitive closure under Armstrong's axioms (set of FDs that must consequently hold) holds all the FDs in the relation. This is frequently forgotten when we are told that some FDs hold. We must either be given a canonical/minimal cover for the relation or be given an arbitrary set and be told that the FDs that hold in the relation are the ones in its transitive closure. If we're just given a set of FDs that hold, we know that the ones in its transitive closure hold, but there might be others. So in general we can't normalize.

Here you give some MVDs that hold. But they aren't the only ones, because each has a partner. Moreover others might (and here do) consequently hold. (Eg X ↠ Y and Y ↠ Z implies X ↠ Z-Y holds.) But you don't say that they form a canonical or minimal cover. One way to get a canonical form for MVDs (a unique one per each transitive closure, hopefully more concise!) would be a minimal cover (one that can't lose any MVDs and still have the same transitive closure) augmented by the partner of each MVD. (Whereas for FDs the standard canonical form is minimal.) You also don't say "the MVDs that hold are those in the transitive closure of these". You just say that those MVDs hold. So maybe some not in the transitive closure do too. So your example can't be solved. We can guess that you probably mean that this is a minimal cover. (It's not canonical.) Or that the MVDs that hold in the relation are those in the transitive closure of the given ones. (Which in this case are then a minimal cover.)




回答2:


A Table is in 4NF if and only if, for every one of its non-trivial multivalued dependencies X ->> Y, X is a superkey—that is, X is either a candidate key or a superset.

In your first decomposition(1 with R1 and R2) B->>D is not satisfying so it's not dependency preserving decomposition as well as not in 4NF as A is not superkey in 2nd table.

On the other hand,second decomposition(2 with R3 and R4) is dependency preserving and lossless join with B and ACE as primary key in respective tables but it's not in 4NF because A->>B dependency exists in second table and A is not superkey, you have to decompose second table further in to two tables that can be {A B} and {A C E}.




回答3:


So if I follow your reasoning (suraj3), are R1(A,B) and R2(B,C,D,E) correct decomposition? I think this will preserve the FD B->>D.



来源:https://stackoverflow.com/questions/31342716/4nf-multivalued-dependencies-without-functional-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!