next up previous contents index
Next: Maintaining Condensed IP-Tables Up: Maintaining IP-Tables Previous: Maintaining IP-Tables

Maintaining Complete IP-Tables

  

An existing IP-table I(R) has to be modified whenever a tuple r is inserted into or deleted from the temporal relation R. If a tuple attribute value is changed then this can be considered as the tuple being removed from R and then being inserted as a new tuple with the changed attribute values. To that end, two algorithms are required, one for each form of update.

Figure 7.10 shows the steps that have to be performed when a tuple r is inserted  into R. First, it has to be checked whether r's interval start- and endpoints are already in the set V(R). If not then they are added to V(R) respectively. Next, the indices js  and je  are set: js indicates the that equals r.ts, je does the same for r.te. Then the value s[js] - which stores the value of - has to be augmented by 1 as there is now one more interval in R that starts at tjs = r.ts. Finally, the array o[j] - which stores the values - is adapted within a for-loop: r overlaps all timepoints tj with .

We note that the array notation is used for convenience only. It does not suggest that arrays are the best way to implement the following algorithms. In fact, linked list will probably much more efficient in many respects.

In figure 7.11, we show the modifications that have to be performed when a tuple r is removed  from R. As in the case of insertion, there are two major stages: the modification of V(R) and the modification of the s[j] and o[j] values. This time, it starts with the latter stage: after determining the indices js and je as above, s[js] is reduced by 1 and so are all o[j] with . This might lead to the situation that either r.ts = tjs or r.te = tje or both can be removed from V(R) in the case that there are no more intervals in R that start or end at these points. This can be checked by looking at the values of , ,, of which the first two are explicitly stored as s[js] and s[je] whereas the latter two can be computed according to the formula given in figure 5.1(b):

which translates to

as for .If no other intervals start or end at r.ts, i.e. then it is removed from V(R). Similarly, if no other intervals start or end at r.te, i.e. then it is removed from V(R).


  
Figure: The insertion algorithm for complete IP-tables.


  
Figure: The deletion algorithm for complete IP-tables.


next up previous contents index
Next: Maintaining Condensed IP-Tables Up: Maintaining IP-Tables Previous: Maintaining IP-Tables

Thomas Zurek