130 likes | 145 Views
IT 5433 LM2. ER & EER Model. Learning Objectives:. Explain importance of data modeling Define and use the entity-relationship model Define E/R terms Describe the enhanced E/R model Describe how super types and sub-types are modeled Explain when you would use an enhanced E/R model.
E N D
IT 5433 LM2 ER & EER Model
Learning Objectives: • Explain importance of data modeling • Define and use the entity-relationship model • Define E/R terms • Describe the enhanced E/R model • Describe how super types and sub-types are modeled • Explain when you would use an enhanced E/R model
What is Data Modeling? • Data modeling is the act of exploring data-oriented structures. • Data models can be used for a variety of purposes, from high-level conceptual models to physical data models. • With data modeling you identify entity types whereas with class modeling you identify classes. • Data attributes are assigned to entity types just as you would assign attributes and operations to classes. • Traditional data modeling is different from class modeling because it focuses solely on data – class models allow you to explore both the behavior and data aspects of your domain, with a data model you can only explore data issues. http://www.agiledata.org/essays/dataModeling101.html
Three Basic Styles of Data Model: • Conceptual - sometimes called domain models, are typically used to explore domain concepts with project stakeholders. • Logical (LDM)- logical data model, used to explore the domain concepts, and their relationships, of your problem domain. • Physical (PDM)- physical data model, used to design the internal schema of a database, depicting the data tables, the data columns of those tables, and the relationships between the tables. http://www.agiledata.org/essays/dataModeling101.html
Data Model: • An entity type represents a collection of similar objects. Each entity type will have one or more data attributes. http://www.agiledata.org/essays/dataModeling101.html
Entity-Relationship (ER) Model • E-R Model captures meanings rather than an actual implementation • The E-R Model is viewed as set of: • Entities • Relationships among entities • Symbols used in E-R Diagram • Entity – (rectangle) an object that is involved in the enterprise and that be distinguished from other objects • Attribute – (oval) describes one aspect of an entity type. • Relationship – (diamond) • Link – (line) http://jcsites.juniata.edu/faculty/rhodes/dbms/ermodel
Entity-Relationship (ER) Model • Keys • Superkey: an attribute or set of attributes that uniquely identifies an entity • Composite key: a key requiring more than one attribute • Candidate key: a superkey such that no proper subset of its attributes is also a superkey (minimal superkey – has no unnecessary attributes) • Primary key: the candidate key chosen to be used for identifying entities and accessing records. Unless otherwise noted "key" means "primary key" • Alternate key: a candidate key not used for primary key • Secondary key: attribute or set of attributes commonly used for accessing records, but not necessarily unique • Foreign key: term used in relational databases (but not in the E-R model) for an attribute that is the primary key of another table and is used to establish a relationship with that table where it appears as an attribute also. http://jcsites.juniata.edu/faculty/rhodes/dbms/ermodel
Enhanced Entity-Relationship (EER) Model • One entity type might be a subtype of another. • A relationship exists between a entity and the corresponding entity is called IsA. • Type Hierarchy: • Covering constraint: Union of subtype entities is equal to set of supertype entities. An entity is an element of at least one subtype • Disjointnessconstraint: Sets of subtype entities are disjoint from one another (i.e., the sets are mutually exclusive). An entity can be an element of at most one entity http://jcsites.juniata.edu/faculty/rhodes/dbms/eermodel
IsA • Typically used in databases to be implemented as Object Oriented Models. • The upper entity type is the more abstract entity type (supertype) from which the lower entities inherit its attributes http://jcsites.juniata.edu/faculty/rhodes/dbms/eermodel
Super Types and Sub-Types Inheritance - All attributes of the supertype apply to the subtype. • The subtype inherits all attributes of its supertype. • The key of the supertype is also the key of the subtype Transitivity - This property creates a hierarchy of IsA relationships Example: Student is subtype of Person, Freshman is subtype of Student, therefore Freshman is also a subtype of Person Advantage: Used to create a more concise and readable E-R diagram. It best maps to object oriented approaches either to databases or related applications. • Attributes common to different entity sets need not be repeated • They can be grouped in one place as attributes of the supertype • Attributes of (sibling) subtypes are likely to be different (and should be for this to be very useful) http://jcsites.juniata.edu/faculty/rhodes/dbms/eermodel
ER Notations Mandatory-Optional (Complete, disjoint) Mandatory- Optional (1:1 Binary) http://adbc.kennesaw.edu/index.php?mainmenu=db&submenu=er_notations
ER Notations Crow’s Feet (1-N Binary Identifying) Crow’s Feet (1-N Unary) http://adbc.kennesaw.edu/index.php?mainmenu=db&submenu=er_notations
Links: • Link 1: http://www.agiledata.org/essays/dataModeling101.html • Link 2: http://jcsites.juniata.edu/faculty/rhodes/dbms/ermodel • Link 3: http://jcsites.juniata.edu/faculty/rhodes/dbms/eermodel • Link 4: http://adbc.kennesaw.edu/index.php?mainmenu=db&submenu=er_notations