Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
o What is Conceptual Data Modeling o Entity-Relationship (E-R ) Modeling o Limitations of E-R Modeling o Object-oriented Modeling: Another semantic model (discussed later in this course)
Semantic Modeling 1
CIS
Semantic Modeling 2
CIS
Semantic Modeling 3
CIS
Data Semantics
o Static Information
u Data -- Entities u Associations -- Relationships among entities
o Dynamic Information
u Activities -- Operations/transactions u Integrity constraints -- Business rules/regulations and data meanings
Semantic Modeling 4
CIS
CIS
E-R Modeling
o Introduced by Peter Chen in 1976 o Basic modeling concepts:
u Entities, entity types, and attributes u Relationships
Date
Works_for
Department
Emp#
Language
N
1
Instructor
Date
1
Assigned Office
Name
FName
Time
MInit
LName
Teaches
Location
M
Course
Semantic Modeling 6
CIS
E-R Notation
Entity
Relationship
Attribute
Primary Key
Semantic Modeling 7
CIS
Entities
o An entity is a conceptual object o Physically exists 4 Usually a noun in requirement specification
Alice CIS 2010 CIS 3730
Jose
Steve
CIS
CIS
Entity Types
o A collection of similar entities o An abstraction of "physical" entities 4 A noun in requirement specifications 4 Having "independent" meaning
Department Department Student Student Jose Alice Steve Course Course CIS Acct
CIS 2010
Semantic Modeling 9
CIS 3730
CIS
Parking Lot# 1
Date N
Color
PNum
Student
Registers
Car
Semantic Modeling 10
CIS
Attributes
Properties or characteristics of entities and entity types
u Attribute values -- Properties of entities u Value set - All acceptable attribute values u Attributes (definitions) -- Properties of entity types
Semantic Modeling 11
CIS
Key Attributes
One or a group of attributes that can uniquely identify individual entities of an entity type
u A key refers to one or a group of attributes as a whole u A key attribute is a component attribute of a key u Key changes with data semantics
CIS
More Attributes
o Simple attribute
Contains atomic values only degrees id Student Student age
o Composite attribute
Has component attributes __________________________________
o Single-valued attribute
Has exactly one value per entity
Fname
o Multi-valued attribute
Contains repeating values per entity __________________________________ CommEarned EmpNo CommRate Salesrep Salesrep Fname Mname Lname
o Derived attribute
Attribute values computed by means of other attributes
Semantic Modeling 13
CIS
Relationships
Associations among entities
u Relationships -- Associations among entities
Takes
Student
Takes
Course
Semantic Modeling 14
CIS
Relationship Degrees
The number of entity types associated with that relationship. Each entity in a relationship is known as a participant.
Unary Employee Employee Supervises Employee Employee Binary Work Department Department
n-ary
Supplier Supplier
Semantic Modeling 15
CIS
N-ary Relationships
o A link must associate with all participants o Cardinality is with respect to individual relationships 4 A N-ary relationship is not equivalent to N binary relationships
Customer N M 1
Salesperson
ships
Order
Semantic Modeling 16
CIS
Relationship Attribute
o Describes the association 4 A adverb or noun in requirement specification
sect# Instructor
time
teaches
Course
room#
date
Semantic Modeling 17
CIS
Relationship Cardinality
How entities are connected through a relationship
u One-to-One -- An entity of E1 is connected to at most one entity of E2 and vice versa. u One-to-Many -- An entity of E1 may be connected to one or more entities of E2, but an entity of E2 can only be mapped to at most one entity of E1. u Many-to-Many -- An entity of E1 may be linked to one or more entities of E2, and vice versa.
E1
a b c ...
1
R
[] [] [] ...
1
1
E2
x y z ...
a b c ...
M
[] [] [] ...
N
x y z ...
a b c ...
...
x y z ...
Semantic Modeling 18
CIS
Relationship Types
Recursive Relationship
Relationship type where same entity type participates more than once in different roles.
Relationships may be given role names to indicate purpose that each participating entity type plays in a relationship.
Semantic Modeling 19
CIS
Semantic Modeling 20
CIS
Semantic Modeling 21
CIS
Participation Constraints
Let R be a relationship type involves entity type E as a participant. If every instance of E participates in at least one instance of R, then the participation is said to be total; other wise it is said to be partial [Date, 2004] o Partial (optional) participation
An entity of E does not have to be mapped to another entity through the relationship. Writer Writer 1
Publishes
M Book Book
CIS
Structural Constraints
Main type of constraint on relationships is called multiplicity. Multiplicity - number (or range) of possible occurrences of an entity type that may relate to a single occurrence of an associated entity type through a particular relationship. Represents policies (called business rules) established by user or company.
CIS
Semantic Modeling 23
Multiplicity
Faculty
(0,4)
Teaches
(1,1)
Course
(1,45)
Takes
(?,?)
Student
Semantic Modeling 24
CIS
attr. 1
Entity 1
Relationship
Entity 2
( 0:5 )
Entity 2
Semantic Modeling 25
CIS
Disadvantages:
u Not a formally defined data model. u Deals with some integrity constraints. u Difficult to distinguish entities from relationships. u Has redundant modeling information.
Project
Dependent
has
Manages
Project Manager
Semantic Modeling 26
CIS
Is-A Relationship
o Generalization and specialization hierarchy
u Supertypes -- Hide the differences of subtypes u Subtypes -- Reveal specific properties
Generalization
Person
Is-A Is-A
Student
Is-A Is-A
Staff
Is-A Is-A
Specialization
UnderGrad
Grad Faculty
Secretary
Semantic Modeling 27
CIS
Inheritance
o A supertype contains the common properties of all its subtype entities. o Subtype inherits properties of its supertype and may have its own properties.
Person Person
Is-A
Salary, Skill
Is-A
Employee Employee
Is-A
Dependent Dependent
Birth-date
Semantic Modeling 28
CIS
Assumptions: Each game in the schedule is identified by a unique Game#, and a game is also identified uniquely by the combination of Date, starting Time, and Field where it is played. A performance attribute is used to store information on the individual batting performance of each player in a game.
Semantic Modeling 29
CIS
Semantic Modeling 30
CIS