changed 4 years ago
Linked with GitHub
tags: Data Base

第八章: Enhanced Entity-Relationship(EER) Model

  • Specialization 是指不同的 subclass 有各個不同的 characteristics
  • Generalization 是指將一樣的 feature 統合成一個 super class

Representing Specialization in EER Diagrans

Constraints on Specialization and Geralization

  • Predicate-defined(condition-defined) subclass

    ​​​​​​  可以用條件判斷哪些是 super 的 subclass
    
    • Condition 是指 subclass members 的 constraint
  • Attribute-defined Constraints

    ​​​​​​  可以用相同 attribute 來判斷 superclass 的 super attribute
    
  • User-defined Constraints

    • 如果沒有 condition 判斷關係,則 subclass 是 user-defined
  • 有兩種 constraints 可以應用於 specialization 與 generalization :

    • Disjointness:
      • disjoint: 只能是其中一種 subclass
        • 用 d 表示
      • overlapping: 可以是多個 subclass
        • 用 o 表示
    • Completeness:
      • Total:
        • 每個在 superclass 的 entity 都必須是其中某個 subclass
        • 用雙實線代表
      • Partial:
        • 允許 entity 可以不是任何資個 subclass
        • 用單實線代表
      • 用 o 表示(overlapping)

Hierarchies and Lattices

  • Hierarachy: 只能有一個 superclass
    • 又稱 single inheritance
    • 一個 tree structure
  • Lattices: 可以有多個 superclass
    • 又稱 multiple inheritance 或 shared subclass

  • 從上往下 specialization 稱為 top down concetual refinement process
  • 從下往上 genralization 稱為 bottom up cinceotual synthesis process

  • 當 relation 連接 subclass 時,shared subclass 稱為 category 或 UNION TYPE
    • 使用 U 代表

Formal Definitions of EER

  • Specialization Z: Z = \(\{S_1,S_2,...,S_n\}\) 是一個有同樣 superclass G 的 subclasses set

  • G 叫做 subclasses 的 generalization

  • Z \(\in\) Total if \(S_1 \cup S_2 \cup S_3 \cup ... \cup S_n = G\), otherwise, Z is partial

  • Z \(\in\) disjoint if \(S_i \cap S_j\ for\ i \ne j\) otherwise, Z is overlapping

  • Predicate defined: 符合條件 P 在 C 的 attributes S, 以 S = C[p] 表示

  • Attribute-defined specialization: if predicate A = ci, 則屬於某個 subclass

  • 非 predicate defined 者為 user-defined

  • Category: 一個 subset T \(\subset\) (\(D_1 \cup D_2 \cup ... \cup D_n\)), D 為不同 superclass

Design Issues

  • Entity? Attribute?
    • 看語意與企業架構
    • e.g. should Phone be an attribute of Employee or a separate entity?

​​​​只能記錄一次同個 department 的 from 到 to

​​​​能記錄多次同個 department 的 from 到 to    
  • Entity? Relationship?
    • relationship 用於 entity 之間的動作

​​​​重複紀錄太多次 dbudges  

​​​​只要綁定 managers 可以只記錄一次
  • Design Principles
    • specifications
    • 避免 redundancy
    • 保持簡單
    • 選擇正確的元素(entity or relation or attribute)
Select a repo