26
Spatio-temporal Databases Time Parameterized Queries

Spatio-temporal Databases Time Parameterized Queries

  • View
    232

  • Download
    2

Embed Size (px)

Citation preview

Spatio-temporal Databases

Time Parameterized Queries

Intro The results of conventional spatial queries are

not very useful in dynamic environments because they may be invalidated very soon due to the movements of objects and queries.

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

e

c

d

the query qat current time

moving eastat speed 1

The Time Parameterized (TP) Window Query

Returns: The current query result R The validity period T of R The change of result C at the end of T

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

e

c

d

the query qat current time

moving eastat speed 1

R={b}

Result:

The TP Window Query Returns:

The current query result R The validity period T of R The change of result C at the end of T

R={b}, T=1, C={-b}

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

e

c

d

the query q at time 1

Result:

The TP Nearest Neighbor Query Returns:

The current query result R The validity period T of R The change of result C at the end of T

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

ec

d

query qf

g R={d}

Result:

The TP Nearest Neighbor Query Returns:

The current query result R The validity period T of R The change of result C at the end of T

R={d}, T=1.5, C={f}

Result:

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

ec

d

query q fat time 1.5

g

The TP Spatial Join Query

R={(A1, B1), (B3, A4)}

Result:

20 4 6 8 10

2

4

6

8

10

x axis

y axis

A1

A2

A3

A4

A5

B1

B2

B3

11

1 1

1

1

The TP Spatial Join Query

R={(A1, B1), (B3, A4)}T={1}C={A3, B2}

Result:

20 4 6 8 10

2

4

6

8

10

x axis

y axis

A1

A2

A3

A4

A5

B1

B2

B3

11

1 1

1

1

Point Nearest Neighbor (NN) Queries[Roussopoulos et al SIGMOD95, Hjaltason and Samet TODS 99]

Branch and bound algorithms use mindist between the query point q and an R-tree entry E, to prune the search space: mindist(E, q) = The minimum distance between E and q

20 4 6 8 10

2

4

6

8

x axis

y axis

E1

E2

qmindist(q,E2 )

mindist(q,E1 )

Nearest Neighbor Search (NN) with R-Trees

E

20 4 6 8 10

2

4

6

8

10

x axis

y axis

b

E f

query point

omitted

1 E2e

d

c

a

h

g

E3

E5

E6

E4

E7

8

searchregion

contents

E9i

E 11 E 22Visit Root

E 137

follow E1 E 22E 54 E 55 E 83 E 96

E 83

Action Heap

follow E2 E 28E 54 E 55 E 83 E 96

follow E8

Report h and terminate

E 179

E 137E 54E 55

E 83 E 96E 179

Result

{empty}

{empty}

{empty}

{(h, 2 )}

a5

b13

c

18

d

13

e

13

f

10

h

2

g

13

E11

E22

E38

E45

E55

E69

E713

E82

Root

E917

i

10

E1E2

E4 E5E8

Depth-first (DF) and Best-first (BF) algorihms:

Reducing TP Window Queries to NN Search

Definition: The influence time TINF(o, q) of a data object o indicates the time when o will change the current result of q.

The object (C component) invalidating the current query result is the one with the smallest influence time (T component), i.e., a NN query using TINF as the distance metric.

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

e

c

d

the query q

influences at

influencesat 1

influences at 2

influences

influencesat at current time

moving eastat speed 1

at 3

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

e

c

d

the query q

influences at

influencesat 1

influences at 2

influences

influencesat at time 2

at 3

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

ec

d

query q

g

f

influences at

influencesat

influences at

influences at 3

influences at 1.5

influences at 4.5

influences

20 4 6 8 10

2

4

6

8

10

x axis

y axis

a

b

ec

dquery q at time 3

g

f

influences at

influencesat

influences at

influences at 3

influences at 1.5

influences at 4.5

influences

Reducing TP Window Queries to NN Search

Definition: The influence time TINF(o, q) of a data object o indicates the time when o will change the current result of q.

The object (C component) invalidating the current query result is the one with the smallest influence time (T component), i.e., a NN query using TINF as the distance metric.

o7

Nearest Neighbor (NN) Search with R-trees

NN query

The algorithm is based on the Branched and Bound framework.

p1 p2 p3

o1 o2 o3 o4 o5 o6 o7

o1

p1

o2

p2

o3

o4

o5

o6

p3

2

3

32.5

q

We need 2 metrics: (i) dist(o, q), and (ii) mindist(E, q).

mindist(p3, q)

mindist(p2, q)

mindist(p1, q)

Processing TP Queries

Treating TINF as the distance function, we may apply the branch and bound paradigm to answer TP queries.

Of course we must derive TINF for specific query types.

Similar to mindist(E, q) for the NN search, we also need TMININF(E, q), which is the minimum influence time TINF(o, q) among all objects o that can be in the subtree of E.

20 4 6 8 10

2

4

6

8

10

x axis

y axis

query q at time 1

u v

query q at time 2

TINF for TP Window Query

If an object intersects query q now, its TINF equals the earliest time it stops intersecting q in the future.

If an object does not intersect query q now, its TINF equals the earliest time it starts intersecting q in the future.

20 4 6 8 10

2

4

6

8

10

x axis

y axis

query q

u v1 1

current time 0

TINF(u, q)=2, TINF(v, q)=1

TMININF for TP Window Query

20 4 6 8 10

2

4

6

8

10

x axis

y axis

query q

vu

at the current time

E

query q at time 1

1

1

1

1

20 4 6 8 10

2

4

6

8

10

x axis

y axis

query q

vu

at the current time

E

moving north

1

1

TMININF(E, q) equals the earliest future time E starts to intersect q if, at the current time

E does not intersect query q, or E is contained query q

TMININF(E, q)=0 if E intersects (but is not contained in) q

TMININF(E, q)=0TMININF(E, q)=1

TINF for TP NN Query Assume PNN be the current nearest neighbor of query

q; TINF of a data point o equals the time q crosses the perpendicular bisector of line segment PNNo

Note that TINF for a TP NN query relies on the current result (i.e., the current NN), while TINF for a TP window query does not.

20 4 6 8 10

2

4

6

8

10

x axis

y axis

P

query q o

NN

1

TINF(o, q)=1.5

TMININF for TP NN Query

TMININF(E, q) of a non-leaf entry E equals the time mindist(E, q)=dist(q, PNN). As with TINF, it depends on the current query result.

20 4 6 8 10

2

4

6

8

10

x axis

y axis

PNN

1(2)q

E

q at this point |P

equals mindist(E,q)NN

,q|

BaB Algorithms for TP Queries

For those queries (e.g., TP window) where TMIN and TMININF do not depend on the current query result, the T and C components can be retrieved together with the R component in a single traversal of the index structure.

For other queries (e.g., TP K-NN) where TMIN and TMININF depend on the current query result, the T and C components can be retrieved together with the R component in separate traversals of the index structure.

TP Spatial Join

20 4 6 8 10

2

4

6

8

10

x axis

y axis

A1

A2

A3

A4

A5

B1

B2

B3

11

1 1

1

1A1 A2 A3 A4 A5

B1 2

B2 1

B3 4 2

The TP spatial join is reduced to a closest pair query following the similar idea.

Processing Complex Queries

The proposed algorithms apply to other mobility combination of objects and queries as well (i.e., mobile objects and static queries, mobile objects and mobile queries).

TP queries are preliminary components for

Continuous queries Earliest event queries

Continuous Nearest Neighbor

Data: A set of pointsQuery: A line segment q=[s, e]Result: The nearest neighbor (NN) of every point on q.Result representation: {s(.NN=a), s1(.NN=c), s2(.NN=f), s3(.NN=h), e}

s

b d

f

e

a c

hg

s1 s2 s3

One Approach – Time Parameterized Queries

s

b d

f

e

a c

hg

sc sgsd sh

sf

Step 1: Find the NN of the start point s, i.e., point a.Step 2: Use the TP technique to find:

The first point on the line segment (sc ) where there is a change in the NN (i.e., point c) will become the next NN.

TP NN (cont)

s

b d

f

e

a c

hg

s1 sgshsf

From Step 2 we have decided the next NN change is point c at s1

Step 3: Perform another TP NN to find: Starting from s1, how far we need to travel for the current NN (i.e., c) to change.Repeat this until we finish the entire segment.

Another Method: Using Split points

s

b d

f

e

a c

hg

s1 s2 s3

Find all split points s1, s2, s3 (as well as the corresponding NN for each partition) with a single traversal of the dataset.

Term1: The set of split points (including s and e) constitute the split list.Term2: The circle that centers at split point si with radius dist(si, si.NN) is the vicinity circle of si.Term3: We say a data point u covers a point s if u=s.NN. E.g., points a, c, f, h cover segments [s, s1], [s1, s2], [s2, s3], [s3, e].

Conclusions

The time-parameterized query can be integrated with any spatial query type to retrieve predictive information.

Processing of TP queries can be reduced to NN search by defining appropriate distance functions.

TP queries are preliminary building blocks for more complex queries.