Download INFORMATIK

Transcript
minutes. The larger relation Trains25 will use the same temporal partitioning; the spatial grid cells of
size 10000 x 10000 are effectively translated in the same way as the Trains.
let six00 = theInstant(2003,11,20,6);
let minutes5 = [const duration value (0 300000)];
To introduce the temporal partition of the 3D space, we define the instant 6am and a duration of 5 minutes
(300000 ms).
let UnitTrains25 = Trains25 feed
projectextendstream[Id, Line, Up; UTrip: units(.Trip)]
addcounter[No, 1]
extend[
Temp: (minimum(deftime(.UTrip)) - six00) / minutes5,
CellX: real2int((minD(bbox2d(.UTrip), 1) + 3600.0) / 10000.0),
CellY: real2int((minD(bbox2d(.UTrip), 2) - 1200.0) / 10000.0)]
sortby[Temp asc, CellX asc, CellY asc, UTrip asc]
remove[Temp, CellX, CellY]
consume;
The projectextendstream operator creates a stream of units from the Trip attribute of each input tuple
and outputs for each unit a copy of the original tuple restricted to attributes Id, Line, Up, and the new
unit attribute UTrip. Then addcounter adds an attribute No with a running number to the current tuple.
The extend operator computes integer indices Temp, CellX, and CellY according to the 3D partition
explained above for a given unit, accessing its geometry. The resulting stream of tuples is sorted first by
the three indices of a spatiotemporal cell, and finally by UTrip (which in effect is the start time of the
unit). After sorting, the indices needed for sorting can be removed again before storing the relation.
let UnitTrains25_UTrip = UnitTrains25 feed addid bulkloadrtree[UTrip];
The R-tree is created by bulkload. The order in the underlying relation is the same as that used in the
bulkload; hence a clustering effect is achieved.
let UnitTrains25Cover = coverage(UnitTrains25_UTrip) consume;
The coverage operator traverses the R-tree, computing the coverage function and from it the three coverage numbers resulting from the hat operation (Section 5.3.1). They are entered into relation UnitTrains25Cover.
let UnitTrains25Cover_RecId = UnitTrains25Cover createbtree[RecId];
The relation with coverage numbers is indexed. This completes data generation for our algorithm
TCkNN. Next test data for HCNN are generated.
let UTOrdered25 = UnitTrains25 feed sortby[UTrip asc] consume;
let UTOrdered_RTreeBulk25 = UTOrdered25 feed addid
bulkloadrtree[UTrip];
The UnitTrains25 are ordered by units and stored in this order. This is essentially an order on the start
times of units. The index is then built by bulkload on the temporally ordered stream of tuples. Again the
index is clustered like the relation. As discussed in Section 7, this version of HCNN is the most efficient
one.
let UnitTrains25C = Trains25 feed
projectextendstream[Id, Line, Up;
addcounter[No, 1] consume
UTrip: units(.Trip)]
let UnitTrains_UTrip_tbtree25 = UnitTrains25C feed addid
bulkloadtbtree[Id, UTrip, TID];
39