Temporal logics as database query languages