泛化和特化是增强实体关系图(EER-diagram)
1. 概括:
它的工作原理是自下而上的方法。在泛化中,较低级别的函数被组合成更高级别的函数,称为实体。进一步重复此过程以制作高级实体。
在泛化过程中,属性是从特定实体中提取的,因此我们可以创建泛化实体。我们可以总结泛化过程,因为它组合子类形成超类。
泛化示例 –
考虑两个实体学生和患者。这两个实体将具有自己的一些特征。例如,Student 实体将具有 Roll_No、Name 和 Mob_No,而患者将具有 PId、Name 和 Mob_No 特征。现在在这个例子中,Student 和 Patient 的 Name 和 Mob_No 可以组合为一个 Person 以形成一个更高级别的实体,这个过程称为泛化过程。
2. 专业化:
我们可以说专业化是泛化的对立面。在专业化中,事物被分解为更小的事物以进一步简化。我们也可以说,在专业化中,一个特定的实体被分成子实体,并根据它的特征来完成。在专业化继承中也会发生。
专业化的例子——
考虑一个实体帐户。这将有一些属性考虑它们 Acc_No 和 Balance。帐户实体可能有一些其他属性,如 Current_Acc 和 Savings_Acc。现在Current_Acc 可能有Acc_No、Balance 和Transactions,而Savings_Acc 可能有Acc_No、Balance 和Interest_Rate,此后我们可以说专门实体继承了更高级别实体的特征。
应用泛化和特化后,所得图形的结构是相同的。
泛化和专业化的区别:
GENERALIZATION | SPECIALIZATION |
---|---|
Generalization works in Bottom-Up approach. | Specialization works in top-down approach. |
In Generalization, size of schema gets reduced. | In Specialization, size of schema gets increased. |
Generalization is normally applied to group of entities. | We can apply Specialization to a single entity. |
Generalization can be defined as a process of creating groupings from various entity sets | Specialization can be defined as process of creating subgrouping within an entity set |
In Generalization process, what actually happens is that it takes the union of two or more lower-level entity sets to produce a higher-level entity sets. | Specialization is reverse of Generalization. Specialization is a process of taking a subset of a higher level entity set to form a lower-level entity set. |
Generalization process starts with the number of entity sets and it creates high-level entity with the help of some common features. | Specialization process starts from a single entity set and it creates a different entity set by using some different features. |
In Generalization, the difference and similarities between lower entities are ignored to form a higher entity. | In Specialization, a higher entity is split to form lower entities. |
There is no inheritance in Generalization. | There is inheritance in Specialization. |