0% found this document useful (0 votes)
35 views26 pages

Unit 2

The document discusses Spatial and Temporal Databases, focusing on Active Database Models, Temporal Databases, and their design and implementation issues. It explains the concept of triggers in databases, their types, and their applications, as well as the importance of maintaining historical data in temporal databases. Examples illustrate how temporal databases store time-sensitive information, including valid and transaction times, through uni-temporal and bi-temporal relations.

Uploaded by

MCA HOD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views26 pages

Unit 2

The document discusses Spatial and Temporal Databases, focusing on Active Database Models, Temporal Databases, and their design and implementation issues. It explains the concept of triggers in databases, their types, and their applications, as well as the importance of maintaining historical data in temporal databases. Examples illustrate how temporal databases store time-sensitive information, including valid and transaction times, through uni-temporal and bi-temporal relations.

Uploaded by

MCA HOD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

lOMoARcPSD|24538650

UNIT II Spatial AND Temporal Databases

Master of Computer Applications (Anna University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by MCA HOD ([email protected])
lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

UNIT II SPATIAL AND TEMPORAL DATABASES

Active Databases Model – Design and Implementation Issues - Temporal


Databases - Temporal Querying - Spatial Databases: Spatial Data Types, Spatial
Operators and Queries – Spatial Indexing and Mining – Applications -– Mobile
Databases: Location and Handoff Management, Mobile Transaction Models –
Deductive Databases - Multimedia Databases.

2.1 Active Databases Model


A trigger is a procedure which is automatically invoked by the DBMS in response to changes to the
database, and is specified by the database administrator (DBA). A database with a set of associated
triggers is generally called an active database.

Parts of trigger

A triggers description contains three parts, which are as follows


1. The event(s) that triggers the rule: These events are usually database update operations that are
explicitly applied to the database. However, in the general model, they could also be temporal
events2 or other kinds of external events
2. The condition that determines whether the rule action should be executed: Once the triggering
event has occurred, an optional condition may be evaluated. If no condition is specified, the action
will be executed once the event occurs. If a condition is specified, it is first evaluated, and only if it
evaluates to true will the rule action be executed
3. The action to be taken: The action is usually a sequence of SQL statements, but it could also be a
database transaction or an external program that will be automatically executed.

Use of trigger

Triggers may be used for any of the following reasons −


 To implement any complex business rule, that cannot be implemented using integrity
constraints.
 Triggers will be used to audit the process. For example, to keep track of changes made to a
table.
 Trigger is used to perform automatic action when another concerned action takes place.

Types of triggers

The different types of triggers are explained below −


 Statement level trigger − It is fired only once for DML statement irrespective of number of
rows affected by statement. Statement-level triggers are the default type of trigger.
 Before-triggers − At the time of defining a trigger we can specify whether the trigger is to be
fired before a command like INSERT, DELETE, or UPDATE is executed or after the
command is executed. Before triggers are automatically used to check the validity of data
before the action is performed. For instance, we can use before trigger to prevent deletion of
rows if deletion should not be allowed in a given case.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 1

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

 After-triggers − It is used after the triggering action is completed. For example, if the trigger
is associated with the INSERT command then it is fired after the row is inserted into the table.
 Row-level triggers − It is fired for each row that is affected by DML command. For example,
if an UPDATE command updates 150 rows then a row-level trigger is fired 150 times whereas
a statement-level trigger is fired only for once.

Create database trigger

To create a database trigger, we use the CREATE TRIGGER command. The details to be given at
the time of creating a trigger are as follows −

 Name of the trigger.


 Table to be associated with.
 When trigger is to be fired: before or after.
 Command that invokes the trigger- UPDATE, DELETE, or INSERT.
 Whether row-level triggers or not.
 Condition to filter rows.
 PL/SQL block is to be executed when trigger is fired.
The syntax to create database trigger is as follows −

CREATE [OR REPLACE] TRIGGER triggername


{BEFORE|AFTER}
{DELETE|INSERT|UPDATE[OF COLUMNS]} ON table
[FOR EACH ROW {WHEN condition]]
[REFERENCE [OLD AS old] [NEW AS new]]
BEGIN
PL/SQL BLOCK
END.

2.2 Design and Implementation Issues for Active Databases

In this section, we discuss some additional issues concerning how rules are designed and
implemented. The first issue concerns activation, deactivation, and grouping of rules. In addition to
creating rules, an active database system should allow users to activate, deactivate, and drop rules by
referring to their rule names. A deactivated rule will not be triggered by the triggering event.

This feature allows users to selectively deactivate rules for certain periods of time when they
are not needed. The activate command will make the rule active again. The drop command deletes
the rule from the system. Another option is to group rules into named rule sets, so the whole set of
rules can be activated, deactivated, or dropped. It is also useful to have a command that can trigger a
rule or rule set via an explicit PROCESS RULES command issued by the user.

The second issue concerns whether the triggered action should be executed before, after,
instead of, or concurrently with the triggering event. A before trigger executes the trigger before
executing the event that caused the trigger. It can be used in appli- cations such as checking for

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 2

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

constraint violations. An after trigger executes the trig- ger after executing the event, and it can be
used in applications such as maintaining derived data and monitoring for specific events and
conditions. An instead of trigger executes the trigger instead of executing the event, and it can be
used in applications such as executing corresponding updates on base relations in response to an
event that is an update of a view.

A related issue is whether the action being executed should be considered as a separate
transaction or whether it should be part of the same transaction that triggered the rule. We will try to
categorize the various options. It is important to note that not all options may be available for a
particular active database system. In fact, most com- mercial systems are limited to one or two of the
options that we will now discuss.

Let us assume that the triggering event occurs as part of a transaction execution. We should
first consider the various options for how the triggering event is related to the evaluation of the rule’s
condition.

The rule condition evaluation is also known as rule consideration , since the action is to be executed
only after considering whether the condition evaluates to true or false. There are three main
possibilities for rule consideration:

1.Immediate consideration. The condition is evaluated as part of the same transaction as the
triggering event, and is evaluated immediately.

This case can be further categorized into three options:

Evaluate the condition before executing the triggering event.

Evaluate the condition after executing the triggering event.

Evaluate the condition instead of executing the triggering event.

2. Deferred consideration. The condition is evaluated at the end of the trans- action that included the
triggering event. In this case, there could be many

3. Detached consideration. The condition is evaluated as a separate transaction, spawned from the
triggering transaction.

The next set of options concerns the relationship between evaluating the rule condition and executing
the rule action. Here, again, three options are possible: immediate , deferred, or detached execution.
Most active systems use the first option.

That is, as soon as the condition is evaluated, if it returns true, the action is immediately executed.

The Oracle system uses the immediate consideration model, but it allows the user to specify
for each rule whether the before or after option is to be used with immediate condition evaluation. It
also uses the immediate execution model. The STARBURST system uses the deferred consideration
option, meaning that all rules triggered by a transaction wait until the triggering transaction reaches
its end and issues its COMMIT WORK command before the rule conditions are evaluated.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 3

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Another issue concerning active database rules is the distinction between row-level rules and
statement-level rules. Because SQL update statements (which act as triggering events) can specify a
set of tuples, one has to distinguish between whether the rule should be considered once for the
whole statement or whether it should be considered separately for each row (that is, tuple) affected by
the statement.

2.3 Temporal Database


A Temporal Database is a database with built-in support for handling time sensitive data.
Usually, databases store information only about current state, and not about past states. For example
in a employee database if the address or salary of a particular person changes, the database gets
updated, the old value is no longer there. However for many applications, it is important to maintain
the past or historical values and the time at which the data was updated. That is, the knowledge of
evolution is required. That is where temporal databases are useful. It stores information about the
past, present and future. Any data that is time dependent is called the temporal data and these are
stored in temporal databases.
Temporal Databases store information about states of the real world across time. Temporal Database
is a database with built-in support for handling data involving time. It stores information relating to
past, present and future time of all events.

Examples Of Temporal Databases


 Healthcare Systems: Doctors need the patients’ health history for proper diagnosis.
Information like the time a vaccination was given or the exact time when fever goes high etc.
 Insurance Systems: Information about claims, accident history, time when policies are in
effect needs to be maintained.
 Reservation Systems: Date and time of all reservations is important.
Temporal Aspects
There are two different aspects of time in temporal databases.

 Valid Time: Time period during which a fact is true in real world, provided to the system.
 Transaction Time: Time period during which a fact is stored in the database, based on
transaction serialization order and is the timestamp generated automatically by the system.
Temporal Relation
Temporal Relation is one where each tuple has associated time; either valid time or transaction time
or both associated with it.

 Uni-Temporal Relations: Has one axis of time, either Valid Time or Transaction Time.
 Bi-Temporal Relations: Has both axis of time – Valid time and Transaction time. It
includes Valid Start Time, Valid End Time, Transaction Start Time, Transaction End Time.
Valid Time Example
Now let’s see an example of a person, John:

 John was born on April 3, 1992 in Chennai.


 His father registered his birth after three days on April 6, 1992.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 4

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

 John did his entire schooling and college in Chennai.


 He got a job in Mumbai and shifted to Mumbai on June 21, 2015.
 He registered his change of address only on Jan 10, 2016.
John’s Data In Non-Temporal Database
In a non-temporal database, John’s address is entered as Chennai from 1992. When he registers his
new address in 2016, the database gets updated and the address field now shows his Mumbai address.
The previous Chennai address details will not be available. So, it will be difficult to find out exactly
when he was living in Chennai and when he moved to Mumbai.

Date Real world event Address

April 3, 1992 John is born

April 6, 1992 John’s father registered his birth Chennai

June 21, 2015 John gets a job Chennai

Jan 10, 2016 John registers his new address Mumbai

Table:Non temporal Database

Uni-Temporal Relation (Adding Valid Time To John’s Data)


To make the above example a temporal database, we’ll be adding the time aspect also to the
database. First let’s add the valid time which is the time for which a fact is true in real world. Valid
time is the time for which a fact is true in the real world. A valid time period may be in the past, span
the current time, or occur in the future.

The valid time temporal database contents look like this:


Name, City, Valid From, Valid Till
In our example, john was born on 3rd April 1992. Even though his father registered his birth
three days later, the valid time entry would be 3rd April of 1992. There are two entries for the valid
time. The Valid Start Time and the Valid End Time. So in this case 3rd April 1992 is the valid start
time. Since we do not know the valid end time we add it as infinity.
Johns father registers his birth on 6th April 1992, a new database entry is made:
Person(John, Chennai, 3-Apr-1992, ∞).

Similarly John changes his address to Mumbai on 10th Jan 2016. However, he has been living in
Mumbai from 21st June of the previous year. So his valid time entry would be 21 June 2015.

On January 10, 2016 John reports his new address in Mumbai:


Person(John, Mumbai, 21-June-2015, ∞).

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 5

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

The original entry is updated.


Person(John, Chennai, 3-Apr-1992, 20-June-2015).
The table will look something like this with two additional entries:

Name City Valid From Valid Till

John Chennai April 3, 1992 June 20, 2015

John Mumbai June 21, 2015 ∞

Table:Uni-temporal Database

Bi-Temporal Relation (John’s Data Using Both Valid And Transaction Time)
Next we’ll see a bi-temporal database which includes both the valid time and transaction time.
Transaction time records the time period during which a database entry is made. So, now the
database will have four additional entries the valid from, valid till, transaction
entered and transaction superseded.

The database contents look like this:


Name, City, Valid From, Valid Till, Entered, Superseded
First, when John’s father records his birth the valid start time would be 3rd April 1992, his actual
birth date. However, the transaction entered time would be 6th April 1992.

Johns father registers his birth on 6th April 1992:


Person(John, Chennai, 3-Apr-1992, ∞, 6-Apr-1992, ∞).
Similarly, when john registers his change of address in Mumbai, a new entry is made. The
valid from time for this entry is 21st June 2015, the actual date from which he started living in
Mumbai. whereas the transaction entered time would be 10th January 2016. We do not know how
long he’ll be living in Mumbai. So the transaction end time and the valid end time would be infinity.
At the same time the original entry is updated with the valid till time and the transaction superseded
time.

On January 10, 2016 John reports his new address in Mumbai:


Person(John, Mumbai, 21-June-2015, ∞, 10-Jan-2016, ∞).
The original entry is updated.
Person(John, Chennai, 3-Apr-1992, 20-June-2015, 6-Apr-1992, 10-Jan-2016).

Now the database looks something like this:


Name City Valid From Valid Till Entered Superseded

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 6

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Name City Valid From Valid Till Entered Superseded

John Chennai April 3, 1992 June 20, 2015 April 6, 1992 Jan 10, 2016

John Mumbai June 21, 2015 ∞ Jan 10, 2016 ∞

Bi-temporal Database

Advantages
The main advantages of this bi-temporal relations is that it provides historical and roll back
information. For example, you can get the result for a query on John’s history, like: Where did John
live in the year 2001?. The result for this query can be got with the valid time entry. The transaction
time entry is important to get the rollback information.

 Historical Information – Valid Time.


 Rollback Information – Transaction Time.
 https://www.slideshare.net/janakiraman55/pamppt

Temporal Query

A TemporalQuery can be used to retrieve information from a temporal-based object.

When a temporal table is created in SQL Server, a history table is created behind the scenes.

The main table contains the records as they exist at the current point in time and the history table
contains all the previous versions of records. You can query the main table as normal or add temporal

clauses to your query to find historical records.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 7

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Querying Temporal Tables

There are two main ways to query the history table. The first is looking at previous versions of the

table by adding time-based clauses to your queries. The second is to look into the history table

manually, which lets you see all the previous versions of records.

Creating a Temporal Table

First let’s consider a normal table that we can use as our sample main table. For this post, we’ll work

with a basic person record:


create table dbo.Person
(
[PersonId] int not null primary key clustered,
[Name] nvarchar(max) not null,
[Email] nvarchar(max) null,
[Address] nvarchar(max) null,
[PhoneNumber] nvarchar(max) null
)

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 8

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

That table is not temporal, but having the normal definition to compare it to will highlight what we

need to make it temporal:


create table dbo.Person
(
[PersonId] int not null primary key clustered identity(1,1),
[Name] nvarchar(max) not null,
[Email] nvarchar(max) null,
[Address] nvarchar(max) null,
[PhoneNumber] nvarchar(max) null, [SysStartTime] datetime2 generated always as row start hidden
not null,
[SysEndTime] datetime2 generated always as row end hidden not null,
Period for system_time (SysStartTime, SysEndTime)
)
with (system_versioning = on (history_table = Person_History))

There are two main changes. First, we added SysStartTime and SysEndTime as generated columns

then used that to create the Period column. These are required columns for temporal tables. Making

the start and end time columns hidden is optional, but can help to hide the versioning when it’s not

needed. Second, we added with (system_versioning = on (…)) to the end of the statement. This will

create the history table using the Period column defined above. The default naming for the history

table is kind of messy, so we also defined what the table should be called. I like the _History suffix, so

that’s what we will use here.

2.5 Spatial database


Spatial data is associated with geographic locations such as cities,towns etc. A spatial
database is optimized to store and query data representing objects. These are the objects which are
defined in a geometric space.
A database is a collection of related information that permits the entry, storage, input,
output, and organization of data. A database management system (DBMS) serves as an interface
between users and their databases.

A spatial database includes location. It has geometry as points, lines, and polygons. GIS
combines spatial data from many sources with many different people. Databases connect users to the
GIS database.

For example, a city might have the wastewater division, land records, transportation, and fire
departments connected and using datasets from common spatial databases. Let’s take a closer look at
spatial databases and how we use them in GIS.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 9

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Characteristics of Spatial Database

A spatial database system has the following characteristics

 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.

2.5.1 Spatial Data Types Overview

Spatial data represents information about the physical location and shape of geometric
objects. These objects can be point locations or more complex objects such as countries, roads, or
lakes.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 10

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

SQL Server supports two spatial data types: the geometry data type and the geography data type.

 The geometry type represents data in a Euclidean (flat) coordinate system.


 The geography type represents data in a round-earth coordinate system.

Both data types are implemented as .NET common language runtime (CLR) data types in SQL
Server.

There are two types of spatial data. The geometry data type supports planar, or Euclidean
(flat-earth), data. The geometry data type both conforms to the Open Geospatial Consortium (OGC)
Simple Features for SQL Specification version 1.1.0 and is compliant with SQL MM (ISO standard).
SQL Server also supports the geography data type, which stores ellipsoidal (round-earth) data, such
as GPS latitude and longitude coordinates.

Tip

SQL Server spatial tools is a Microsoft sponsored open-source collection of tools for use with the
spatial types in SQL Server. This project provides a set of reusable functions which applications can
make use of. These functions may include data conversion routines, new transformations, aggregates,
etc.

Spatial data objects

The geometry and geography data types support 16 types of spatial data objects, or instance types.
However, only 11 of these instance types are instantiable; you can create and work with these
instances (or instantiate them) in a database. These instances derive certain properties from their
parent data types.

The figure below shows the geometry hierarchy upon which the geometry and geography data types
are based. The instantiable types of geometry and geography are indicated in blue.

he hierarchy in Figure 1 includes:

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 11

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

 Data types for geographic features that can be perceived as forming a single unit; for
example, individual residences and isolated lakes.
 Data types for geographic features that are made up of multiple units or components; for
example, canal systems and groups of islands in a lake.
 A data type for geographic features of all kinds.

 Data types for single-unit features


Use ST_Point, ST_LineString, and ST_Polygon to store coordinates that define the space
occupied by features that can be perceived as forming a single unit.
 Data types for multi-unit features
Use ST_MultiPoint, ST_MultiLineString, and ST_MultiPolygon to store coordinates that
define spaces occupied by features that are made up of multiple units.
 A data type for all features
You can use ST_Geometry when you are not sure which of the other data types to use.

The subtypes for geometry and geography types are divided into simple and collection types. Some
methods like STNumCurves() work only with simple types.

Simple types are:

 Point
 LineString
 CircularString
 CompoundCurve
 Polygon
 CurvePolygon

Collection types are:

 MultiPoint
 MultiLineString
 MultiPolygon
 GeometryCollection

2.5.2 Spatial Operators and queries


1. Spatial operators :
Spatial operators these operators are applied in geometric properties of objects.
It is then used in the physical space to capture them and the relation among them.
It is also used to perform spatial analysis.
Spatial operators are grouped into three categories :
1. Topological operators :
Topological properties do not vary when topological operations are applied, like translation or
rotation.
Topological operators are hierarchically structured in many levels. The base level offers
operators, ability to check for detailed topological relations between regions with a broad
boundary. The higher levels offer more abstract operators that allow users to query uncertain
spatial data independent of the geometric data model.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 12

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Examples –
open (region), close (region), and inside (point, loop).
2. Projective operators :
Projective operators, like convex hull are used to establish predicates regarding the concavity
convexity of objects.
 Convexity is a measure of the curvature, or the degree of the curve, in the relationship
between bond prices and bond yields.
 Concavity relates to the rate of change of a function's derivative. A function fff is concave
up (or upwards) where the derivative f'f′f, prime is increasing.
Example –
Having inside the object’s concavity.
3. Metric operators :
Metric operators’s task is to provide a more accurate description of the geometry of the object.
They are often used to measure the global properties of singular objects, and to measure the
relative position of different objects, in terms of distance and direction.
Example –
length (of an arc) and distance (of a point to point).
2. Dynamic Spatial Operators :
Dynamic operations changes the objects upon which the operators are applied. Create, destroy, and
update are the fundamental dynamic operations.
Example –
Updation of a spatial object via translate, rotate, scale up or scale down, reflect, and shear.

Table: Main Spatial Operators

Operator Description

SDO_FILTER Specifies which geometries may interact with a given geometry.

SDO_JOIN Performs a spatial join based on one or more topological relationships.

SDO_NN Determines the nearest neighbor geometries to a geometry.

SDO_NN_DISTANCE Returns the distance of an object returned by the SDO_NN operator.

SDO_POINTINPOLYGON Takes a set of rows whose first column is a point's x-coordinate value and

the second column is a point's y-coordinate value, and returns those rows that

are within a specified polygon geometry.

SDO_RELATE Determines whether or not two geometries interact in a specified way.

SDO_WITHIN_DISTANCE Determines if two geometries are within a specified distance from one another.

Table : lists operators, provided for convenience, that perform an SDO_RELATE operation of a
specific mask type.

Spatial Queries

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 13

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

 It is a set of spatial conditions characterized by spatial operators that form the basis for the
retrieval of spatial information from a spatial database system
 A request expressed as a combination of spatial conditions (e.g., Euclidean distance from
a query point) for extracting specific information from a large amount of spatial data without
actually changing these data
 A spatial query is a special type of database query supported by geodatabases. The queries
differ from SQL queries in several important ways. Two of the most important are that they
allow for the use of geometry data types such as points, lines and polygons and that these
queries consider the spatial relationship between these geometries
 A spatial query uses properties and/or relationships that are of spatial nature and are not
explicitly available in the BIM. To process a spatial query the 3D geometry model is
analyzed

The requests for the spatial data which requires the use of spatial operations are called Spatial
Queries.

It can be divided into –


1. Range queries :
It finds all objects of a particular type that are within a given spatial area.
Example –
Finds all hospitals within the Siliguri area. A variation of this query is for a given location, find
all objects within a particular distance, for example, find all banks within 5 km range.
2. Nearest neighbor queries :
It Finds object of a particular type which is nearest to a given location.
Example –
Finds the nearest police station from the location of accident.
3. Spatial joins or overlays :
It joins the objects of two types based on spatial condition, such as the objects which are
intersecting or overlapping spatially.
Example –
Finds all Dhabas on a National Highway between two cities. It spatially joins township objects
and highway object.
Finds all hotels that are within 5 kilometres of a railway station. It spatially joins railway station
objects and hotels objects.
2.6 Spatial Indexing
 A spatial index is a specialized indexing structure where the indexing key is
the spatial location of objects indexed. The type of searches on an spatial index is the
set of spatial queries, for example, range and overlapping queries.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 14

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

 Spatial indexing method divides the space into manageable number of smaller subspaces,
which can be further divided into smaller subspaces and so on. The partitioning continues
until the unpartitioned subspace contains the objects that can be stored in a data page.
While designing the index structures for spatial databases the storage space must be
efficiently utilized and the information retrieval should be fast and easy

 A spatial index is a specialized indexing structure where the indexing key is


the spatial location of objects indexed. The type of searches on an spatial index is the
set of spatial queries, for example, range and overlapping queries

CREATE INDEX nyc_census_blocks_geom_idx


ON nyc_census_blocks
USING GIST (geom);

How Spatial Indexes Work


Standard database indexes create a hierarchical tree based on the values of the column being indexed.
Spatial indexes are a little different – they are unable to index the geometric features themselves and
instead index the bounding boxes of the features.

In the figure above, the number of lines that intersect the yellow star is one, the red line. But the
bounding boxes of features that intersect the yellow box is two, the red and blue ones.
The way the database efficiently answers the question <what lines intersect the yellow star= is to first
answer the question <what boxes intersect the yellow box= using the index (which is very fast) and then
do an exact calculation of <what lines intersect the yellow star= only for those features returned by
the first test.
For a large table, this <two pass= system of evaluating the approximate index first, then carrying out an
exact test can radically reduce the amount of calculations necessary to answer a query.
Both PostGIS and Oracle Spatial share the same <R-Tree= 1 spatial index structure. R-Trees break up
data into rectangles, and sub-rectangles, and sub-sub rectangles, etc. It is a self-tuning index structure
that automatically handles variable data density, differing amounts of object overlap, and object size.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 15

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Data structures like B trees have been designed for efficient insertion and deletion in databases.

Spatial indexing is used to look up the values that match the predicate in efficient manner. There are
two ways to provide spatial indexing:

i.) Dedicated external spatial data structures are added to the system that provide the attributes for
spatial databases e.g. a B-tree does for standard attributes, and

ii.) spatial objects are mapped into a one-dimensional space so that they can be stored within a
standard one dimensional index such as a B-tree.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 16

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

SPATIAL DATA MINING

Spatial data mining refers to the process of the retrieval of information or patterns that are not
explicitly stored in the spatial databases. Spatial data mining methods are used for the better
understanding of spatial data, identifying the relationships between spatial data and non- spatial data,
query optimization in spatial databases etc.

Statistical Spatial analysis is the most commonly and widely used data mining technique. It
assumes that the spatial data are independent which in fact is not true as the spatial data are
interrelated with their neighboring objects. Statistical method cannot handle symbolic values and non
linear rules and are also very costly in the result computation. Several Machine learning techniques
like learning from examples and generalization and specialization are used in spatial data mining.

SPATIAL DATA MINING ARCHITECTURE

Matheus architecture is the most general and widely used architecture in spatial data mining.
This architecture is user controlled. All the predefined information about the objects is stored in the
knowledge base which is fetched by the DB interface for query optimization. The information which

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 17

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

is useful for the pattern recognition is decided by the Focus Component and fed as input to the
pattern extraction. The output is then monitored and evaluated by Evaluation module and duplicate
values are removed. All the components interact using the Controller.

Geographic data consists of the spatial objects and the non spatial information about these
objects (which can be stored in database as a pointer to the spatial description of object). Spatial data
is characterised by geometric as well as topological characteristics where geometric characteristics
involve the information about length, area, perimeter etc and topological characteristics include the
information about neighbours, intrsection etc.

SPATIAL DATA MINING METHODS

Various methods have been designed for mining the data related to geometric space like points,
polygon, rectangles, network and other complex objects. There are various kinds of rules associated
with spatial data mining.

a.) Characteristic Rule: It refers to the general description of object data. Example rule describing the
general price range of shops in various geographic regions of a city.

b.) Discriminant Rule: It refers to the properties or features that distinguish one object from other.
Example the comparison of the various shops prices in different regions.

c.) Association Rule: It refers to the association of one object with other.

2.7 Applications

The following are examples of the kinds of data mining applications that could benefit from
including spatial information in their processing:

 Business prospecting: Determine if colocation of a business with another franchise (such as


colocation of a Pizza Hut restaurant with a Blockbuster video store) might improve its sales.
 Store prospecting: Find a good store location that is within 50 miles of a major city and
inside a state with no sales tax. (Although 50 miles is probably too far to drive to avoid a sales
tax, many customers may live near the edge of the 50-mile radius and thus be near the state
with no sales tax.)
 Hospital prospecting: Identify the best locations for opening new hospitals based on the
population of patients who live in each neighborhood.
 Hotspot Detection-Given a set of geospatial points which are related to an activity in a
spatial domain, hotspots are the regions that are more active and have higher density of points
compared to other regions.
 Spatial region-based classification or personalization: Determine if southeastern United
States customers in a certain age or income category are more likely to prefer "soft" or "hard"
rock music.
 Automobile insurance: Given a customer's home or work location, determine if it is in an
area with high or low rates of accident claims or auto thefts.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 18

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

 Property analysis: Use colocation rules to find hidden associations between proximity to a
highway and either the price of a house or the sales volume of a store.
 Property assessment: In assessing the value of a house, examine the values of similar houses
in a neighborhood, and derive an estimate based on variations and spatial correlation.

2.8 Mobile Databases: Location and Handoff Management

Location Management: In cellular systems a mobile unit is free to move around within the entire
area of coverage. Its movement is random and therefore its geographical location is unpredictable.
This situation makes it necessary to locate the mobile unit and record its location to HLR and
VLR when a call has to be delivered to it.
Thus, the entire process of the mobility management component of the cellular system is
responsible for two tasks:
(a) location management- identification of the current geographical location or current
point of attachment of a mobile unit which is required by the MSC (Mobile Switching Center) to
route the call.
(b) handoff- transferring (handing off) the current (active) communication session to the
next base station, which seamlessly resumes the session using its ownset of channels.
One of the main objectives of efficient location management schemes is to minimize the
communication overhead due to database updates (mainly HLR).

The current point of location of a subscriber (mobile unit) is expressed in terms of the cell
or the base station to which it is presently connected. The mobile units (called and calling
subscribers) can continue to talk and move around in their respective cells; but as soon as both or
any one of the units moves to a different cell,the location management procedure is invoked to
identify the new location.

The location management performs three fundamental tasks:


(a) location update, (b) location lookup, and (c) paging.
Location update-is initiated by the mobile unit, the current location of the unit is
recorded in HLR and VLR databases.
Location lookup- a database search to obtain the current location of the mobile unit.
Paging -the system informs the caller the location of the called unit in termsof its current
base station. These two tasks are initiated by the MSC .

The cost of update and paging increases as cell size decreases,which becomes quite
significant for finer granularity cells such as micro- or picocell clusters. The presence of frequent
cell crossing, which is a common scenario in highly commuting zones, further adds to the cost.
The system creates location areas and paging areas to minimize the cost.
A number of neighbouring cells are grouped together to form a location area, and the
paging area is constructed in a similar way. It is useful to keep the same set of cells for creating
location and paging areas, and in most commercial systems they are usually identical. This
arrangement reduces location update frequency because location updates are not necessary when a
mobile unit moves in the cells of a location area. A large number of schemes to achieve low cost
and infrequent update have been proposed, and new schemes continue to emerge as cellular
technology advances.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 19

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

A mobile unit can freely move around in


(a) active mode, (b) doze mode, or (c) power down mode.
In active mode, the mobile actively communicates with other subscriber, and it may
continue to move within the cell or may encounter a handoff which may interrupt the
communication. It is the task of the location manager to find the new location and resume the
communication.
In doze mode a mobile unit does not actively communicate with other subscribers but
continues to listen to the base station and monitors the signal levels around it
In Power down mode the unit is not functional at all.

When it moves to a different cell in doze or power down modes,then it is neither possible
nor necessary for the location manager to find the location.

The location management module uses a two-tier scheme for location- related tasks. The
first tier provides a quick location lookup, and the second tier search is initiated only when the first
tier search fails.

Location Lookup:A location lookup finds the location of the called party to establish the
communication session. It involves searching VLR and possibly HLR. Figure 3.1 illustrates the

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 20

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Handoff technology
In cellular communications, the handoff is the process of transferring an active call or data
session from one cell in a cellular network or from one channel to another. In satellite
communications, it is the process of transferring control from one earth station to another. Handoff is
necessary for preventing loss of interruption of service to a caller or a data session user. Handoff is
also called handover.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 21

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Situations for triggering Handoff

Handoffs are triggered in any of the following situations −


 If a subscriber who is in a call or a data session moves out of coverage of one cell and enters
coverage area of another cell, a handoff is triggered for a continuum of service. The tasks that
were being performed by the first cell are delineating to the latter cell.
 Each cell has a pre-defined capacity, i.e. it can handle only a specific number of subscribers. If
the number of users using a particular cell reaches its maximum capacity, then a handoff
occurs. Some of the calls are transferred to adjoining cells, provided that the subscriber is in
the overlapping coverage area of both the cells.
 Cells are often sub-divided into microcells. A handoff may occur when there is a transfer of
duties from the large cell to the smaller cell and vice versa. For example, there is a traveling
user moving within the jurisdiction of a large cell. If the traveler stops, then the jurisdiction is
transferred to a microcell to relieve the load on the large cell.
 Handoffs may also occur when there is an interference of calls using the same frequency for
communication.

Types of Handoffs

There are two types of handoffs −


 Hard Handoff − In a hard handoff, an actual break in the connection occurs while switching
from one cell to another. The radio links from the mobile station to the existing cell is broken
before establishing a link with the next cell. It is generally an inter-frequency handoff. It is a
<break before make= policy.
 Soft Handoff − In soft handoff, at least one of the links is kept when radio links are added and
removed to the mobile station. This ensures that during the handoff, no break occurs. This is
generally adopted in co-located sites. It is a <make before break= policy.

 Mobile Assisted Handoff

Mobile Assisted Handoff (MAHO) is a technique in which the mobile devices assist the Base Station
Controller (BSC) to transfer a call to another BSC. It is used in GSM cellular networks. In other

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 22

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

systems, like AMPS, a handoff is solely the job of the BSC and the Mobile Switching Centre (MSC),
without any participation of the mobile device. However, in GSM, when a mobile station is not
using its time slots for communicating, it measures signal quality to nearby BSC and sends this
information to the BSC. The BSC performs handoff according to this information.
2.9 Deductive database
A deductive database is a database system that can make deductions (i.e. conclude additional
facts) based on rules and facts stored in the (deductive) database. Datalog is the language typically
used to specify facts, rules and queries in deductive databases. Deductive databases have grown out
of the desire to combine logic programming with relational databases to construct systems that
support a powerful formalism and are still fast and able to deal with very large datasets. Deductive
databases are more expressive than relational databases but less expressive than logic programming
systems. In recent years, deductive databases such as Datalog have found new application in data
integration, information extraction, networking, program analysis, security, and cloud computing.
Deductive databases reuse many concepts from logic programming; rules and facts specified
in the deductive database language Datalog look very similar to those in Prolog. However important
differences between deductive databases and logic programming:

 Order sensitivity and procedurality: In Prolog, program execution depends on the order of rules
in the program and on the order of parts of rules; these properties are used by programmers to
build efficient programs. In database languages (like SQL or Datalog), however, program
execution is independent of the order of rules and facts.
 Special predicates: In Prolog, programmers can directly influence the procedural evaluation of
the program with special predicates such as the cut, this has no correspondence in deductive
databases.
 Function symbols: Logic Programming languages allow function symbols to build up complex
symbols. This is not allowed in deductive databases.
 Tuple-oriented processing: Deductive databases use set-oriented processing while logic
programming languages concentrate on one tuple at a time.

A Deductive Database is a type of database that can make conclusions or we can say
deductions using a sets of well defined rules and fact that are stored in the database. In today’s
world as we deal with a large amount of data, this deductive database provides a lot of advantages.
It helps to combine the RDBMS with logic programming. To design a deductive database a purely
declarative programming language called Datalog is used.

The implementations of deductive databases can be seen in LDL (Logic Data Language),
NAIL (Not Another Implementation of Logic), CORAL, and VALIDITY.
The use of LDL and VALIDITY in a variety of business/industrial applications
1. LDL Applications:
This system has been applied to the following application domains:
 Enterprise modelling
 Hypothesis testing or data dredging
 Software reuse
2. VALIDITY Applications:
 Electronic commerc
 Rules-governed processes

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 23

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

 Knowledge discovery
 Concurrent Engineering

2.10 Multimedia Database


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.

Contents of the Multimedia Database

The multimedia database stored the multimedia data and information related to it. This is given in
detail as follows −
Media data
This is the multimedia data that is stored in the database such as images, videos, audios, animation
etc.
Media format data
The Media format data contains the formatting information related to the media data such as
sampling rate, frame rate, encoding scheme etc.
Media keyword data
This contains the keyword data related to the media in the database. For an image the keyword data
can be date and time of the image, description of the image etc.
Media feature data
Th Media feature data describes the features of the media data. For an image, feature data can be
colours of the image, textures in the image etc.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 24

Downloaded by MCA HOD ([email protected])


lOMoARcPSD|24538650

MC4202 – ADVANCE DATABASE TECHNOLOGY UNIT - II

Challenges of Multimedia Database

There are many challenges to implement a multimedia database. Some of these are:

 Multimedia databases contains data in a large type of formats such as .txt(text), .jpg(images),
.swf(videos), .mp3(audio) etc. It is difficult to convert one type of data format to another.
 The multimedia database requires a large size as the multimedia data is quite large and needs
to be stored successfully in the database.
 It takes a lot of time to process multimedia data so multimedia database is slow.
Multimedia databases are the main source of interaction between users and multimedia elements.
Multimedia storage is characterised by the following −
 Massive storage volumes.
 Large object sizes.
 Multiple related objects.
 Temporal requirements for retrieval.

A multimedia database system stores and manages a large collection of multimedia data, such
as audio, video, image, graphics, speech, text, document, and hypertext data, which contain text,
text markups, and linkages. Multimedia database systems are increasingly common owing to the
popular use of audio-video equipment, digital cameras, CD-ROMs, and the Internet. There are
multimedia database systems include NASA’s EOS (Earth Observation System), various kinds
of image and audio video databases, and Internet databases.
There is two main groups of multimedia indexing and retrieval systems which are as follows –

Description-based retrieval systems − It is used to build indices and perform object retrieval
based on image descriptions, such as keywords, captions, size, and time of creation. Description-
based retrieval is labor-intensive if performed manually. If automated, the results are typical of
poor quality.

For instance, the assignment of keywords to images can be a difficult and arbitrary service.
The latest development of Web-based image clustering and classification techniques has
enhanced the quality of definition-based Web image retrieval because image surrounded text
information and Web linkage information can be used to extract proper description and group
images describing a similar theme together.

Content-based retrieval systems − It can support retrieval based on the image content, such as
color histogram, texture, pattern, image topology, and the shape of objects and their layouts and
locations within the image. Content-based retrieval facilitates visual characteristics to index
images and improves object retrieval based on feature similarity, which is highly desirable in
several applications.
In a content-based image retrieval system, there are often two kinds of queries − image
sample-based queries and image feature specification queries. Image-sample-based queries find
all of the images that are similar to the given image sample. This search analyzes the feature
vector (or signature) extracted from the sample with the feature vectors of images that have been
extracted and ordered in the image database.

Prepared By.E.Janakiraman.MCA,Mphil,. Assistant Professor-MCA/APEC Page 25

Downloaded by MCA HOD ([email protected])

You might also like