3 - Object Data Model
3 - Object Data Model
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 2/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 3/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 4/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 5/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 7/45
The names of attributes are listed within a rectangular box one name of
TOP
attribute Created
per row by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 8/45
Multiplicity of attribute like [1..5] (from one to five), zero or more ([*]
or [0..*]), one or more ([1..*]), optional (zero or one, [0..1]), from
"m" to "n" ([m..n]) follows a name of attribute
Default multiplicity is "one" ([1])
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 9/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 10/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 12/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 13/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 14/45
Association
A person owns a vehicle
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 15/45
Association
A vehicle has an owner
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 16/45
Association
A person owns zero or more vehicles
Association
One-to-one association
- A department has a manager
- A department has exactly one manager
- A person who is a manager manages exactly one department
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 18/45
Association
One-to-many association
- A company employs an employee
- A company employes many employees
- An employee works for none or one company
- It is possible that a company has no (zero) employees
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 19/45
Association
Many-to-many association
- A supplier supplies a part
- A supplier supplies zero or more parts
- A part is supplied by zero or more suppliers
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 20/45
Association
Summary
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 21/45
Association
More examples:
A team consists of 22 players
A player belongs to only one team
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 22/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 23/45
Link Attribute
A link attribute is an attribute that describes an association
A student enrols a subject
Link Attribute
Why an atribute enrolment-date must be a represented by a link
attribute ?
For example, what about an attribute enrolment-date describing a
class STUDENT ?
Link Attribute
So what about another option where an atribute enrolment-date
describes a class SUBJECT ?
Link Attribute
If an attribute enrolment-date describes an association Enrols
between the classes STUDENT and SUBJECT then its values are like
labels attached to attached to the links between the objects from the
classes STUDENT and SUBJECT
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 27/45
Link Attribute
Another example of link attribute
A supplier supplies a part
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 28/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 29/45
Association Class
An association class is a class that represents an association
A student enrols in a subject
Association Class
What about an identifier of an association class ?
An association class may have its own identifiers, for example
enrolment-number in a class ENROLMENT
An association class that represents many-to-many association has a
default identifier that consists of identifiers of the classes from both
sides of association, for example a pair (snumber, code) in a class
ENROLMENT
Association Class
Another example of association class
A supplier supplies a part
A shipment of a part is performed on a given day, it means, that a
shipment is described by an attribute shipment-date
A shipment contains a given number of parts, it means, that a shipment
is also described by an attribute quantity
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 32/45
Association Class
What can we use association classes for ?
A shipment is delivered to a customer
An association Delivered-to connects the classes SHIPMENT and
CUSTOMER
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 34/45
Qualification
A building at a university campus is described by a unique number,
optional name and the total number of floors
A room is described by a number and area
A building consists of rooms
Qualification
A building at a university campus is described by a unique number,
optional name and the total number of floors. A room is described by a
number and area. A building consists of rooms
Qualification
More examples:
A bank account is located at a bank
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 37/45
Qualification
Sometimes qualification is needed for many-to-many associations
For example, if we consider a pessimistic view of students who enrol in
subjects then sometimes a student must enrol in the same subject more
than one time (well, ... you know when it happens and why it is a
"pessimistic" view of reality)
Some time ago we created the following design
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 38/45
Qualification
If enrolment is repeated several times then an identifier of a class
ENROLMENT is a triple (snumber, code, enrolment-date)
How is this represented graphically ?
It is represented by a qualification of the middle part of the association
Enrols
Qualification
A qualification of the middle part of many-to-many-association is
equivalent to the following two single-side qualifications of one-to-many
association and many-to-one association
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 40/45
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 41/45
Generalization
A generalization hierarchy represents Is-a-subset relation between the
classes of objects
A set of all undergraduate students is a subset of a set of students, it
means, that an undergraduate student IS-A student
A set of all postgraduate students is a subset of a set of students, it
means, that a postgraduate student IS-A student
Generalization
Another graphical notation for generalization hierarchy:
A car IS-A vehicle and a truck IS-A vehicle
To create a nice effect the arrows can be "joined" into a single arrow
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 43/45
Entity-Relationship Modeling
Entity-Relationship Modeling is another graphical conceptual modeling
notation
It is presented in your texbook
Graphically it is very similar to Object Data Model
The following concepts from the notations are equivalent:
- Class of objects = Entity type
- Object = Entity instance
- Association = Relationship
- Identifier = Primary key or Candidate key
- Qualification = Weak entity type
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 44/45
References
C. Coronel, S. Morris, A. Basta, M. Zgola, Data Management and Security,
Chapters 2, 3, and 4 Cengage Compose eBook, 2018, eBook: Data
Management and Security, 1st Edition
T. Connoly, C. Begg, Database Systems, A Practical Approach to Design,
Implementation, and Management, Chapter 12 Entity-Relationship
Modeling, Chapter 13.1 Specialization/Generalization, Pearson Education
Ltd, 2015
TOP Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 45/45