Let's consider the `online' calibrations first. Figure 1
shows three different consecutive calibrations (
cal1, cal2, cal3)
stored at time (
). The validity intervals
are well defined. Between t1 and t2 cal1 is valid, between
t2 and t3 cal2 is valid and from t3 to infinity, cal3is valid, until superceeded by cal4 stored at a later time t4.
Let's take a look at calibrations retrieval.
We have already decided that the getData() function will
specify a time interval
and the database
will return the calibrations that are valid inside this interval and
that the application can safely use them without further validity
checks or getData() calls. tstart and tend might
correspond to the run start and end times or to the times of the first
and last events in a data file.
Examples are in order (see Figure 2).
query1 and query2 return the obvious results.
query3 is more interesting because it happens to overlap two validity intervals. What should such a query return? It cannot return cal1 because it is not valid in the interval [t2..tend], it cannot return cal2 because it is not valid in the interval [tstart..t2]. Therefore it should return an error because it cannot return any data. I would call this case a bad query because obviously there is nothing wrong with the data in the database and yet the query cannot return any data.
This example shows that even the simplest validity interval scheme has to deal with bad queries.