Closure of an AttributeClosure of an Attribute: Closure of an Attribute can be defined as a set of attributes that can be functionally determined from it. OR Closure of a set F of FDs is the set F+ of all FDs that can be inferred from F Closure of a set of attributes X concerning F is the set X+ of all attributes that are functionally determined by X Pseudocode to find Closure of an Attribute?Determine X^{+}, the closure of X under functional dependency set F X Closure : = will contain X itself; Repeat the process as: old X Closure : = X Closure; for each functional dependency P → Q in FD set do if X Closure is subset of P then X Closure := X Closure U Q ; Repeat until ( X Closure = old X Closure); Algorithm of Determining X+, the Closure of X under FInput: A set F of FDs on a relation schema R, and a set of attributes X, which is a subset of R. QUESTIONS ON CLOSURE SET OF ATTRIBUTE:1) Given relational schema R( P Q R S T U V) having following attribute P Q R S T U and V, also there is a set of functional dependency denoted by FD = { P>Q, QR>ST, PTV>V }. Determine Closure of (QR)^{+} and (PR)^{+} a) QR+ = QR (as the closure of an attribute or set of attributes contain same). Now as per algorithm look into a set of FD that complete the left side of any FD contains either Q, R, or QR since in FD QR→ST has complete QR. Hence QR+ = QRST Again, trace the remaining two FD that any left part of FD contains any Q, R, S, T. Since no complete left side of the remaining two FD{P>Q, PTV>V} contain Q, R, S, T. Therefore QR+ = QRST (Answer) Note: In FD PTV→V, T is in QRST but that cannot be entertained, as complete PTV should be a subset of QRSTb) PR + = PR (as the closure of an attribute or set of attributes contain same) Now as per algorithm look into a set of FD, and check that complete left side of any FD contains either P, R, or PR. Since in FD P→Q, P is a subset of PR, Hence PR+ = PRQ Again, trace the remaining two FD that any left part of FD contains any P, R, Q, Since, in FD QR → ST has its complete left part QR in PQR Hence PR+ = PRQST Again trace the remaining one FD { PTV>V } that its complete left belongs to PRQST. Since complete PTV is not in PRQST, hence we ignore it. Therefore PR+ = PRQST ( Answer) 2. Given relational schema R( P Q R S T) having following attributes P Q R S and T, also there is a set of functional dependency denoted by FD = { P>QR, RS>T, Q>S, T> P }. Determine Closure of ( T )^{+} T + = T (as the closure of an attribute or set of attributes contain same) Now as per algorithm look into a set of FD that complete the left side of any FD contains T since, in FD T → P, T is in T, Hence T+ = TP Again trace the remaining three FD that any left part of FD contain any TP, Since in FD P → QR has its complete left part P in TP, Hence T+ = TPQR Again trace the remaining two FD { RS>T, Q>S } that any of its Complete left belongs to TPQR, Since in FD Q → S has its complete left part Q in TPQR, Hence T+ = TPQRS Again trace the remaining one FD { RS>T } that its complete left belongs to TPQRS, Since in FD RS → T has its complete left part RS in TPQRS Hence T+ = TPQRS ( no changes, as T, is already in TPQRS) Therefore T+ = TPQRS ( Answer).
Next Topic#
