Title: Introduction to Moving Objects Databases
1Introduction to Moving Objects Databases
2Questions about Moving Objects
3Moving Objects Databases
- Moving objects database is a database that can
represent and query moving objects - Moving object is a geometry that changes over
time continuosly - How to extend database technology to support
moving object databases? -
4Outline of this lecture
- Database Management Systems
- Spatial Databases
- Temporal Databases
- Moving Objects in Databases
5Database Management Systems
- Database management system (DBMS) is a piece of
software that manages a database - Database is a repository of interrelated data
items that are central to the business of an
enterprise/institution - Physical level
- Data organization on storage media (files)
- Logical level
- Data model and query/data manipulation language
- E.g., relational data model and SQL
- External views
- Application-specific view of data from logical
level
6Database Management Systems
- Classical database management systems were
conceived for relatively simple business
applications - E.g., in the relational data model, simple data
types (integers, floating-point numbers, short
text strings) - We would like to widen the scope
- Data Images, geographic maps, music, videos,
data from scientific experiments, meteorological
measurements - Queries
- Retrieve images containing shapes similar to a
given one - Produce a map of rainfall over some terrain
- In order to formulate queries in a simple manner
and to process queries efficiently, we need to
extend data model and query language
7Limitations of Classical Databases
- No way to represent geometric shapes
- Representation of a region as a collection of
coordinates in numeric attributes is difficult to
handle - No way to represent development of entities over
time - Past state of the world is not kept
- No way to represent objects moving right now
- Continuous updates are not feasible
8Outline of this lecture
- Database Management Systems
- Spatial Databases
- Temporal Databases
- Moving Objects in Databases
9Spatial Databases
- Spatial database (DBMS) allows representing and
querying geometries in a natural way - Entities to be stored in a spatial database
- Cities, rivers, road networks, landmarks,
boundaries of countries, hospitals, subway
stations, forests, corn fields - Fundamental abstractions
- Single objects point, line, region
- Spatially related collections of objects
partition, network
10Extending Data Model and Query Language ADTs
(ROSE Algebra)
- Spatial data type (SDT) is a structure (e.g.,
region) - Algebra is a collection of abstract data types,
e.g., STDs, with related operations - Algebra must be closed under its operations!
- The ROSE algebra
- STDs points, region, line
- Other data types real, bool,
- Operations
- Contour region ? line
- Length line ? real
- Inside points x region ? bool
- Adjacent region x region ? bool
- Intersection line x line ? points
- Minus region x region ? region
11Extending Data Model and Query Language ATDs
(ROSE Algebra)
- We embed SDTs into a DBMS data model (e.g., into
a relational model) in the role of attribute
types - Sample relations
- Cities (name string, population int, location
points) - Rivers (name string, route line)
- Highways (name string, route line)
- States (name string, area region)
- Sample queries
- What is the total population of cities in
France? - SELECT SUM(c.population)
- FROM cities AS c, states AS s
- WHERE c.location inside s.area AND s.name
FRANCE - Return the part of the river Rhine that is
within Germany - SELECT intersection (r.route, s.area)
- FROM rivers AS r, states AS s
- WHERE r.name RHINE AND s.name GERMANY
12Extending Data Model and Query Language ATDs
(ROSE Algebra)
- Implementation strategy
- Data structures for SDTs
- Algorithms for SDTs operations
- Spatial index structures
- Extension of the optimizer
- Cost functions for all methods
- Statistics about the distributions of objects in
space, - needed for selectivity estimation
- Translation rules
- User interface extensions to handle presentation
of spatial data and input of spatial values for
querying - Some of these have become available in commercial
systems - Good extensibility by attribute data types and
operations - Oracle, IBM DB2, Informix, MySQL
13Outline of this lecture
- Database Management Systems
- Spatial Databases
- Temporal Databases
- Moving Objects in Databases
14Temporal Databases
- Standard DBMS describe the current state of the
world - A change in the world leads to update in the
database - Previous state is lost!
Department
Name
Toys
Lisa
Department
Name
Books
Lisa
15Temporal Databases
- Application can manage time itself
- Explicit attribute of type date or time
- Sample relation
- Disadvantages of this approach
- Complex query formulation
- Inefficient query processing
16Temporal Databases
- Temporal projection
- What is Bobs current salary?
- select Salary
- from Employee
- where Name Bob and
- Start lt CURRENT_DATE and
- Stop gt CURRENT_DATE
17Temporal Databases
- Sample relation
- Compute the salary history
- What is Bobs salary history?
-
- Need to coalesce consecutive, value-equivalent
tuples
18Temporal Databases
- Salary history in standard SQL
19Temporal Databases
- Computing salary history is easy now
- select Name, Salary, Start, Stop
- from Employee1
- where Name Bob
20Temporal Databases
- How to compute the history of salary and title
(original relation)? - Need temporal join
21Temporal Databases
- Need to analyze how each tuple of Employee1
- overlaps each tuple of Employee2
22Temporal Databases
- Temporal join in standard SQL
23The Time Domain
- Time is a one-dimensional space extending from
the past to the future - Different models of time
- Bounded vs. infinite
- Discrete vs. continuous
- Discrete and continuous time
- With discrete time, atomic time intervals
(chronons) are isomorfic to natural numbers - With continuous time, points in time are
isomorfic to real numbers
24Time Dimension
- Two kinds of time
- Valid time is the time in the real world when an
event occurs or a fact is valid - Transaction time is the time when a change is
recorded in the database or a time interval
during which a particular state of the database
exists - Temporal database (DBMS) is a database (DBMS)
that supports valid time and/or transaction time
25Extending Data Models
- General approach
- Database facts are associated with timestamps
- Alternatives
- Data model extended
- Relational vs. object-oriented
- Granularity of facts
- Tuples/objects vs. attributes
- Kind of timestamp
- a single chronon (instant)
- a single time period (period)
- a temporal element (periods)
- Time dimension
- Valid time
- Transaction time
- Both dimensions
26Extending Model Valid-Time Relations
- On January 1, Lisa started
- to work in the toys department and is
- expected to work there until January 15
2. On January 8, Lisa moved to the books
department and is expected to work there until
January 15
3. On January 14, Lisa moved back to the toys
department and is expected to work there until
January 20
27Extending Model Transaction-Time Relations
- On January 6, it was recorded
- that Lisa worked in the toys department
2. On January 10, it was recorded that Lisa had
moved to the books department
2. On January 12, it was recorded that Lisa had
moved back to the toys department
28Extending Data Model Bitemporal Relations
- On January 6, it was recorded that Lisa had
started working in the toys department on January
1 and was expected to work there until January 15
2. On January 10, it was recorded that Lisa had
moved to the books department on January 8. She
was still expected to work until January 15.
2. On January 12, it was recorded that Lisa would
move back to the toys department on January 14
and would stay there until January 20
29Extending Data Model BCDM model
- Data model extended relational
- Granularity of facts tuple
- Model of time bounded, discrete
- Kind of timestamp a single chronon
- Time dimension both dimensions
30Extending Query Language TSQL2
- TSQL2
- is a superset of SQL92
- is based on BCDM model
- supported by TimeDB (ETH Zurich)
- Sample data definition command
- CREATE TABLE prescription (
- name char(30),
- drug char(30),
- dosage char(30) )
- AS VALID DAY AND TRANSACTION
- Kinds of relations
- Snapshot
- Valid-time
- Transaction-time
- Bitemporal
31Extending Query Language TSQL2
- Sample queries
- What has ever been prescribed any drugs?
- SELECT SNAPSHOT name
- FROM prescription
- What drugs were prescribed to Lisa?
- SELECT drug
- FROM prescription
- WHERE name Lisa
- What drugs have been prescribed together with
aspirin? - SELECT p1.name, p2.drug
- FROM prescription AS p1, prescription AS p2
- WHERE p1.drug aspirin AND
p2.drugltgtaspirin - AND p1.name p2.name
- Which drugs were Lisa prescribed during 1999?
- SELECT p.drug
- FROM prescription AS p
- WHERE p.name Lisa AND VALID(p) OVERLAPS
PERIOD 1999 DAY - What did the physician believe on September 10,
1998, was Lisas prescription history? - SELECT drug
32Outline of this lecture
- Database Management Systems
- Spatial Databases
- Temporal Databases
- Moving Objects in Databases
33Moving Objects in Databases
- Moving object is a geometry that changes over
time continuosly - Moving objects database is a database that can
represent and query moving objects - Two perspectives on
- moving objects databases
- Location management perspective
- Spatio-temporal data perspective
34Location Management Perspective
- Location management database is a snapshot
database that is used to - maintain dynamically the locations of a set of
currently moving objects - ask queries about the current or near-future
positions of - the moving objects (monitoring)
- Main task
- Keeping the positions of a set of objects in a
database, - e.g., a set of taxi cars, up-to-date
- Scenario
- Moving objects send their current positions to
the database and - the database performs updates
- Trade-off
- If updates performed very often, then
- the error is small
- the update load is very high
- If updates performed less frequently, then
- the update load is low
- the error is large
- Solution
- Additionaly, store speed and direction of moving
objects
35Spatio-Temporal Data Perspective
- Spatio-temporal database is a spatial database
that keeps history of changes to spatial objects - Two basic questions
- What kinds of data are stored in spatio-temporal
databases? - Point, line, region, network, partition
- Which kinds of change may occur?
- Discrete change any kind of data
- Continuous change point and region
- Moving object is a geometry that experience
continuous changes - Two most important abstractions of moving
objects - Moving point is an abstraction of a physical
object moving around in the plane, for which only
position is relevant - Moving region is an abstraction of an entity in
the plane that changes its position, extent, and
shape
36Extending Data Model and Query Language
Temporal Database with SDTs
- Idea
- Use a temporal DBMS and extend it with spatial
data types (SDTs). - Example TSQL2/BCDM extended with the ROSE
algebra - Sample data definition command
- CREATE TABLE real_estate (
- owner char(30),
- area region)
- AS VALID DAY
- Sample query
- Show the properties adjacent to the property
of Charles Smith as of March 17, 1977 - SELECT r2.area
- FROM real_estate AS r1, real_estate AS r2
- WHERE r1.owner Charles Smith AND
- VALID(r1) OVERLAPS DATE 1977-03-17 AND
- r1.area ADJACENT r2.area
- This approach supports discrete changes, but does
not support moving objects, i.e., continuous
changes!
37Extending Data Model and Query LanguageSpatio-Te
mporal Data Types
- Idea
- Use spatio-temporal data types with suitable
operations as attribute types in a snapshot DBMS
- Spatio-temporal data types mpoint, mregion
- Operations
- Intersection mpoint x mregion ? mpoint
- Distance mpoint x mpoint ? mreal
- Min mreal ?
real - Trajectory mpoint ?
line - Deftime mpoint ?
periods - At_time mregion x instant ?
region - At_time mbool x instant ?
bool - Length line ?
real - Adjacent mregion x mregion ? mbool
- This approach can manage both discrete and
continuous changes!
38Extending Data Model and Query Language
Spatio-Temporal Data Types
- Sample relations
- real_estate (owner char(30), areamregion)
- flight (id string, from string, to string,
route mpoint) - weather(id string, kind string, area mregion)
- Sample queries
- Show the properties adjacent to the property of
Charles Smith as of March 17, 1977 - SELECT at_time(r2.area, instant(March 17,
1977)) - FROM real_estate AS r1, real_estate AS r2
- WHERE r1.owner Charles Smith AND
- defined(adjacent(r1.area, r2.area),
- instant(March 17, 1977)) true
- Retrieve any pairs of airplanes, which, during
their flight, came closer to each other than 500
meters - SELECT f.id, g.id
- FROM flight AS f, flight AS g
- WHERE f.id ltgt g.id AND min(distance(f.route,g.
route)) lt 0.5 - At what time was flight BA488 within the
snowstorm with ID S16? - SELECT deftime(intersection(f.route, w.area))
- FROM flight AS f, weather AS w
- WHERE f.id BA488 AND w.id S16
39Summary
- Moving object databases are databases that allow
efficiently representing and querying moving
objects - Moving object is a geometry that changes
continuously - Classical data models and query languages (and
their implementations) need to be extended to
support moving objects - Spatial extension
- Spatial databases SDTs with operations (ROSE
algebra) - Temporal extension
- Temporal databases BCDM data model and TSQL2
- Spatio-temporal extensions
- Temporal databases with SDTs
- Spatio-temporal data types with related
operations - Location management database