The duration can be provided for a fixed as well
as for a periodic time constraint either as an inte-
ger value in milliseconds (without a suffix) or as
an integer value seconds, minutes, hours, or even
days (with the corresponding suffix
s
,
m
,
h
, or
d
).
The value ranges for milliseconds, seconds, minutes,
hours, days, months, years and weekdays are given in
Fig. 4.
MilliSecondValue : {0, 1, . . . , 999}
SecondValue : {0, 1, . . . , 59}
MinuteValue : {0, 1, . . . , 59}
HourValue : {0, 1, . . . , 23}
DayValue : {1, . . . , 31}
MonthValue : {1, . . . , 12}
Year : {0000,1981,1982, . . . ,3000}
Weekday : {0,1, . . . ,6}
Figure 4: Value range restrictions for the definition of tem-
poral constraints.
The TemporalConstraint described above was
added to the syntactical production rules of the RBS
for rules and facts to enable one to define temporal
rules and facts. The modified syntactical production
rules for the RBS programming language CLIPS are
shown in Fig. 5. In both defintions for rules and facts
the TemporalConstraint was added as an optional at-
tribute that is processed by the temporal reasoning
part of the RBS to activate and deactivate the tem-
poral elements at the corresponding points of time.
Rule = "(defrule " Name Comment
Attribute {Condition}
"=>" {Action} ")";
Attribute = [Priority] [AutoFocus]
[Version] [TemporalConstraint];
Fact = "(" TemplateName
[TemporalConstraint] {Slot} ")";
Figure 5: Syntactical production rules for rules and facts.
3.2 Temporal Rules and Facts
A simple way to take temporal constraints into ac-
count is to provide time dependent rules. We will not
discuss temporal facts in detail because they can be
emulated easily by temporal rules. We just create a
temporal rule for each temporal fact which adds and
removes the fact as required.
The implementations of Rete networks suggest
three approaches for the realization of temporal rules.
3.2.1 Common Time Fact
The first approach consists in a special fact that is up-
dated periodically in well defined time intervals. Ev-
ery time when this special fact is updated the activa-
tion conditions of all the temporal rules have to be
evaluated. Thus, this approach is not very efficient
since the computation complexity for the well defined
time interval for the update of the time fact will in-
crease with the number of temporal rules.
A sketch of this approach is given in Fig. 6.
The special fact point-in-time is updated periodically
(controlled by a timer). All the temporal rules from
the rule base are checked after every update of the
special fact.
!"#$%&"'(
!"#$%&'$%'&$()*+++,
)*+(,-).,("/
!"#$%&'()%&*+$,'-
)(+01,"2%342(
(.
/
/
/
-012
/
/
/
-.*/*"#$%&'$%'&$()*/*-0
Figure 6: Temporal rule implementation by single time fact.
3.2.2 Temporal Trigger Facts
Another approach is to introduce a trigger fact for
each temporal rule as shown in Fig. 7. This fact
is used by the rule and controlled by a central timer
thread. This timer thread can manage all the exist-
ing trigger facts and adds or removes them when the
corresponding rule should become valid or invalid.
This method should be much more efficient as the first
approach because the timer thread is only active to
add and remove trigger facts. The remaining time it
sleeps and uses a minimum of the systems ressources.
Maybe the performance could be further improved by
introducing trigger fact sharing, so the amount of re-
quired trigger facts and timer thread activities is re-
duced.
3.2.3 Temporal Nodes
The last approach we discuss is to implement the
temporal rules directly in the discrimination network.
Therefore, we introduce the node type temporal node
in the network that will activate and deactivate a tem-
poral rule with respect to its temporal conditions. The
implementation of temporal rules can be done either
by providing an own thread that is watching the tem-
poral constraints of exactly one rule, or by a com-
mon thread that will watch the temporal constraints
for all the rules. In the latter way the temporal con-
straints of rules have to be added to a chronological
ICAART 2011 - 3rd International Conference on Agents and Artificial Intelligence
510