Let's try to solve the bad query problem.
Obviously if we allow the application to call getData() with
arbitrary
time intervals, we have a
problem because they can easily overlap the validity intervals stored
into the database.
We have to restrict what tstart and tend the application can use.
What restrictions make sense? We have already decided that getData() is called once for each parameter at the beginning of the run to get the values to be used in the analysis of that run.
Let us demand that tstart and tend of any query be the run start
and end times. Or at least that
Does it help? Yes, but not quite. We still get into trouble if data in the database changes in the middle of a run, as in Figure 8.
Here we have eliminated the bad queries similar to query2and were doing fine until we hit query3, which is bad because cal4 ends in the middle of run4.
Bad query3 cannot be fixed by putting restrictions on the type of queries that aplications are allowed to make. We need to apply restrictions on the data in the database.
Let's demand that validity intervals also always match run start and end times, as in Figure 9
In this example I added a quirk -- the `special Ian's' calibration cal5 which spans multiple runs and overlaps with cal3.
But even with this quirk, the restriction that queries are always done on run boundaries (or inside), makes it impossible to do bad queries. Any possible query is well behaved.
Conclusion: the bad query problem is solved by requiring that
validity intervals stored in the database correspond to the run start
and end times; and that queries are always done on one run at a time,
so that
.