函数依赖闭包算法_属性的闭包和功能依赖的不可约组

函数依赖闭包算法

属性的闭包 (Closure set of attribute)

It is a linear algorithm. The closure is a set of functional dependency from a given set also known a complete set of functional dependency. Here alpha is set of attributes which are a superkey and we need to find the set of attributes which is functionally determined by alpha.

这是一个线性算法。 闭包是给定集合中的一组功能依赖关系,也称为完整的功能依赖关系集合。 在这里,alpha是一组属性,它们是一个超键,我们需要找到在功能上由alpha确定的属性集。

α ---- > β

α---->β

Example:

例:

Here, we see two different type of problem-related to closure set of the attribute.

在这里,我们看到与属性的闭包相关的两种不同类型的问题。

Ques1: R (A, B, C) set of attribute having A ---- > B, B --- > C transactions.

Ques1:具有A ----> BB ---> C事务的R(A,B,C)属性集。

Find closure of all set of the attribute?

查找所有属性的关闭集?

Solve: Given, transaction

解决:给定交易

    A   --- > B
    B   --- > C
    {A}+	--- >	{A, B, C}
    {B}+	--- >	{B, C}
    {C}+	--- >	{C}

Ques2: R (A, C, D, E, H) set of attribute having two function F & G with some set of attributes F: A --- > C, AC --- > D, E --- > AD, E --- > H and G: A --- > CD, E --- > AH transactions.

Ques2:具有两个函数F&G的 R(A,C,D,E,H)属性集,并具有一些F属性集: A-> CAC-> DE-> ADE-> HGA-> CDE-> AH交易。

Conditions: a) F is the subset of G, b) G is the subset of F, c) F is equal to G, d) F is not equal to G

条件: a) F是G的子集, b) G是F的子集, c) F等于G, d) F不等于G

Find Equivalence Relation?

查找对等关系?

Solve: Given,

解决:鉴于

F:  A  --- > C      G:	A --- > CD
    AC --- > D          E --- > AH
    E  --- > AD		
    E  --- > H

Here, first we find closure of all the attributes:

在这里,首先我们找到所有属性的关闭:

F:  {A}+	--- >	{A, C, D}
    {AC}+	--- >	{A, C, D}
    {E}+	--- >	{A, C, D, E, F}

G:  {A}+	--- >	{A, C, D}
    {E}+	--- >	{A, D, C, E, H}

Now, we check the Conditions:

现在,我们检查条件:

  1. F is the subset of G: True because F & G have {A}+ and{E}+ closure are the same set of attribute where {AC}+closure is same as {A}+ means F is the subset of G.

    F是G的子集:是的,因为F和G具有{A} +和{E} +闭包是同一属性集,其中{AC} +闭包与{A} +相同,这意味着F是G的子集。

  2. G is the subset of F: True, similarly to the first Condition F & G functions all attribute closure are same means G is a subset of F.

    G是F的子集:是的,类似于第一个条件F&G函数,所有属性闭合都是相同的,意味着G是F的子集。

  3. F is equal to G: If F is the subset of G and G is the subset of F means F is equal to G.

    F等于G:如果F是G的子集,而G是F的子集,则意味着F等于G。

  4. F is not equal to G: In the third condition, we have proved F is equal to G. So, this condition is false.

    F不等于G:在第三个条件下,我们证明F等于G。因此,该条件为假。

Hence proved this is an equivalence relation because F is equal to G.

因此证明这是一个等价关系,因为F等于G。

Note: Redundancy (wastage of set of attribute) is also present in closure set of an attribute like AB --- > B (B present both the side known as redundancy).

注意:冗余(属性集的浪费)也出现在属性的闭包集中,例如AB ---> B (B都代表冗余)。

不可约的功能依赖集(规范封面/规范集/规范形式) (Irreducible set of functional dependency (Canonical Cover / Canonical Set / Canonical form))

In an irreducible set of functional dependency, we try to reduce all the transactions to less waste of the set of attributes. We have to follow some steps to decompose the set of the attribute in functional dependency:

在一组不可约的功能依赖关系中,我们尝试减少所有事务,以减少对属性集的浪费。 我们必须遵循一些步骤来分解功能依赖项中的属性集:

  • Decompose all possible right side attribute not left side attribute.

    分解所有可能的右侧属性而不是左侧属性。

  • Find closure of all the transaction after decomposition of attribute including and excluding the same transaction.

    在属性分解后找到所有事务的关闭,包括和排除同一事务。

  • If any changes are done in closure set of the attribute after including and excluding the same transaction; then we can’t ignore the transaction otherwise, we ignore the transaction if the closure of that transaction is same in both cases.

    在包含和排除相同事务之后,如果对属性的闭包进行了任何更改; 那么我们就不能忽略该事务,如果两种情况下该事务的关闭都相同,我们就忽略该事务。

  • Follow this process in all decompose transactions then after check closure of the transactions we have after follow the aforesaid steps; if their closure is different then we can say that the transaction is in a reducible form otherwise, follow the steps again.

    在所有分解的事务中都遵循此过程,然后在检查完事务后按照上述步骤进行操作; 如果它们的关闭方式不同,则可以说交易是可简化的,否则,请再次执行步骤。

Presence and absence of element do not affect the capability of functional dependency.

元素的存在与否不影响功能依赖的能力。


	α ---- > β
	A --- > AB

Example:

例:

Ques:	R (w, x, y, z)
    x  ---> w
    wz --- >xy
    y --- >wxz

Solve: Decompose all the transactions:

解决:分解所有事务:

    x  --- > w
    wz --- > x
    wz --- > y
    y  --- > w
    y  --- > x
    y  --- > z

Now, find closure of all the decompose transactions:

现在,找到所有分解事务的关闭:

1) x --- > w

1)x ---> w

  • Including the transaction

    包括交易

    {x}

    {X}

    +={x,w}

    + = {x,w}

  • Excluding the transaction

    排除交易

    {x}

    {X}

    +={x}

    + = {x}

Closure are different in both cases so we can’t ignore this transaction

两种情况下的关闭方式都不同,因此我们不能忽略此交易

2) wz --- > x

2)wz-> x

  • Including the transaction

    包括交易

    {wz}

    {wz}

    +={x,y,w,z}

    + = {x,y,w,z}

  • Excluding the transaction

    排除交易

    {wz}

    {wz}

    +={w,x,y,z}

    + = {w,x,y,z}

Closure is same in both cases so, we ignore this transaction.

在这两种情况下,关闭都是相同的,因此我们忽略此事务。

3) wz --- > y

3)wz ---> y

  • Including the transaction

    包括交易

    {wz}

    {wz}

    +={x,y,w,z}

    + = {x,y,w,z}

  • Excluding the transaction

    排除交易

    {wz}

    {wz}

    +={w,z}

    + = {w,z}

Closure is different in both cases so, we can’t ignore this transaction.

两种情况下的关闭方式都不同,因此,我们不能忽略此事务。

4) y --- > w

4)y ---> w

  • Including the transaction

    包括交易

    {y}

    {y}

    +={x,y,w,z}

    + = {x,y,w,z}

  • Excluding the transaction

    排除交易

    {y}

    {y}

    +={w,x,y,z}

    + = {w,x,y,z}

Closure are same in both cases so we ignore this transaction.

两种情况下的关闭都相同,因此我们忽略了此事务。

5) y --- > x

5)y ---> x

  • Including the transaction

    包括交易

    {y}

    {y}

    +={x,y,w,z}

    + = {x,y,w,z}

  • Excluding the transaction

    排除交易

    {y}

    {y}

    +={y,z}

    + = {y,z}

Closure are different in both cases so we can’t ignore this transaction.

两种情况下的关闭方式都不相同,因此我们不能忽略此事务。

6) y --- > z

6)y ---> z

  • Including the transaction

    包括交易

    {y}

    {y}

    +={x,y,w,z}

    + = {x,y,w,z}

  • Excluding the transaction

    排除交易

    {y}

    {y}

    +={w,x,y}

    + = {w,x,y}

Closure are different in both cases so we can’t ignore this transaction.

两种情况下的关闭方式都不相同,因此我们不能忽略此事务。

Now, write all the transactions which we can’t ignore:

现在,编写所有我们不能忽略的事务:

    x  --- > w
    wz --- > y
    y  --- > x
    y  --- > z

Find closure of each attribute of wz --- > y for cross check its value are same or different.

查找wz的每个属性的关闭---> y以进行交叉检查,其值相同或不同。

    {wz}+={w,x,y,z}
    {w}+={w}
    {z}+={z}

Closure are different so now we can say that it is in the reducible form. The, the final transactions are:

关闭是不同的,所以现在我们可以说它处于可还原形式。 最终交易是:

    x  --- > w
    wz --- > y
    y  --- > xz

Conclusion:

结论:

In this article, we have learned how to use closure set of attribute and how to reduce the set of the attribute in functional dependency for less wastage of attributes with an example. I hope you understand the concepts of both. if you have any query feel free to ask in the comment section. Have a nice day! Happy Learning!

在本文中,我们通过示例学习了如何使用属性的闭包集以及如何在函数依赖中减少属性的集,以减少属性的浪费 。 希望您理解两者的概念。 如果您有任何疑问,请随时在评论部分提问。 祝你今天愉快! 学习愉快!

翻译自: https://www.includehelp.com/dbms/closure-set-of-attribute-and-irreducible-set-of-functional-dependency.aspx

函数依赖闭包算法

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值