0% found this document useful (0 votes)
202 views

Unit 4 Attribute-Closure

1. A closure of a set of functional dependencies (FDs) is the complete set of all FDs that can be derived from the given set. It is also called the dependency closure. 2. The closure of a set of attributes X under a set of FDs F, written as X+, is the minimum superset of X that contains X and is closed under F (i.e. contains all attributes implied by F). 3. An algorithm for determining the closure X+ of a set of attributes X under a set of FDs F takes X as input, initializes X+ to X, and iteratively adds implied attributes according to F until a fixed point is reached, then returns X

Uploaded by

Subhashree Dash
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
202 views

Unit 4 Attribute-Closure

1. A closure of a set of functional dependencies (FDs) is the complete set of all FDs that can be derived from the given set. It is also called the dependency closure. 2. The closure of a set of attributes X under a set of FDs F, written as X+, is the minimum superset of X that contains X and is closed under F (i.e. contains all attributes implied by F). 3. An algorithm for determining the closure X+ of a set of attributes X under a set of FDs F takes X as input, initializes X+ to X, and iteratively adds implied attributes according to F until a fixed point is reached, then returns X

Uploaded by

Subhashree Dash
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Closures of a set of functional dependencies(dependency closure)

A Closure is a set of FDs is a set of all possible FDs that can be derived from a given set of
FDs. It is also referred as a Complete set of FDs. If F is used to donate the set of FDs for
relation R, then a closure of a set of FDs implied by F is denoted by F+. Let's consider the set
F of  functional dependencies given below:
F = {A -> B, B -> C, C -> D}
from F, it is possible to derive following dependencies.
1.A -> A   ...By using Rule-4, Self-Determination. reflexive
//2.A -> B   ...Already given in F. Given in question
3.A -> C   ...By using rule-3, Transitivity.
4.A -> D   ...By using rule-3, Transitivity.
Now, by applyiing  Rule-6 Union, it is possible to derive A+ -> ABCD and it can be denoted
using 5.A -> ABCD. All such type of FDs derived from each FD of F form a closure of F.

IN THIS WAY WE CAN ALSO DERIVE REST POSSIBLE FDS.

Attribute CLOSUURE

Algorithm : Determining X+, the closure of X under F.


Input : Let F be a set of FDs for relation R.

Steps:
            1. X+ = X //initialize X+ to X
            2. For each FD : Y -> Z in F Do
  If Y ⊆ X+ Then //If Y is contained in X+
+ +
               X =   X ∪ Z //add Z to X+
  End If
  End For
  3. Return  X+ //Return closure of X

Output : Closure  X+ of X under F

Example-
 

Consider a relation R ( A , B , C , D , E , F , G ) with the functional dependencies-

F={A → BC

BC → DE
D→F

CF → G}

Now, let us find the closure of some attributes and attribute sets-

 Q1.find ABC+?

X=ABC-------.I HAVE TO FIND X+=ABC+

ABC+=ABC STEP1

=ABC U BC

=ABC

={ABC} u {DE}

=ABCDE

={ABCDE} U{ F}

=ABCDEF

={ABCDEF}U {G}

=ABCDEFG

FINALLY ABC+?=ABCDEFG

2.Find Closure of attribute A-

A+   = { A }

= { A , B , C }                          ( Using A → BC )

= { A , B , C , D , E }               ( Using BC → DE )

= { A , B , C , D , E , F }          ( Using D → F )

= { A , B , C , D , E , F , G }    ( Using CF → G )

Thus,

A+ = { A , B , C , D , E , F , G }
 

3.Find Closure of attribute D-

D+   = { D }

= { D , F }   ( Using D → F )

We can not determine any other attribute using attributes D and F contained in the result set.

Thus,

D+ = { D , F }

4.FindClosure of attribute set {B, C}-

{ B , C }+= { B , C }

= { B , C , D , E }               ( Using BC → DE )

= { B , C , D , E , F }          ( Using D → F )

= { B , C , D , E , F , G }    ( Using CF → G )

Thus,

{ B , C }+ = { B , C , D , E , F , G }

PRACTICE PROBLEM BASED ON FINDING


CLOSURE OF AN ATTRIBUTE SET-
 

Problem-
 

Consider the given functional dependencies-

AB → CD
AF → D

DE → F

C→G

F→E

G→A

Which of the following options is false?

(A) { CF }+ = { A , C , D , E , F , G }

(B) { BG }+ = { A , B , C , D , G }

(C) { AF }+ = { A , C , D , E , F , G }

(D) { AB }+ = { A , C , D , F ,G }

Solution-
 

Let us check each option one by one-

Option-(A):

{ CF }+  = { C , F }

      = { C , F , G }                     ( Using C → G )

      = { C , E , F , G }               ( Using F → E )

      = { A , C , E , E , F }          ( Using G → A )

      = { A , C , D , E , F , G }    ( Using AF → D )

Since, our obtained result set is same as the given result set, so, it means it is correctly given.
 

Option-(B):

{ BG }+  = { B , G }

      = { A , B , G }                   ( Using G → A )

      = { A , B , C , D , G }        ( Using AB → CD )

Since, our obtained result set is same as the given result set, so, it means it is correctly given.

Option-(C):

{ AF }+  = { A , F }

      = { A , D , F }               ( Using AF → D )

      = { A , D , E , F }          ( Using F → E )

Since, our obtained result set is different from the given result set, so,it means it is not
correctly given.

Option-(D):

{ AB }+  = { A , B }

      = { A , B , C , D }            ( Using AB → CD )

      = { A , B , C , D , G }      ( Using C → G )

Since, our obtained result set is different from the given result set, so,it means it is not
correctly given.
Thus,

Option (C) and Option (D) are correct.

You might also like