You are on page 1of 69

Non-Spatial Data Model

Overview

Dr. Harish Karnatak


Indian Institute of Remote Sensing, ISRO Dehradun

Overview of non-spatial data model, Harish Karnatak

Collections of data
Data- Refer to the values physically
recorded in the database.
Data may be collected, manipulated and
retrieved in various ways:
plain text editor - simple editing and
retrieval
word processor - adds tables and simple
calculations
spreadsheet programme - adds more
sophisticated calculations
database management system (DBMS) adds formats, structures, rules, ...

What is a Database System?


Basically, it is nothing more than a computer-base
record keeping system: that is, a system whose overall
purpose is to record and maintain information.
A very large, integrated collection of data.
Models ( = represents) a real-world enterprise.
Entities (e.g., students like Amit, courses like
DBMS64), and their Relationships (e.g., Amit is taking
DBMS64)
A Database Management System (DBMS) is a
software package designed to store and manage
database systems.
Overviewofnonspatialdatamodel,HarishKarnatak

Growing standards for Databases


There Are Many Standards . . .

OGC Compliant
WMS/WFC/WCS are
standards

XML/SOAP
Data
Server

Web Services
DBMS/RDBMS

Integration

Network/Hierarchal
Flat File

. . . Focus Is on simple and


practical approaches that work
Overviewofnonspatialdatamodel,HarishKarnatak

Harish Karnatak

Basic Components of Database system


Data
Hardware
Software
User

Overview of non-spatial data model, Harish Karnatak

Basic Components of Database system


Data
Data is any information related to an organization
that should be stored for any purpose according to
the requirements of the organization. With a
database, user should be able to store this data in an
organized manner.
A Database is a repository for stored data. In general
its integrated and shared.

Overviewofnonspatialdatamodel,HarishKarnatak

Basic Components of Database system


Hardware and Software: It consists of secondary storage
volumes-disks, drums etc on which database resides together
with the associated devices, control units, channels .
Between physical database stored and the user is a layer of
software usually called DBMS.
All requests of the user are handed by DBMS. DBMS provides
a view of the Database that is elevated somewhat above the
hardware level and support user operations.
Overviewofnonspatialdatamodel,HarishKarnatak

Basic Components of Database system


Users- Three broad class of Users
End-user- accessing the database from terminal either through
application programme of Query language. Can perform all the
function of retrieval, creation, deletion and modification.
Application Programmer: Responsible for writing application
programs that use the database in any programming language
like- C, Visual Basic, JAVA etc. All the DBMS operation are
performed by issuing the appropriate request from application
program (s) to DBMS.
Database Administrator: Can be viewed as the household person
of the database system, whose responsibility is to keep the
system up and running, and to make sure that it perform as
efficient as possible all the time.
Overviewofnonspatialdatamodel,HarishKarnatak

Database organization
Four main types of database
organization:
Flat
Hierarchical
Relational
Object-oriented

Overview of non-spatial data model, Harish Karnatak

Why would we use a database?


A database system provides the enterprise with centralized
control of its operational data.
Redundancy can be reduced
Inconsistency can be avoid
The data can be shared
Standard can be enforced
Security restriction can be applied
Integrity can be maintained
Conflicting requirement can be balanced
Concurrent access, recovery from crashes
Overviewofnonspatialdatamodel,HarishKarnatak

Why would we use a database?


Redundancy can be reduced
In non database system, each user has its own private
files.

This

can

be

often

lead

to

considerable

redundancy in stored data, with resulting waste in


storage space.
The database redundancy i.e. delicacy in records, can
be removed by using RDBMS concept

Overviewofnonspatialdatamodel,HarishKarnatak

Why would we use a database?


Inconsistency can be avoid
Suppose employee Amit works in department system- is
represented by two distinct entries in database, and that the
system is not aware of this duplication (i.e. redundancy is not
controlled). Then it may be possible that the two entries will not
agree, i.e. only one record is updated. At such occasion, the
database is said to be inconsistent
If redundancy is removed or controlled by the system then such
inconsistency cannot occur.
Overviewofnonspatialdatamodel,HarishKarnatak

Why would we use a database?


The data can be shared
The same data can be shared by different application.
No need to create separate database for different
application

Overviewofnonspatialdatamodel,HarishKarnatak

Why would we use a database?


Standard can be enforced
With central control of the database, the DBA can
ensure that all the applicable standard are followed in
the representation of the data

Overviewofnonspatialdatamodel,HarishKarnatak

Why would we use a database?


Security restriction can be applied
The DBA can ensure that the only means of access to
the database is through the proper channels
DBA can define authorization check to be carried out
whenever access to sensitive data is attempt.
Different check can be established for each type of
access
Overviewofnonspatialdatamodel,HarishKarnatak

Why would we use a database?


Integrity can be maintained
To ensure that data in database is accurate
Inconsistency between two entries representing the same
fact is an example of lack integrity
Example- An employee may be shown as having worked
200 hours in the week
Centralized control of the database helps in avoiding the
situation, in so far as they can be avoided, by permitting the
DBA to define validating procedures
Overviewofnonspatialdatamodel,HarishKarnatak

Why would we use a database?


Conflicting requirement can be balanced The DBA can structure the database to provide an
overall service that is best for the enterprise

Overviewofnonspatialdatamodel,HarishKarnatak

Database Management System- DBMS


Data Management Systems: a collection of programs
that enables users to create, manipulate and maintain
the database.
Examples- Oracle, PostgreSQL, MySQL, DB2, SQL
Server, MS Access ,etc .

Overviewofnonspatialdatamodel,HarishKarnatak

Characteristics of DBMS
A DBMS is a software package for defining and managing a

database.
A real database includes definitions of
field names
data formats (text? binary? integer? etc.)
record structures (fixed-length? pointers? field order, etc.)
file structures (sequential? indexed? etc.)
rules for validating and manipulating data
Data
Overviewofnonspatialdatamodel,HarishKarnatak

DBMS Components
A data definition language (DDL);
A data manipulation language (DML);
A sophisticated general purpose query language;
A facility for concurrent access of data by multiple users;
A facility for security and integrity controls.

Overviewofnonspatialdatamodel,HarishKarnatak

Database terminology- Basic


Entities- Are basic units used in modeling classes
concrete or abstract objects, eg. Room, chair, employee
etc.
Attributes- Field name
Record set- Row value

Overviewofnonspatialdatamodel,HarishKarnatak

Database terminology- Basic


Key- Single attribute or combination of two or more attributes of an
entity set that is used to identify one or more instances of the set
Primary Key- Unique Identification
Super Key- If we add additional attribute to a primary key, the
resulting combination would still uniquely identify an instance of
the entity set
Candidate Key- Two or more attributes or combination of attributes
that uniquely identify an instance of entity set are called Candidate
Key, and must decide which of the candidate key will work as a
primary key and remaining candidate key is considered as
alternate key
Overviewofnonspatialdatamodel,HarishKarnatak

Database terminology- ACID

ACID (atomicity, consistency, isolation, durability) is a set of


properties that guarantee that database transactions are
processed reliably. In the context of databases, a single
logical operation on the data is called a transaction.

For example, a transfer of funds from one bank account to


another, even though that might involve multiple changes
(such as debiting one account and crediting another), is a
single transaction.

Overviewofnonspatialdatamodel,HarishKarnatak

Database terminology- ACID


Atomicity
requires that each transaction is "all or nothing": if one part of the transaction fails, the
entire transaction fails, and the database state is left unchanged. An atomic system must
guarantee atomicity in each and every situation, including power failures, errors, and
crashes.
Consistency
This property ensures that any transaction will bring the database from one valid state to
another. Any data written to the database must be valid according to all defined rules,
including but not limited to constraints, cascades, triggers, and any combination thereof.
Isolation
The isolation property ensures that the concurrent execution of transactions results in a
system state that could have been obtained if transactions are executed serially, i.e. one
after the other.
Durability
Durability means that once a transaction has been committed, it will remain so, even in the
event of power loss, crashes, or errors. In a relational database, for instance, once a group
of SQL statements execute, the results need to be stored permanently (even if the database
crashes immediately thereafter).

Overviewofnonspatialdatamodel,HarishKarnatak

Data Models

A data model is a collection of concepts for describing data.

A database schema is a description of a particular collection


of data, using the given data model.

The relational data model is by far the most widely used


model today.

Main concept: relation, basically a table with rows and


columns.

Every relation has a schema, which describes the


attributes (columns or fields).

Data Models

A data model is a formal language that allows us to define


the type of data and data processing that occurs in a
database application. It supports:

Definition of data structures for storage.

Definition of rules that the stored data have to obey.

Definition of operations on the data, such that changes


to represented things in the real world can be accounted
for.
Overviewofnonspatialdatamodel,HarishKarnatak

Example relation
Relation schema:
Student (

sid
53666
53688
53650

sid: char(5),
name: varchar(20),
login: varchar(15),
age: integer,
gpa: real)

name
Jones
Smith
Smith

Relation instance, has


cardinality 3, degree 5
Five attributes; their names
suggest the meaning

login
jones@cs
smith@cs
smith@math

age
18
18
19

Overviewofnonspatialdatamodel,HarishKarnatak

gpa
3.4
3.2
3.8

What a Database Is and Is Not


The word database is commonly used to refer to any of the following:

your personal address book in a Word document


a collection of Word documents
a collection of Excel Spreadsheets
a very large flat file on which you run some
statistical analysis functions
data collected, maintained, and used in airline
reservation
data used to support the launch of a space shuttle

Models of Reality
DML
DATABASE SYSTEM

REALITY
structures
processes

DDL

DATABASE

A database is a model of structures of reality


The use of a database reflect processes of reality
A database system is a software system which
supports the definition and use of a database
DDL: Data Definition Language
DML: Data Manipulation Language

Overviewofnonspatialdatamodel,HarishKarnatak

Why Use Models?


Models can be useful when we want to examine or
manage part of the real world
The costs of using a model are often considerably
lower than the costs of using or experimenting with
the real world itself
Examples:
airplane simulator
nuclear power plant simulator
flood warning system
model of US economy
model of a heat reservoir
map
Overviewofnonspatialdatamodel,HarishKarnatak

A Map Is a Model of Reality

Overviewofnonspatialdatamodel,HarishKarnatak

Use a DBMS when this is


important
persistent storage of data

Do not use a DBMS when

centralized control of data


control of redundancy
control of consistency and
integrity

multiple user support


sharing of data

data documentation
data independence
control of
security

access

backup and recovery

and

the initial investment in


hardware, software, and
training is too high
the generality a DBMS
provides is not needed
the overhead for security,
concurrency control, and
recovery is too high
data and applications are
simple and stable
real-time
requirements
cannot be met by it
multiple user access is not
needed

Overviewofnonspatialdatamodel,HarishKarnatak

Database Design
The purpose of database design is to create a
database which
is a model of structures of reality
supports queries and updates modeling
processes of reality
runs efficiently

Overviewofnonspatialdatamodel,HarishKarnatak

Abstraction
It is very important that the language used for
data representation supports abstraction
We will discuss three kinds of abstraction:
Classification
Aggregation
Generalization

Overviewofnonspatialdatamodel,HarishKarnatak

Data Model
A data model consists of notations for
expressing:
data structures
integrity constraints
operations

Overviewofnonspatialdatamodel,HarishKarnatak

Data Model - Data Structures


All data models have notation for defining:
attribute types
entity types
relationship types

FLIGHT-SCHEDULE

DEPT-AIRPORT

FLIGHT#
101

AIRLINE
SpiceJet

WEEKDAY
mo

545

Air India

we

912

Indigo

242

GoAir

PRICE
156

FLIGHT# AIRPORT-CODE
101

DEL

110

912

HYD

fr

450

545

DDN

mo

231

Data Model - Constraints


Constraints express rules that cannot be expressed by the
data structures alone:
Static constraints apply to database state
Dynamic constraints apply to change of database state
E.g., All FLIGHT-SCHEDULE entities must have precisely
one DEPT-AIRPORT relationship
FLIGHT-SCHEDULE

DEPT-AIRPORT

FLIGHT#
101

AIRLINE
delta

WEEKDAY
mo

545

american

we

912

scandinavian

242

usair

PRICE
156

FLIGHT# AIRPORT-CODE
101

atl

110

912

cph

fr

450

545

lax

mo

231

242

bos

Data Model - Operations


Operations support change and retrieval of data:
insert FLIGHT-SCHEDULE(97, delta, tu, 258);
insert DEPT-AIRPORT(97, atl);

select FLIGHT#, WEEKDAY


from FLIGHT-SCHEDULE
where AIRLINE=delta;

FLIGHT-SCHEDULE

DEPT-AIRPORT

FLIGHT#
101

AIRLINE
delta

WEEKDAY
mo

545

american

we

912

scandinavian

242
97

PRICE
156

FLIGHT# AIRPORT-CODE
101

atl

110

912

cph

fr

450

545

lax

usair

mo

231

242

bos

delta

tu

258

97

atl

Keys and Identifiers


Keys (or identifiers) are uniqueness constraints
A key on FLIGHT# in FLIGHT-SCHEDULE will force all
FLIGHT#s to be unique in FLIGHT-SCHEDULE
Consider the following keys on DEPT-AIRPORT:
FLIGHT# AIRPORTCODE

FLIGHT# AIRPORTCODE

FLIGHT# AIRPORTCODE

FLIGHT-SCHEDULE

FLIGHT# AIRPORTCODE

DEPT-AIRPORT

FLIGHT#

AIRLINE

WEEKDAY

PRICE

101

delta

mo

156

101

atl

545

american

we

110

912

cph

912

scandinavian

fr

450

545

lax

242

usair

mo

231

242

bos

FLIGHT# AIRPORT-CODE

Integrity and Consistency


Integrity: does the model reflect reality well?
Consistency: is the model without internal conflicts?
a FLIGHT# in FLIGHT-SCHEDULE cannot be null because it
models the existence of an entity in the real world
a FLIGHT# in DEPT-AIRPORT must exist in FLIGHT-SCHEDULE
because it doesnt make sense for a non-existing FLIGHTSCHEDULE entity to have a DEPT-AIRPORT
DEPT-AIRPORT

FLIGHT-SCHEDULE
PRICE

FLIGHT# AIRPORT-CODE

FLIGHT#

AIRLINE

WEEKDAY

101

delta

mo

156

101

atl

545

american

we

110

912

cph

912

scandinavian

fr

450

545

lax

242

usair

mo

231

242

bos

Normalization
FLIGHT-WEEKDAY

FLIGHT-SCHEDULE
FLIGHT#

AIRLINE WEEKDAYS PRICE

FLIGHT#

WEEKDAY

101

delta

mo,fr

156

101

mo

545

american

mo,we,fr

110

545

mo

912

scandinavian

fr

450

912

fr

101

fr

545

we

545

fr

FLIGHT-SCHEDULE
FLIGHT#

AIRLINE

WEEKDAY

PRICE

101

delta

mo

156

545

american

mo

110

912

scandinavian

fr

450

101

delta

fr

156

545

american

we

110

545

american

fr

110

FLIGHT-SCHEDULE
FLIGHT#

AIRLINE

PRICE

101

delta

156

545

american

110

912

scandinavian

450

Overviewofnonspatialdatamodel,HarishKarnatak

DATA MODEL OVERVIEW

ER-Model
Hierarchical Model
Network Model
Inverted Model - ADABAS
Relational Model
Object-Oriented Model(s)

Overviewofnonspatialdatamodel,HarishKarnatak

ER-Model - Data Structures


entity type
composite attribute
relationship type

attribute
subset relationship type
Multivalued attribute

Derived attribute
Overviewofnonspatialdatamodel,HarishKarnatak

Summary

DBMS is used to maintain and query large data sets.

Benefits

include

recovery

from

system

crashes,

concurrent access, quick application development, data


integrity and security.

Levels of abstraction give data independence.

A DBMS typically has a layered architecture.

DBMS

R&D

is

one

of

most exciting areas in CS.

Overviewofnonspatialdatamodel,HarishKarnatak

the

broadest,

Relational Data Model


Introduction

A Brief History of Relational Data Models


Introduced by Dr. E. F. Codds in 1970.
Dr. Codd give set of rules for RDBMS
The ER model is used for conceptual modeling purpose

Overviewofnonspatialdatamodel,HarishKarnatak

The Relational Model


Very simple

Powerful & flexible

A Relation = a table

First proposed by Codd in 1970


Is the basis for the relational database management system
concept

Overviewofnonspatialdatamodel,HarishKarnatak

Relational Database Management


System Concept
Any RDBMS consists of:
A collection of tables
Rules (constraints) for how tables are arranged
A set of operators to act on the tables

Overviewofnonspatialdatamodel,HarishKarnatak

Dr. E. F. Codd Rules on RDBMS


Information representation- All information in RDBMS is
represented explicitly at the logical level and in exactly
one way- as value in table
Guaranteed Access- Each and every row in a RDBMS is
guaranteed to logically accessible by using a combination
of table name, primary key value and column name

Overviewofnonspatialdatamodel,HarishKarnatak

Dr. E. F. Codd Rules on RDBMS


Systematic treatment of Null value- In RDBMS there is
provision of NULL value.
Dynamic online catalog-based relational model The database
description is represented at the logical level in the same way
as ordinary value data, so that authorized users can apply the
same relational language to its interrogation as they apply to
the regular data

Overviewofnonspatialdatamodel,HarishKarnatak

Dr. E. F. Codd Rules on RDBMS


Comprehensive data sub language- Must have common
language for RDBMS
View updating- Change can be made to the table must
affect the desired change in the view
High level update, Insert, Delete- Must have high level
data manipulation not only selection of data

Overviewofnonspatialdatamodel,HarishKarnatak

Dr. E. F. Codd Rules on RDBMS


Distributed Independence- The data manipulation
sub language of an RDBMS must enable application
programs and inquiries to remain logically the same
whether and whenever data is physically centralized
or distributed
Non- Subversion- If a relational subsystem has a low
level interface, that low level interface cannot be
used to bypass the integrity rules and constraints
expressed in higher level relational language

Overviewofnonspatialdatamodel,HarishKarnatak

Dr. E. F. Codd Rules on RDBMS


Physical data independence- Can change physical
view of the database without affecting the conceptual
or logical view
Logical data independence
Integrity independence- Integrity constraints specific
to a particularly relational database must be definable
in the relational data sub language and storable in
the catalogue, not in the application programs

Overviewofnonspatialdatamodel,HarishKarnatak

Relational Model
Data Structures
Integrity Constraints
Operations

Commercial systems include: ORACLE, DB2, SYBASE,


INFORMIX, INGRES, SQL Server
Dominates the database market on all platforms

Overviewofnonspatialdatamodel,HarishKarnatak

Relational Model - Data Structures


domains
attributes
relations
relation name
attribute names
flight-schedule
flight#:
integer

airline:
char(20)

weekday:
char(2)

price:
dec(6,2)

domain names

Overviewofnonspatialdatamodel,HarishKarnatak

Relational Model - Integrity Constraints


Keys
Primary Keys
Entity Integrity
Referential Integrity

flight-schedule
flight#

customer
customer# customer
name
p

p
reservation
flight#

date

customer#

Overviewofnonspatialdatamodel,HarishKarnatak

Relational Model - Operations


Powerful set-oriented query languages
Relational Algebra: procedural; describes how to
compute a query; operators like JOIN, SELECT, PROJECT
Relational Calculus: declarative; describes the desired
result, e.g. SQL, QBE
insert, delete, and update capabilities

Overviewofnonspatialdatamodel,HarishKarnatak

Relational Model - Operations

tuple calculus example (SQL)


select flight#, date
from reservation R, customer C
where R.customer#=C.customer#
and customer-name=LEO;
algebra example (ISBL)
((reservation join customer) where customer-name=LEO)
[flight#, date];
domain calculus example
reservation
flight# date
.P

.P

customer#

_c

customer
customer#

customer-name

_c
Overviewofnonspatialdatamodel,HarishKarnatak

LEO

Geospatial data Organization

Overviewofnonspatialdatamodel,HarishKarnatak

Object-Oriented Model(s)

based on the object-oriented paradigm,


e.g., Simula, Smalltalk, C++, Java
area is in a state of flux
object-oriented model has object-oriented repository model;
adds persistence and database capabilities; (see ODMG-93,
ODL, OQL)

object-oriented commercial systems include GemStone,


Ontos, Orion-2, Statice, Versant, O2

object-relational model has relational repository model;


adds object-oriented features; (see SQL3)
object-relational commercial systems include Starburst,

POSTGRES

Overviewofnonspatialdatamodel,HarishKarnatak

Taxonomy
Data types
Operations
Query language
Algorithms
Access methods

Overviewofnonspatialdatamodel,HarishKarnatak

DBMS

Core Spatial
Functionality
Interface to DBMS

Interface to spatial application

Spatial application

SDBMS Three-layer Structure (Cont.)

Spatial Query Language


Number of specialized adaptations of SQL

Spatial query language


Temporal query language (TSQL2)
Object query language (OQL)
Object oriented structured query
language (O2SQL)

Overviewofnonspatialdatamodel,HarishKarnatak

Spatial Relations

Topological Relations: containment, overlapping, etc.


[Egenhofer et al. 1991]
A

Metric Relations: distance between objects, etc. [Gold and


Roos 1994]
A

1 Km

Direction Relations: north of, south of, etc. [Hernandez et


al. 1990; Frank et al. 1991]
Overviewofnonspatialdatamodel,HarishKarnatak

Topological Relations

Topological relations are defined using pointset topology concepts, such as boundary and

interior.

Overviewofnonspatialdatamodel,HarishKarnatak

Topological Relations (Cont.)


For example:
the boundary of a region consists of a set
of curves that separate the region from the
rest of the coordinate space
The interior of a region consists of all points
in the region that are not on its boundary

Given this, two regions are said to be


adjacent if they share part of a boundary
but do not share any points in their interior

Overviewofnonspatialdatamodel,HarishKarnatak

SDBMS
The Organizing and management of geo-spatial data
inside DBMS or RDBMS has emerged as an exciting and
challenging area for GIS professionals during last decade
which is known as Spatial Database Management System
(SDBMS).

Overviewofnonspatialdatamodel,HarishKarnatak

POSTGIS Model

PostGIS "spatially enables" the PostgreSQL server, allowing it to be


used as a backend spatial database for geographic information
systems (GIS), much like ESRI's SDE or Oracle's Spatial extension.

PostGIS follows the OpenGIS "Simple Features Specification for


SQL" and has been certified as compliant with the "Types and
Functions" profile.

PostGIS development was started by Refractions Research as a


project in open source spatial database technology.

PostGIS is released under the GNU General Public License.

PostGIS continues to be developed by a group of contributors led by


a Project Steering Committee and new features continue to be
added.
Overviewofnonspatialdatamodel,HarishKarnatak

POSTGIS Model
PostGIS supports storage of the following GIS object
types:
POINT
LINE
POLYGON
MULTIPOINT
MULTILINE
MULTIPOLYGON
GEOMETRYCOLLECTION

Overviewofnonspatialdatamodel,HarishKarnatak

For any further queries you may contact me at:


harish@iirs.gov.in

Overviewofnonspatialdatamodel,HarishKarnatak

You might also like