Database Reference
In-Depth Information
atinstant:
mpoint × instant
ipoint
inst:
ipoint
instant
val:
ipoint
point
at:
mbool × bool
mbool
deftime:
mbool
periods
atperiods: mpoint × periods
mpoint
The operation atinstant returns a data type intime ( point ), ipoint for short.
The type represents a pair ( i, p ) consisting of an instant and a point . From
such pairs one can determine the two components using the operations inst and
val. Operation at reduces a time-dependent Boolean value to the times when it
assumes the second argument. deftime works for type mbool in the same way
as for mpoint .
The need to reduce a moving object to the times when it fulfills certain
properties occurs frequently. For a moving object x , the expression
x atperiods deftime( predicate ( x ) at TRUE)
can be abbreviated to x when[ predicate ( x )] using operator when with sig-
nature
when: mpoint
×
mbool
mpoint
Hence we can write the previous query more simply, as
query trajectory(train7 when[speed(train7) > (50 * kmh)])
It goes without saying that all the operations presented can be used in set-
oriented queries, that is, in the select or where clause of an SQL query.
We also need some predicates to determine whether a moving object passes
through a certain area or is defined at a given time. The following query finds
all trains passing through mehringdamm and determines the times when they
arrive at or leave this station.
select Id, Line, Up,
inst(initial(Trip at mehringdamm)) as ArrivalTime,
inst(final(Trip at mehringdamm)) as DepartureTime
from Trains
where Trip passes mehringdamm
Here operations are used:
mpoint × point
bool
passes:
ipoint
initial, final: mpoint
at:
mpoint × point
mpoint
Search WWH ::




Custom Search