2 Temporal Business Rules
A state of a database is a pair (s, t) where s is a discrete component representing a
snapshot of all the data (or more precisely those data that are relevant for the temporal
business rules)and t is a time stamp. Using s, boolean constraints may be decided, such
as if the balance of a bank account is below a certain threshold. A temporal business rule
for a database is a specification on how the internal state of the database may evolve over
time, and what should happen when a rule is satisfied (or the opposite) by the data in the
database: IF TC THEN Action
1
ELSE Action
2
, where TC is a temporal condition and
Actions 1 and 2 are some action to be performed. The core of our temporal conditions
are given by Timed LTL, LT L
t
, in the following abstract syntax (see also [1]):
φ ::= p | φ
1
∨ φ
2
| φ
1
∧ φ
2
| ¬φ | ALWAYS φ | ALWAYS
c
φ
| EVENTUALLY φ | EVENTUALLY
c
φ,
where p ∈ AP and c ∈ IN.
The syntactic elements are: Atomic propositions, AP, which can be the occurence of
insert, update, delete or that an attribute in the database is above/below a certain thresh-
old. Further, logical connectives and then temporal operators ALWAYS and EVENTUALLY
both of which may be equipped with a time bound c. Intuitively they mean the fol-
lowing: Where ALWAYS φ denotes that the formula φ must hold in all timepoints,
ALWAYS
c
φ only requires φ to hold in the coming c time units. Conversely, the formula
EVENTUALLY
c
φ requires that formula φ is satisfied before c time units have passed,
and thus it is a more restrictive operator than EVENTUALLY which only requires the
sub–formula to hold at some point arbitrarily long away in the future. We shall use the
standard abbreviation such as expressing implication etc. as logical connectives, e.g.
φ
1
⇒ φ
2
for ¬φ
1
∨ φ
2
and to use true instead of ¬p ∨ p. Using this language we may
formulate a temporal business rule for a vehicle assistance company in which the tem-
poral condition is the following, stating that assistances must not be given too frequent:
ALWAYS (new(C.Assistance) ⇒ ALWAYS
30
¬new(C.Assistance)).
Checking Temporal Business Rules The algorithm in the verification server works by
a rewriting principle. For each new state encountered from the database, the algorithm
rewrites the temporal constraints to a new formula which states what should hold from
now on. Such a new formula is called a residual formula. In the algorithm below the
residual of formula φ with respect to a timed state σ
i
is denoted by φ/σ
i
.
Algorithm: Runtime Verification procedure
Let σ = σ
0
σ
1
. . . be a timed trace, let φ be a formula, let exists(σ
i
, time) be a
predicate which is true exactly when σ contains σ
i
and t
i
= time and let forceEvalua-
tion() be a method which returns the systems current state, at the current time.
ψ := φ/σ
0
; i := 1; time := 1; sit := SIT (ψ)
while ψ 6= true ∧ ψ 6= f alse do
if exists(σ
i
, time) ∧ s
i
6= s
i−1
then
ψ := ψ/σ
i
sit := SIT (ψ)
66