Generalization and Specialization - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Generalization and Specialization

Description:

Motorcycle. ISA. Nonexclusive, Nonexhaustive Subtypes. ISA. VEHICLE. ISA. ISA. Automobile ... 4-Wheel Drive. ISA. Deciding to use a Super/Subtype ... – PowerPoint PPT presentation

Number of Views:1848
Avg rating:3.0/5.0
Slides: 32
Provided by: busi395
Category:

less

Transcript and Presenter's Notes

Title: Generalization and Specialization


1
Generalization and Specialization
  • Generalization The process of defining a more
    general entity type from a set of more
    specialized entity types.
  • Specialization The process of defining one or
    more subtypes of the supertype, forming
    supertype/subtype relationships.

2
Specialization Example
Start with 1 entity type
3
Specialization Example
Specialize to 1 super and 2 subtypes
4
Generalization Example
Start with 3 entity types
5
Generalization Example
Generalize to 1 entity type with 2 subtypes
6
Supertypes and Subtypes
  • Subtype A subgrouping of the entities in an
    entity type which has attributes that are
    distinct from those in other subgroupings.
  • Supertype An entity type whose subtypes share
    common attributes. Attributes that are shared by
    all entities (including the identifier) are
    associated with the supertype.

7
Example Supertype Subtypes
8
Subtype Entities
  • Supertype entity
  • generic entity thats divided into subtypes
  • Subtype entity
  • subset of a supertype entity that shares common
    attributes or relationships distinct from other
    subsets
  • Exclusive relationship
  • subtypes of a supertype are mutually exclusive,
    and each instance of the supertype is categorized
    as exactly one subtype

9
Example Exclusive Relationship
10
Subtype Entities (contd)
  • Exclusive Subtypes - mutually exclusive subtypes,
    i.e. each instance of the supertype is required
    to be a member of exactly one subtype.
  • Nonexclusive Subtypes - subtypes may overlap, and
    an instance of the supertype may simultaneously
    belong to more than one subtype

11
Subtype Entities (contd)
  • Exhaustive - all subtypes are defined for a
    supertype
  • Nonexhaustive - some (but not all) of the subtype
    have been defined for a supertype. (indicated by
    a blank rectangle)
  • Inheritance the property by which all
    attributes of a supertype become attributes of
    the subtype

12
Exclusive, Nonexhaustive Subtypes
13
Nonexclusive, Nonexhaustive Subtypes
14
Deciding to use a Super/Subtype
  • Use when entity instances share some attributes,
    but some instances
  • have special attributes, and/or
  • are involved in special relationships
  • that other instances do not have/are not involved
    in

15
Attribute Inheritance
  • Subtype entities inherit values of all attributes
    of the supertype.
  • An occurrence of a subtype is also an occurrence
    of the supertype.

16
Use of Supertype/Subtype
  • There are attributes that apply to some (but not
    all) of the instances of an entity type.
  • The instances of a subtype participate in a
    relationship unique to that subtype.

17
Constraints in Supertype/ Subtype Relationships
  • Completeness Constraints
  • Whether an instance of a supertype must also be a
    member of at least one subtype.
  • Total Specialization Rule Yes
  • Partial Specialization Rule No

18
Constraints in Supertype/ Subtype Relationships
  • Disjointness Constraints Whether an instance of
    a supertype may simultaneously be a member of two
    (or more) subtypes.
  • Disjoint Rule No
  • Overlap Rule Yes

19
Total Specialization Disjoint Example
Supertype can only be 1 subtype
Supertype MUST be at least 1 subtype
Special relationship
20
Total Specialization Overlap Example
Supertype can be more than 1 subtype
Special relationship
21
Partial Specialization Example
Supertype does NOT have to be a subtype
22
Domain
  • set of all data types and ranges of values that
    attributes may assume
  • specifies the characteristics of attributes data
    type, length, format, range, allowable values,
    meaning, uniqueness, and null support.

23
Advantages in using Domains
  • Domains verify that the values for an attribute
    are valid
  • Domains ensure that various data manipulation
    operations are logical.
  • Domains help conserve effort in describing
    attribute characteristics.

24
UML
  • UML Unified Modeling Language
  • UML has many components to graphically model
    different aspects of an entire software system
  • UML Class Diagrams correspond to E-R Diagram, but
    several differences.

25
Summary of UML Class Diagram Notation
26
UML Class Diagrams (Contd.)
  • Entity sets are shown as boxes, and attributes
    are shown within the box, rather than as
    separate ellipses in E-R diagrams.
  • Binary relationship sets are represented in UML
    by just drawing a line connecting the entity
    sets. The relationship set name is written
    adjacent to the line.
  • The role played by an entity set in a
    relationship set may also be specified by writing
    the role name on the line, adjacent to the entity
    set.

27
UML Class Diagrams (Contd.)
  • The relationship set name may alternatively be
    written in a box, along with attributes of the
    relationship set, and the box is connected, using
    a dotted line, to the line depicting the
    relationship set.
  • Non-binary relationships drawn using diamonds,
    just as in ER diagrams

28
UML Class Diagram Notation (Cont.)
overlapping
disjoint
Note reversal of position in cardinality
constraint depiction Generalization can use
merged or separate arrows independent of
disjoint/overlapping
29
UML Class Diagrams (Contd.)
  • Cardinality constraints are specified in the form
    l..h, where l denotes the minimum and h the
    maximum number of relationships an entity can
    participate in.
  • Beware the positioning of the constraints is
    exactly the reverse of the positioning of
    constraints in E-R diagrams.

30
UML Class Diagrams (Contd.)
  • The constraint 0.. on the E2 side and 0..1 on
    the E1 side means that each E2 entity can
    participate in at most one relationship, whereas
    each E1 entity can participate in many
    relationships in other words, the relationship
    is many to one from E2 to E1.
  • Single values, such as 1 or may be written on
    edges The single value 1 on an edge is treated
    as equivalent to 1..1, while is equivalent to
    0...

31
SUMMARY
  • This course described the entity- relationship
    (E-R) model and the use of this tool within the
    context of logical data modeling. The model has
    been extended to include constructs such as
    subtypes and supertypes. However, at the present
    time there is no standard notation for E-R
    modeling.
  • The basic constructs of entity-relationship
    modeling are entity types, relationships, and
    associated attributes.
Write a Comment
User Comments (0)
About PowerShow.com