ch 3 data modeling
ch 3 data modeling
Entity Attribute
symbols symbols
A special entity
that is also a Relationship
relationship symbols
Relationship
degrees specify
number of
entity types Relationship
involved cardinalities
specify how
many of each
entity type is
allowed
3. Early Data Models
Hierarchical model
Represented by an upside-down “tree”
It contains Levels or Segments
It depicts a set of one-to-many (1:M) relationships
between parent and its children segments.
12
Network model
Created to represent complex data relationships more
effectively than the hierarchical model, to improve
database performance and to impose database standard.
supports
many-to-many
relationship
14
• User sees the DB as a collection of tables in which data is
stored.
• Each table is independent from another.
• Rows in different tables are related based on common
values in common attributes
Relational Model - Integrity Constraints
• Three basic types
• Entity integrity, not allowing multiple rows to have the
same identity within a table.
Primary key
• Domain integrity, restricting data
predefined data types, e.g.: dates.
Set allowable values
Eg CREATE DOMAIN PriceChange AS DECIMAL
CHECK (VALUE BETWEEN .001 and .15);
• Referential integrity, requiring the existence of a related row
in another table, e.g. a customer for a given customer ID.
Foreign key
16
5. Object-Oriented Model
• Object is an abstraction of a real-world entity
• An object includes information - attributes/state,
operations/behavior, and identity.
• Attributes/state describe the properties of an object
• Behavior/operation specity how an object acts and reacts
• Objects that share similar characteristics are grouped in classes
Object-Oriented Model
• Classes are organized in a class hierarchy.
• Inheritance: object inherits methods and attributes of parent class
Object-Oriented Model
Composition Aggregation
1 1 1..3 1
Name Student Address
19
UML
Object-oriented modeling is commonly represented
using UML
Why OO?
• Conventional data models (e.g., relational) are
inadequate
– Cannot model complex data and unstructured
data
– Cannot model processes (dynamic behaviour)
– Does not support reuse
• Semi-structured data
– Has a certain structure
– structure may not be rigid, regular, or complete
– Eg. scientific data, E-Catalogs
• Unstructured data
– Very limited indication of the type of data
– Eg. text document containing maps, images, sound,
and video segments
Semi-Structured Data Model
• Semi-structured data
IMDb – A Motivating Example
• The Internet Movie Database is a classical example of
a collection of semi-structured data
• Although the information pertaining to different
movies may be essentially similar, their structure may
be different!
www.imdb.com
Irregularity In Structure
• Example: Some movie
may annotate information
about the actors,
choreographer, director
and producer, while
another movie may
annotate additional
information about the
lyricist and the music
director
Irregularity In Structure
• Example: An actor’s name
may be represented as a
– string or
– as a tuple (first_name,
last_name)
http://en.wikipedia.org/wiki/Semi-structured_data
http://en.wikipedia.org/wiki/Semi-structured_model
Comparison with Relational Data
• Inefficient: tags which represent
{ "id": 1,
schema information, are repeated "name": "Foo",
• Better than relational tuples as a "price": 123,
"tags": {
data-exchange format "Bar",
–Unlike relational tuples, "Eek"
XML/JSON data is self- ],
documenting due to use of tags "stock": {
"warehouse": 300,
–Non-rigid format: tags can be "retail": 20
added ie schema can easily be }
changed. }
- Allows nested structures
–Wide acceptance, not only in
database systems, but also in
browsers, tools, and applications
1
References
• Database Systems: A Practical Approach to
Design, Implementation and Management.
Connolly, T. M. and Begg, C. E. .
• Modern Database Management.Hoffer, J.A.,
Prescott, M., and McFadden,F.
• Database System Concepts . Silberschatz, A.,
Korth, H,. and Sudarshan, S.
• Fundamentals of Database Systems.
Elmasri, R. and Navathe, S.B.