Unit-Iii Advanced Database Systems
Unit-Iii Advanced Database Systems
Object Oriented Databases-Need for Complex Data Types - The Object-Oriented Data
Model-Object-Oriented Languages-Spatial Databases: Spatial Data Types, Spatial
Relationships, Spatial Data Structures, Spatial Access Methods – Temporal Databases:
Overview – Active Databases – Deductive Databases – RecursiveQueries in SQL – Mobile
Databases: Location and Handoff Management, Mobile TransactionModels, Concurrency –
Transaction Commit Protocols – Multimedia databases
POLYMORPHISM
A real-life example of polymorphism, a person at the same time can have different
characteristics. Like a man at the same time is a father, a husband, an employee. So the
same person posses different behavior in different situations. This is called polymorphism.
INHERITANCE
Inheritance is the process by which genetic information is passed on from parent to child.
... Inheritance describes how genetic material is passed on from parent to child.
ENCAPSULATION
Data encapsulation, also known as data hiding, is the mechanism whereby the
implementation details of a class are kept hidden from the user. The user can only
perform a restricted set of operations on the hidden members of the class by executing special
functions commonly called methods.
RELATIONAL DATABASE
A relational database is a type of database that stores and provides access to data points
that are related to one another. ... The columns of the table hold attributes of the data, and
each record usually has a value for each attribute, making it easy to establish the relationships
among data points.
INTEGRITY
CONCURRENCY
Data concurrency is the ability to allow multiple users to affect multiple transaction
within a database. Simply, data concurrency allows multiple users to access data all at the
same time. ... Once the data is saved, it is then written into the database's physical storage in
place of the original data.
QUERY PROCESSING
Query Processing is the activity performed in extracting data from the database. In query
processing, it takes various steps for fetching the data from the database. The steps involved
are: Parsing and translation. Optimization.
Collection types
You can use a collection type whenever you must store and manipulate collections
of data within a table cell. You can assign collection types to columns.
LIST
List is a collection data type. It allows multiple values to be stored within the same field. For
example, in a Patients table, Allergies may be a List – String data type that is configured
with all known allergies.
SET
A SET is a string object that can have zero or more values, each of which must be
chosen from a list of permitted values specified when the table is created. SET column
values that consist of multiple set members are specified with members separated by
commas ( , )
Data type Description
MULTISET
The MULTISET data type is a collection type that stores a non-ordered set that can
include duplicate element values. The elements in a MULTISET have no ordinal position.
That is, there is no concept of a first, second, or third element in a MULTISET.
Row types
A row type typically contains multiple fields.
When you want to store more than one kind of data in a column or variable,
you can create a row type.
Row types come in two kinds: named row types and unnamed row types.
You can assign an unnamed row type to columns and variables.
You can assign a named row type to columns, variables, tables, or views.
UNNAMED ROWTYPES
An unnamed row type is a group of typed fields that you create with the ROW
constructor. An important distinction between named and unnamed row types is that you
cannot assign an unnamed row type to a table. You use an unnamed row type to define the
type of a column or field only.
Example
An Example of the Object Oriented data model is −
Shape, Circle, Rectangle and Triangle are all objects in this model.
Circle has the attributes Center and Radius.
Rectangle has the attributes Length and Breath
Triangle has the attributes Base and Height.
The objects Circle, Rectangle and Triangle inherit from the object Shape.
OBJECT-ORIENTED LANGUAGES
SPATIAL DATABASES
It is a database system
It offers spatial data types (SDTs) in its data model and query language.
It supports spatial data types in its implementation, providing at least spatial indexing
and efficient algorithms for spatial join.
Example
A road map is a visualization of geographic information. A road map is a 2-
dimensional object which contains points, lines, and polygons that can represent
cities, roads, and political boundaries such as states or provinces.
In general, spatial data can be of two types −
Vector data: This data is represented as discrete points, lines and polygons
Rastor data: This data is represented as a matrix of square cells.
The spatial data in the form of points, lines, polygons etc. is used by many different
databases as shown above.
Points –
Points are used to represent spatial characteristics of objects whose
locations correspond to single 2-D coordinates (x, y, or longitude/latitude)
in the scale of particular application. For examples : Buildings, cellular
towers, or stationary vehicles. Moving vehicles and other moving objects
can be represented by sequence of point locations that change over time.
Lines –
Lines represent objects having length, such as roads or rivers, whose
spatial characteristics can be approximated by sequence of connected
lines.
Polygons –
Polygons are used to represent characteristics of objects that have
boundary, like states, lakes, or countries.
2.Attribute data :
It is the descriptive data that GIeographic Information Systems associate
with features in the map. For example, in map representing countries within
an Indian state (ex – Odisha or Mumbai).
Attributes- Population, largest city/town, area in square miles, and so on
.
3.Image data :
It includes camera created data like satellite images and aerial photographs.
Objects of interest, such as buildings and roads, can be identified and
overlaid on these images. Aerial and satellite images are typical examples
of raster data.
SPATIAL RELATIONSHIPS
Spatial relationships explore the concept of where objects are in relationship to something
else. For example, a ball may be behind the chair, or under the table, or in the box. The
dog may be on the blanket, outside of the house, or in the doghouse.
Topological relations:
Topological relationships describe qualitative properties that characterize the relative position of
spatial objects. disjoint, meet, overlap.
For any two spatial objects a and b, that can be points, lines and/or polygonal areas
Disjoint a∩b=∅
a and b are disjoint, have no point in common. They form a set
of disconnected geometries.
Intersects a∩b≠∅
Touches (a ∩ b ≠ ∅) ∧ (aο ∩ bο = ∅)
a touches b, they have at least one boundary point in common, but no interior
points.
Contains a∩b=b
Covers aο ∩ b = b
b lies in the interior of a (extends Contains). Other definitions: "no points of b lie in
the exterior of a", or "Every point of b is a point of (the interior of) a".
CoveredBy Covers(b,a)
Within a∩b=a
Directional relations:
Directional relations are qualitative spatial relations that describe how an object or a
region is placed relative to other objects or regions. This knowledge is expressed using
symbolic (qualitative) and not numerical (quantitative) terms
Distance relations:
Distance relations specify how far is the object away from the reference object.
The main purpose of spatial access methods is to support efficient selection of objects
based on spatial properties.
For example, a range query selects objects lying within specified ranges of coordinates;
a nearest neighbour query finds the object lying closest to a specified object.
spatial access methods are also used to implement efficiently such spatial analyses as
map overlay, and other types of spatial joins.
Two characteristics of spatial datasets are that they are frequently large and that the
data are quite often distributed in an irregular manner.
A spatial access method needs to take into account both spatial indexing and clustering
techniques.
Without a spatial index, every object in the database has to be checked to see whether
it meets the spatial selection criterion; a ‘full table scan’ in a relational database.
As spatial datasets are usually very large, such checking is unacceptable in practice for
interactive use and most other applications.
KD-TREE
BSP-TREE
THE KD-TREE
The basic form of the KD-tree stores K-dimensional points (Bentley 1975).
This section concentrates on the 2-dimensional case.
Each internal node of the KD-tree contains one point and also corresponds to a
rectangular region.
The root of the tree corresponds to the whole region of interest.
The rectangular region is divided into two parts by the x-coordinate of the stored point
on the odd levels and by the y-coordinate on the even levels in the tree.
THE BSP-TREE
BSP)-tree, before presenting a variant suitable for GIS applications: the multi-object BSPtree for
storing polylines and polygons. The original use of the BSP-tree was in 3-dimensional computer
graphics (Fuchs et al 1980; Fuchs et al 1983). The BSP-tree was used by Fuchs to produce a hidden
surface image of a static 3-dimensional scene. After a preprocessing phase it is possible to produce
an image from any view angle in O(n) time, with n the number of polygons in the BSP-tree. In this
chapter the 2-dimensional BSP-tree is used for the structured storage of geometric data. It is a data
structure that is not based on a rectangular division of space. Rather, it uses the line segments of the
polylines and the edges of the polygons to divide the space in a recursive manner. The BSP-tree
reflects this recursive division of space. Each time a (sub)space is divided into two subspaces by a
socalled splitting primitive, a corresponding node is added to the tree. The BSP-tree represents an
organisation of space by a set of convex subspaces in a binary tree. This tree is useful during spatial
search and other spatial operations. Figure 3(a) shows a scene with some directed line segments.
The ‘left’ side of the line segment is marked with an arrow. From this scene, line segment A is
selected and space is split into two parts by the supporting line of A. This process is repeated for
each of the two sub-spaces with the other line segments. The splitting of space continues until there
are no line segments left. Note that sometimes the splitting of a space implies that a line segment
(which has not yet been used for splitting itself) is split into two parts. Line D, for example, is split
into D1 and D2. Figure 3(b) shows the resulting organisation of the space, as a set of (possibly open)
convex subspaces. The corresponding BSP-tree is drawn in Figure 3(c). The BSP-tree, as discussed so
far, is suitable only for storing a collection of (unrelated) line segments. In GIS it must be possible to
represent objects, such as polygons. The multi-object BSP-tree (Oosterom 1990) is an extension of
the BSP-tree which caters for object representation. It stores the line segments that together make
up the boundary of the polygon. The multi-object BSP-tree has explicit leaf nodes which correspond
to the convex subspaces created by the BSP-tree. Figure 4(a) presents a 2-dimensional scene with
two objects, triangle T with sides abc, and rectangle R with sides defg. The method divides the space
in the convex subspaces of Figure 4(b). The BSP-tree of Figure 4(c) is extended with explicit leaf
nodes, each representing a convex part of the space. If a convex subspace corresponds to the
‘outside’ region, no label is drawn in the figure. If no more than one identification tag per leaf is
allowed, only mutually exclusive objects can be stored in the multi-object BSP-tree, otherwise it
would be possible also to deal with objects that overlap. A disadvantage of this Spatial access
methods 387 Fig 3. The building of a BSP-tree: (a) 2-dimensional scene; (b) convex sub-spaces; and
(c) BSP-tree. D B A C A B C D1 D2 B A C D1 D2 (a) (b) (c) left right Fig 4. The building of a multi-object
BSP-tree: (a) object scenes; (b) convex sub-spaces; and (c) multi-object BSP-tree. (a) (b) (c) e d g f a b
c e d g2 f1 f2 R a b c d a b e f2 c f1 g1 g2 R R T T BSP-tree is that the representation of one object is
scattered over several leaves, as illustrated by rectangle R in Figure 4. The (multi-object) BSP-tree
allows efficient implementation of spatial operations, such as pick and rectangle search. The choice
of which line segment to use for dividing the space very much influences the building of the tree. It is
preferable to have a balanced BSP-tree with as few nodes as possible. This is a very difficult
requirement to fulfil, because balancing the tree requires that line segments from the middle of the
dataset be used to split the space. These line segments will probably split other line segments. Each
split of a line segment introduces an extra node in the BSP-tree. However, Paterson and Yao (1989)
prove that, if the original line segments are disjoint, then it is possible to build a BSP-tree with O(n
log n) nodes and depth O(log n) using an algorithm requiring only O(n log n) time.
TEMPORAL DATABASES:OVERVIEW
TEMPORAL DATABASE:
A temporal database stores data relating to time instances.
It offers temporal data types and stores information relating to past, present and future time.
Valid time is the time period during which a fact is true in the real world.
Transaction time is the time at which a fact was recorded in the database.
DEDUCTIVE DATABASES
A deductive database is a database system that can make deductions based on
rules and facts stored in the database.
Deductive databases are more expressive than relational databases but less
expressive than logic programming systems.
RECURSIVE QUERIES IN SQL
Recursion is achieved by WITH statement, in SQL jargon called Common Table
Expression (CTE). It allows to name the result and reference it within other queries
sometime later
Recursive queries are used to query hierarchical data. The SQL standard
defines a special syntax for common table expressions to enable recursive
processing.
To (recursively) query all sub-categories for one parent, the following query
can be used:
A cache is maintained to hold frequent and transactions so that they are not lost due to
connection failure.
As the use of laptops, mobile and PDAs is increasing to reside in the mobile system.
Mobile databases are physically separate from the central database server.
Mobile databases resided on mobile devices.
Mobile databases are capable of communicating with a central database server or other
mobile clients from remote sites.
With the help of a mobile database, mobile users must be able to work without a
wireless connection due to poor or even non-existent connections (disconnected).
A mobile database is used to analyze and manipulate data on mobile devices.
2. Mobiles Units –
These are portable computers that move around a geographical region that includes the
cellular network that these units use to communicate to base stations.
3. Base Stations –
These are two-way radios installation in fixed locations, that pass communication with
the mobile units to and from the fixed hosts.
Limitations :
A mobile transaction model has been defined addressing the movement behavior of
transactions. Mobile transactions are named as Kangaroo Transactions which incorporate
the property that the transactions in a mobile environment hop from one base station to
another as the mobile unit moves.
CONCURRENCY
MULTIMEDIA DATABASES
The multimedia databases are used to store multimedia data such as images, animation,
audio, video along with text. This data is stored in the form of multiple file types like .txt(text),
.jpg(images), .swf(videos), .mp3(audio) etc.