Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
GeoInformation Group
Image Processing Division – DPI
The Architecture of a
Flexible Querier for SpatioTemporal Databases
Karine Reis Ferreira
Lúbia Vinhas
Gilberto Ribeiro de Queiroz
Ricardo Cartaxo Modesto de Souza
Gilberto Câmara
Introduction
Challenge to GISystems: use spatially enabled DBMS to
build innovative applications which deal with spatiotemporal data
How to address it:
ST Types and their associated Algebra (Gutting, 2005)
Conceptual models, E-R models for ST-Data (Pelekis et al,
2004)
ST Query Languages (ISO, 2001)
ST Predicates (Egenhofer and Franzosa, 1991; Allen,1983)
Which is the canonical set of ST Predicates?
Application specialized subset
Building blocks that can be combined (Erwig and Schneider, 2002)
Introduction
How to design a flexible query processor for spatiotemporal data using object-relational DBMS?
Some aspect to be considered:
Applications are different: in terms of queries and responses
An unified and flexible architecture is desired
Layers
A geographical database is composed by layers
Layers contain Spatio-Temporal Objects (ST-Objects)
Static Layers:
ST-Objects do not change along the time, neither in their
descriptive or geometrical attributes
Temporal Layers
ST-Objects change along the time, either in their descriptive or
geometrical attributes
ST-Instance represent version in a given time of a ST-Object
Database Model
Ex: a layer of districts of a city
Data
Metdata
layers
DistrictsG
geomId:
int
objId:
string
spatialD:
spatial
1
D1
bbbbbbbbbbbbb
2
D2
bbbbbbbbbbbbb
3
D3
bbbbbbbbbbbbb
DistrictsA
CODDIS:
string
NOME:
string
POP:
int
D1
Agua Rasa
85896
D2
Cangaiba
137442
D3
Capão Redondo
240793
layerId:
int
layerName:
string
1
Distritos
representations
layerId:
int
geomRelatio:
string
1
DistrictsG
attributesRel
layerId:
int
attrRelation:
string
1
DistrictsA
Database Model
Initial State
DistrictsG
geomId:
int
objId:
string
spatialD:
spatial
1
D1
bbbbbbbbbbbbb
2
D2
bbbbbbbbbbbbb
3
D3
bbbbbbbbbbbbb
DistrictsStatus
attrInst
string
geomInst:
string
timeI:
time
1
1
01/01/2003
2
2
01/01/2003
3
3
01/01/2003
DistrictsA
CODDIS:
string
NOME:
string
POP:
int
attrInst
string
D1
Agua Rasa
85896
1
D2
Cangaiba
137442
2
D3
Capão Redondo
240793
3
timeF:
time
Database Model
Change in Geometry
DistrictsG
geomId:
int
objId:
string
spatialD:
spatial
1
D1
bbbbbbbbbbbbb
2
D2
bbbbbbbbbbbbb
3
D3
4
D1
DistrictsStatus
bbbbbbbbbbbbb
attrInst
string
geomInst:
string
timeI:
time
timeF:
time
bbbbbbbb
1
1
01/01/2003
31/12/2003
2
2
01/01/2003
3
3
01/01/2003
1
4
31/12/2003
DistrictsA
CODDIS:
string
NOME:
string
POP:
int
attrInst
string
D1
Agua Rasa
85896
1
D2
Cangaiba
137442
2
D3
Capão Redondo
240793
3
Database Model
Change in Attributes
DistrictsG
geomId:
int
objId:
string
spatialD:
spatial
1
D1
bbbbbbbbbbbbb
2
D2
bbbbbbbbbbbbb
3
D3
4
D1
DistrictsStatus
bbbbbbbbbbbbb
attrInst
string
geomInst:
string
timeI:
time
timeF:
time
bbbbbbbb
1
1
01/01/2003
31/12/2003
2
2
01/01/2003
01/06/2004
3
3
01/01/2003
1
4
31/12/2003
4
2
01/06/2004
DistrictsA
CODDIS:
string
NOME:
string
POP:
int
attrInst
string
D1
Agua Rasa
85896
1
D2
Cangaiba
137442
2
D3
Capão Redondo
240793
3
D2
Cangaiba
150000
4
Database Model
Change in Attributes
and Geometry
DistrictsG
geomId:
int
objId:
string
spatialD:
spatial
1
D1
bbbbbbbbbbbbb
2
D2
bbbbbbbbbbbbb
3
D3
4
5
DistrictsStatus
bbbbbbbbbbbbb
attrInst
string
geomInst:
string
timeI:
time
timeF:
time
D1
bbbbbbbb
1
1
01/01/2003
31/12/2003
D3
bbbb
2
2
01/01/2003
01/06/2004
3
3
01/01/2003
21/09/2004
1
4
31/12/2003
4
2
01/06/2004
5
5
21/09/2004
DistrictsA
CODDIS:
string
NOME:
string
POP:
int
attrInst
string
D1
Agua Rasa
85896
1
D2
Cangaiba
137442
2
D3
Capão Redondo
240793
3
D2
Cangaiba
150000
4
D3
Capão Redondo
250000
4
ST Data - Examples
Crime events: crime
occurrences in a city,
specifying its time and
location
Which crimes happened
on Friday in the Humaitá
district of Porto Alegre
city?
ST Data - Examples
Epidemiological data: the
weekly counting of mosquito
eggs in a set of traps arbitrarily
deployed over a city
http://saudavel.dpi.inpe.br/
How many eggs were counted
by trap in each month?
ST Data - Examples
Land parcels
For each month, which changes occurred in the parcels?
The Querier Processor Architecture
Application Program Interface
Application
Parameters
ST Instances
Processing
Querier
SQL
ST Data
Spatio-temporal Database
PostGIS
MySQL
…
Oracle
Querier Parameters
Layer: the source of the ST-Instances
Chronon: defines how the time extension of the layer
should be divided into a set of time frames
second, minute, hour, day, month, year, day of
week, day of month, day of year, month of year,
week of year, hour of day, minute of hour or
second of minute
Querier Parameters
Aggregate functions: how to group a set of ST-Instances
of a time frame in a representative one
average, sum, counting, variance maximum or
minimum,
Which time frames will be retrieved:
controls if the Querier should returns either every time frame
existent in the total interval of the data or only the time frames
where some change occurred
Querier Parameters
Temporal predicate: defines a relation between the data
and the time frames (as specified by the Chronon)
temporal interval predicates: equals, before, after, meets,
during, overlaps, ends or starts [Allen,1983]
Spatial predicate: defines a relation between the data
and a geometry
disjoint, touches, crosses, within, overlaps,
contains, intersects, equals, covers and covered by
[Egenhofer and Franzosa, 1991]
Querier Examples
Return all crime events, their location and properties
CrimeLayer = database->getLayer (“Crimes”);
Source of the ST Data
Querier Examples
Return all crime events, their location and properties
CrimeLayer = database->getLayer (“Crimes”);
Querier->setParams(loadGeometries, loadAllAttributes);
Querier->setParams(CrimeLayer);
Set parameters
Querier Examples
Return all crime events, their location and properties
CrimeLayer = database->getLayer (“Crimes”);
Querier->setParams(loadGeometries, loadAllAttributes);
Querier->setParams(CrimeLayer);
Querier->loadInstances();
Run the query processor
Querier Examples
Return all crime events, their location and properties
CrimeLayer = database->getLayer (“Crimes”);
Querier->setParams(loadGeometries, loadAllAttributes);
Querier->setParams(CrimeLayer);
Querier->loadInstances();
while (Querier->fetchInstance(sti)) {
Geometry = sti.getGeometry();
Properties = sti.getProperties();
Time = sti.getTime();
}
Consume the instances
Querier Examples
Which crimes happened in 2003 in the district “Cabanga” of
Recife city?
DistrictLayer = database->getLayer (“Districts”);
DistrictGeometry = DistrictLayer->getGeometry(“Cabanga”);
Querier Examples
Which crimes happened in 2003 in the district “Cabanga” of
Recife city?
DistrictLayer = database->getLayer (“Districts”);
DistrictGeometry = DistrictLayer->getGeometry(“Cabanga”);
Querier->setParams(loadGeometries, loadAllAttributes);
Querier->setParams(CrimeLayer, year, ChangedTimeFrames);
Querier->setSpatialRestriction(DistrictGeometry,within);
Querier Examples
Which crimes happened in 2003 in the district “Cabanga” of
Recife city?
DistrictLayer = database->getLayer (“Districts”);
DistrictGeometry = DistrictLayer->getGeometry(“Cabanga”);
Querier->setParams(loadGeometries, loadAllAttributes);
Querier->setParams(CrimeLayer, year, ChangedTimeFrames);
Querier->setSpatialRestriction(DistrictGeometry,within);
TimeFrame = Querier->getTimeFrame(‘2003’);
Querier->loadInstances(TimeFrame);
while (Querier->fetchInstance(sti)) {
...
}
Querier Examples
How many eggs were counted in each trap in each month?
TrapLayer = database->getLayer (“Traps”);
Querier Examples
How many eggs were counted in each trap in each month?
TrapLayer = database->getLayer (“Traps”);
GroupingAttributes->insert(“num_eggs”, SUM);
Querier->setParams(loadGeometries, GroupingAttributes);
Querier->setParams(TrapLayer, month, ChangedTimeFrames);
Querier Examples
How many eggs were counted in each trap in each month?
TrapLayer = database->getLayer (“Traps”);
GroupingAttributes->insert (“num_eggs”, SUM);
Querier->setParams(loadGeometries, GroupingAttributes);
Querier->setParams(TrapLayer, month, ChangedTimeFrames);
numTimeFrames = Querier->getNumTimeFrames();
for (frame=0 to numTimeFrames)
Querier->loadInstances(frame);
while (Querier->fetchInstance(sti))
...
Querier Examples
Which changes occurred in the land parcels in each month?
ParcelLayer = database->getLayer (“Parcels”);
Querier Examples
Which changes occurred in the land parcels in each month?
ParcelLayer = database->getLayer (“Parcels”);
Querier->setParams(loadGeometries, loadAllAttributes);
Querier->setParams(ParcelLayer, month,ChangedTimeFrames,
Starts | Ends);
Querier Examples
Which changes occurred in the land parcels in each month?
ParcelLayer = database->getLayer (“Parcels”);
Querier->setParams(loadGeometries, loadAllAttributes);
Querier->setParams( ParcelLayer, month,ChangedTimeFrames,
Starts | Ends);
numTimeFrames = Querier->getNumTimeFrames();
for (frame=0 to numTimeFrames)
Querier->loadInstances(frame);
while (Querier->fetchInstance(sti))
...
The Database Change Observer
The Querier mechanism is being implemented in the
TerraLib environment
TerraLib spatial and temporal structures
TerraLib Generic Database Application Interface
Support to: MySQL, Oracle Spatial, PostGIS, PostgreSQL…
www.terralib.org
The application shows the status of a spatio-temporal
database
ST Database Observer
Observing the crime events
Observing the crime events
Observing the egg traps
Observing the egg traps
Observing the egg traps
Observing the egg traps
Observing the land parcels
Observing the land parcels
Observing the land parcels
Observing the land parcels
Observing the land parcels
Final Remarks
The proposed architecture of a geographical database
fulfills the demands of our spatio-temporal applications
The spatio-temporal database model is simple and can be
implemented in different DBMS
A Querier Mechanism based on the combination of
spatial and temporal parameters is a flexible alternative
to deal with the different applications
Future Improvements
The Querier mechanism has to deal with two layers:
Ex: fire spots and deforestation: two different data set that is
highly related in space and in time
Build a catalog of some well-known operations such as
“trajectory” using the Querier mechanism
Study the possibility of using the Querier mechanism as
a processor for a ST-Language
The Architecture of a
Flexible Querier for SpatioTemporal Databases
{karine, lubia, gribeiro, cartaxo, gilberto}@dpi.inpe.br
GeoInformation Group
Image Processing Division
www.dpi.inpe.br