Professional Documents
Culture Documents
net/publication/220566764
CITATIONS READS
521 1,063
2 authors, including:
Oscar Díaz
Universidad del País Vasco / Euskal Herriko Unibertsitatea
182 PUBLICATIONS 2,214 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Oscar Díaz on 21 May 2014.
AND
OSCAR DÍAZ
University of the Basque Country
We are pleased to acknowledge the support of the European Union Human Capital and Mobility
Network ACT-NET, the UK Engineering and Physical Sciences Research Council (Grant GR/H43847)
and the Basque Government for funding active database research involving the authors.
Authors’ addresses: N. W. Paton, Department of Computer Science, University of Manchester, Oxford
Road, Manchester M13 9PL, UK; e-mail: ^norm@cs.man.ac.uk&; O. Dı́az, Departamento de Lenguajes y
Sistemas Informaticos, University of the Basque Country, San Sebastián, Spain; e-mail:
^jipdigao@si.ehu.es&.
Permission to make digital / hard copy of part or all of this work for personal or classroom use is granted
without fee provided that the copies are not made or distributed for profit or commercial advantage, the
copyright notice, the title of the publication, and its date appear, and notice is given that copying is by
permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to
lists, requires prior specific permission and / or a fee.
© 1999 ACM 0360-0300/99/0300–0063 $5.00
trend in database research towards late (e.g., the coach is added, but only
more of the functionality required by an after several customers have been
application being supported within the turned away).
database system itself, giving rise to Active databases support the preced-
database systems with more compre- ing application by moving the reactive
hensive facilities for modeling both the behavior from the application (or polling
structural and the behavioral aspects of mechanism) into the DBMS. Active da-
an application. Among the fields that tabases are thus able to monitor and
have received attention in recent years react to specific circumstances of rele-
with a view to enhancing the behavioral vance to an application. The reactive
facilities of database systems are data- semantics is both centralized and han-
base programming, temporal databases, dled in a timely manner. An active da-
spatial databases, multimedia data- tabase system must provide a knowl-
bases, deductive databases, and active edge model (i.e., a description
databases. This survey focuses upon the mechanism) and an execution model
last mentioned. (i.e., a runtime strategy) for supporting
Traditional database management this reactive behavior.
systems (DBMSs) are passive in the A common approach for the knowl-
sense that commands are executed by edge model uses rules that have up to
the database (e.g., query, update, de- three components: an event, a condition,
lete) as and when requested by the user and an action. The event part of a rule
or application program. However, some describes a happening to which the rule
situations cannot be effectively modeled may be able to respond. The condition
by this pattern. As an example, consider part of the rule examines the context in
a railway database where data are which the event has taken place. The
stored about trains, timetables, seats, action describes the task to be carried
fares, and so on, which is accessed by out by the rule if the relevant event has
different terminals. In some circum- taken place and the condition has eval-
stances (e.g., public holidays, cultural uated to true.
events) it may be beneficial to add addi- Most active database systems support
tional coaches to specific trains if the rules with all three of the components
number of spare seats a month in ad- described; such a rule is known as an
vance is below a threshold value. Two event-condition-action or ECA-rule. In
options are available to the administra- some proposals the event or the condi-
tor of a passive database system who is tion may be either missing or implicit. If
seeking to support this requirement. no event is given, then the resulting
One is to add the additional monitoring rule is a condition-action rule, or pro-
functionality to all booking programs so duction rule. If no condition is given,
that the preceding situation is checked then the resulting rule is an event-ac-
each time a seat is sold. However, this tion rule.
approach leads to the semantics of the At first glance, the introduction of
monitoring task being distributed, repli- active rules to a database system may
cated, and hidden among different ap- seem like a straightforward task, but in
plication programs. The second ap- practice proposals have been made that
proach relies on a polling mechanism support widely different functionalities.
that periodically checks the number of Among the issues that distinguish pro-
seats available. Unlike the first ap- posals are the expressiveness of the
proach, here the semantics of the appli- event language, the scope of access to
cation is represented in a single place, database states from the condition and
but the difficulty stems from ascertain- action, and the timing of condition and
ing the most appropriate polling fre- action evaluation relative to the event.
quency. If too high, there is a cost pen- The functionality of a specific system
alty. If too low, the reaction may be too will be influenced by a number of fac-
tors, including the nature of the passive (e.g., a new wire is created of an exist-
data model that is being extended, and ing wire-type, the max-voltage of a
the categories of application to be sup- wire-type is updated, etc.) that can
ported. then be monitored by a set of system-
generated active rules. For example, to
1.1 Active Database Applications check for violation of the constraint on
insertion of a new wire, the following
As mentioned previously, database re- active rule could be used.
search often aims to extend the range of
facilities within the database system for on insert into wire
representing application concepts. if insert.voltage . any
Hence, additional capabilities are (select max-voltage
largely dependent on the designated ap- from wire-type
plications. In the case of active rules, where type 5 insert.type)
the following categories of application do ^action&
can be distinguished. Here, the on clause defines the event
Database System Extensions. Active (the insert of a tuple into the wire
rules can be used as a primitive mecha- relation), the if clause expresses the
nism for supporting the implementation condition, and the do clause specifies
of other parts of a database system. For the action. Information about the event
example, ECA rules have been used to is referred to in the condition by access-
support integrity constraints [Ceri et al. ing the voltage and type of the newly
1990; Diaz 1992], materialized views inserted tuple using the reserved word
[Stonebraker et al. 1990; Widom et al. insert. In this example, the action
1991], derived data [Etzion 1993], coor- could be defined in different ways—the
dination of distributed computation update operation could be blocked by
[Dayal et al. 1990; Ceri and Widom aborting the transaction, the constraint
1993], transaction models [Geppert and could be repaired by changing the volt-
Dittrich 1994], advanced data modeling age of the inserted wire, and so on.
constructs [Paton et al. 1993], and auto-
matic screen updating in the context of Closed Database Applications. This
database change [Diaz et al. 1994; Pa- category of application involves the use
ton et al. 1996]. of active functionality to describe some
Such extensions to core database of the behavior to be manifested by a
functionality are usually supported by software system without reference to
defining a high-level syntax for the ex- external devices or systems. For exam-
tended functionality, plus a mapping ple, rules might be used to describe
onto sets of active rules. For example, repair actions in a modeling database,
Ceri et al. [1990] present a constraint to monitor sales in a stock control data-
language for implementation using ac- base, to propagate load calculations in
tive rules, illustrated using an applica- an architectural design database, or to
tion that models a power distribution anticipate market activity in a portfolio
system. In this constraint language, the management database. In these appli-
restriction that no wire has a voltage cations there may not be any mapping
that is greater than that of its type is from a higher-level description onto the
expressed thus: active rule language—ECA rules are
used directly to support the semantics
wire:voltage . any of the application. For example, in a
(select max-voltage portfolio management database a rule
from wire-type
where type 5 wire.type)
could be written that deletes any stock-
holders whose portfolios have value 0,
This constraint can be violated by a while at the same time recording these
range of different update operations holders in a distinct relation:
—clock, in which case the event is interval Int; not—not E 1 in Int detects
raised at some point in time [Dayal et the nonoccurrence of the event E 1 in the
al. 1988; Gatziu and Dittrich 1994]. interval Int.
Absolute (e.g., the 13th of November As an example of a rule with a com-
1998 at 15:00), relative (e.g., 10 days posite event, the following rule enforces
after the shares are sold), and peri- the constraint that the qty attribute of
odic (e.g., the first day of every stock is the same as the amount re-
month) time events are reported in corded in the Owns relation.
the literature;
—external, in which case the event is on update to qty of Holder or
update to qty of Stock or
raised by a happening outside the da- insert to Stock or
tabase (e.g., the temperature reading delete to Stock or
goes above 30 degrees [Dayal et al. insert to Holder or
1988]). delete to Holder
if exists
The Event Granularity of an event (select p
indicates whether an event is defined from Stock
for every object in a set (e.g., every where qty Þ
instance of a class), for given subsets (select sum(qty)
(e.g., all staff members except profes- from Owns
sors) or for specific members of the set where Owns.reg# 5 Stock-
(e.g., to prevent unauthorized access to .reg#)
specific instances, or to enable the up- )
date of the specific widget objects that do abort
are presently on screen [Diaz et al. As a further example, to detect whether
1994]). a stock price has changed during a
The Type of an event can be: working day the event can be used: on
—primitive, in which case the event is update to price of Stock in
raised by a single low-level occurrence [09:00, 17:00].
that belongs to one of the categories Rich event algebras have been pro-
described in Source. For example, posed for a range of systems, including
the event on insert to Owns mon- HiPAC [Dayal et al. 1988], SAMOS
itors the insertion of new tuples into [Gatziu and Dittrich 1994], ODE [Ge-
the Owns relation. hani et al. 1992], and Sentinel [Chakra-
varthy et al. 1994]. However, composite
—composite, in which case the event is
event handling presents challenges in
raised by some combination of primi-
terms of semantics and efficiency that
tive or composite events using a range
have yet to be fully addressed.
of operators that constitute the event
When detecting composite events,
algebra.
there may be several event occurrences
The range of event operators varies (of the same event type) that could be
from system to system. The most com- used to form a composite event. As an
mon are: disjunction—E 1 orE 2 occurs example, consider a composite event CE
when either E 1 or E 2 has occurred; con- which is the sequence of events EV1
junction—E 1 andE 2 happens when both and EV2. If two occurrences of event
E 1 and E 2 have occurred in any order; EV1, first ev1 and later ev19, have al-
sequence—seq(E 1 , E 2 ) occurs when E 1 ready been signaled, and an occurrence
occurs before E 2 ; closure—closure E in of event EV2 (e.g., ev2) is now pro-
Int is raised only once the first time E is duced, there is a question as to what
signaled, regardless of later occurrences instances of CE should be raised. Possi-
of E in the time interval Int; history— bilities include sequence(ev1, ev2) or se-
times(n, E) in Int is signaled when quence(ev19, ev2) or sequence(ev1, ev2) ø
event E occurs n times during the time sequence(ev19,ev2). The alternatives are
may be triggered and may execute to is deleted and the system manager is
completion during the execution of a informed:
single action. As an example of the util-
on delete to Holder
ity of such information, the following
if delete.value . 0
rule is used to respond to the situation do ^inform system manager&
in which the value of the stock held by
a Holder drops to 0. The Context of the action is similar
to that of the condition, and indicates
on update to value of Holder the information that is available to the
if new.value 5 0 action, as illustrated in Figure 3. It is
do ^action&
sometimes possible for information to be
In this rule, information from the event passed from the condition of a rule to its
(DB E ) is used to identify when the action as DB E or BindC . As an example
value field has been set to 0, so that an of the utility of context information, the
appropriate response can be made (e.g., following rule is used to revise the data
the Holder is deleted, information on stored in the value attribute of all
the Holder is sent to the fund manager, Holder tuples that are affected by a
etc.). In other examples in this survey, change in the price of some Stock.
conditions or actions access event pa- on update to price of Stock
rameters using old to refer to the value if true
that a data item held before an event do update Holder
updated it, insert to refer to a newly set value 5 value p (new.
inserted value, delete to refer to a price/old.price)
recently deleted value, and update to where reg# in (select reg#
refer to attributes of a data item that from Owns where stock# 5
were unaffected by an update event. update.stock#)
In this rule, both the old and the new
3.3 Action values of the price have to be accessed
(DB E ), as does the state of the database
The range of tasks that can be per- at the time of the update (DB A ).
formed by an action is specified as its
Options. Actions may update the
4. EXECUTION MODEL
structure of the database or rule set,
perform some behavior invocation The execution model specifies how a set
within the database or an external of rules is treated at runtime, and is
call, inform the user or system admin- characterized by the dimensions pre-
istrator of some situation, abort a sented in Table II. Although the execu-
transaction, or take some alternative tion model of a rule system is closely
course of action using do-instead related to aspects of the underlying
[Stonebraker et al. 1990]. As an exam- DBMS (e.g., data model, transaction
ple of do-instead, if an attempt was manager), there are a number of phases
made to delete a tuple from the Holder in rule evaluation, illustrated in Figure
relation that has a value . 0, then 4, that transcend considerations that
rather than allow the operation to pro- relate to specific software environ-
ceed, the system manager could be in- ments.
formed of the attempted operation:
(1) The signaling phase refers to the
on delete to Holder appearance of an event occurrence
if delete.value . 0 caused by an event source.
do instead ^inform system man-
ager&
(2) The triggering phase takes the
events produced thus far, and trig-
This is in contrast with the more gers the corresponding rules. The
standard semantics, in which the tuple association of a rule with its event
occurrence forms a rule instantia- (condition) of the rule, but not neces-
tion. sarily at the earliest opportunity.
(3) The evaluation phase evaluates the Normally, further processing is left
condition of the triggered rules. The until the end of the transaction. How-
rule conflict set is formed from all ever, some authors [Diaz and Jaime
rule instantiations whose conditions 1997] have also proposed to have a
are satisfied. user-invoked coupling mode whereby
(4) The scheduling phase indicates how the condition (action) is evaluated (ex-
the rule conflict set is processed. ecuted) at a user-specified time after
the event (condition) has been sig-
(5) The execution phase carries out the
naled (evaluated). A similar effect is
actions of the chosen rule instantia-
also supported by Starburst [Widom
tions. During action execution other
and Finkelstein 1990] where users
events can in turn be signaled that
can invoke rule processing within a
may produce cascaded rule firing.
transaction by issuing special com-
These phases are not necessarily exe- mands: the process rules, process
cuted contiguously, but depend on the ruleset S, and process rule R com-
Event-condition and Condition-ac- mands invoke rule processing for the
tion coupling modes. The former deter- whole triggering rule set, a given sub-
mines when the condition is evaluated set S, or a unique rule R, respec-
relative to the event that triggers the tively; and
rule. The Condition-action coupling —detached, in which case the condi-
mode indicates when the action is to be tion (action) is evaluated (executed)
executed relative to the evaluation of within a different transaction from
the condition. The options for coupling the event (condition). The execution of
modes most frequently supported are: the action can be dependent upon or
independent of the committing of the
—immediate, in which case the condi-
transaction in which the event took
tion (action) is evaluated (executed)
place or the condition was evaluated.
immediately after the event (condi-
tion); The nature of the relationship be-
—deferred, in which case the condition tween events and the rules they trigger
(action) is evaluated (executed) within is partially captured by the transition
the same transaction as the event granularity. This indicates whether
ity schemes in which rules are associ- of them supported by a rule), but only
ated with a priority statically. one is used.
Static priorities are often determined A further aspect to be considered is
either by the system (e.g., based on rule how Error handling is supported dur-
creation time) or by the user as an ing rule firing. Most systems simply
attribute of the rule. In the latter case, abort the transaction, as this is stan-
a rule is selected from a collection of dard behavior in databases. However,
simultaneously fired rules for execution other alternatives may be more conve-
using a Priority mechanism. Rules can nient [Hanson and Widom 1993]: to ig-
be placed in order using a numerical nore the rule that raised the error and
scheme, in which each rule is given an to continue processing other rules; to
absolute value that is its priority backtrack to the state when rule pro-
[Stonebraker et al. 1990], or by indicat- cessing started and either restart rule
ing the relative priorities of rules by processing or continue with the transac-
stating explicitly that a given rule must tion; to adopt some contingency plan
be fired before another when both are that endeavors to recover from the error
triggered at the same time [Agrawal et state, possibly using the exception
al. 1991]. mechanism of the underlying database
—The number of rules to be fired. Possi- system.
ble options include (1) to fire all rule
instantiations sequentially; (2) to 5. MANAGEMENT
fire all rule instantiations in paral-
lel; (3) to fire all instantiations of a Sections 3 and 4 have, respectively, de-
specific rule before any other rules scribed the structural characteristics of
are considered, which is known as individual active rules and the runtime
firing a rule to saturation; and (4) to evaluation of sets of such rules. This
fire only one or some rule instantia- section considers the facilities provided
tion(s). Which approach is most ap- by the system for managing rules, spe-
propriate depends upon the task that cifically what operations can be applied
is being supported by the rule. The to rules, how rules are themselves rep-
first alternative is suitable for rules resented, and programming support for
supporting integrity maintenance: an rules. Possible dimensions are shown in
update is successful once all con- Table III.
straints have been validated. The sec- The Description of rules refers to
ond option is described in HiPAC in a how rules themselves are normally ex-
bid to encourage more efficient rule pressed using a database program-
processing. The third option is most ming language [Gehani et al. 1992;
popular among expert-system practi- Buchmann et al. 1995], a query lan-
tioners, as it yields more focused in- guage [Widom and Finkelstein 1990;
ference than the other approaches. Stonebraker et al. 1990], or as objects
The fourth option can be of use to in an object-oriented database [Dayal et
support derived data—different deri- al. 1988; Diaz et al. 1991]. These catego-
vation criteria may be available (each ries are not exclusive. For example, it is
possible for an extended query language mount importance if active rules are to
facility in an object-oriented database to be adopted as a mainstream implemen-
arrange for rules to be stored as objects. tation technology in business environ-
Besides creation and deletion, which ments. Important facilities for support-
are taken to be mandatory, other Oper- ing the developers of rule bases include
ations commonly found are activate, the ability to query the rule base and to
deactivate, and signal. Activation (de- trace or in some other way monitor rule
activation) of rules makes the system system behavior. Support for applica-
start (stop) monitoring the rule’s event tion development is discussed more
or condition. Since rules can persist for fully in Section 8.
long periods, this mechanism helps the
database administrator to temporarily 6. ACTIVE RULE SYSTEMS
switch on (off) some rules without delet-
ing them. Among other things, such de- The previous three sections have intro-
activation mechanisms may be conve- duced many of the principal features of
nient for improving efficiency, for active database systems, and together
debugging, or for loop prevention (e.g., constitute a framework within which
by deactivating rules once they have active functionality can be described. In
been fired). This mechanism may be this section the framework is applied to
available for individual rules as well as the presentation of a range of promi-
for rule sets. The latter can help in nent proposals for active database sys-
structuring the rule base, as well as tems, thereby highlighting important
speeding up rule processing. similarities and differences.
The operation Signal is required to
support abstract events, and is invoked 6.1 Relational Systems
explicitly by the application to notify
the rule system of external occurrences. The inclusion of active behavior model-
Although all active DBMSs support ing facilities in relational databases is
creation and deletion of rules, they can not particularly new, and most commer-
differ in the level of Adaptability sup- cial systems include triggering mecha-
ported. In some systems it is only possi- nisms. In addition, a number of re-
ble to change the rules associated with search prototypes have been developed
an application by recompiling the appli- that seek to provide more comprehen-
cation code, and thus the rules can be sive support for active rules. Proposals
modified only at compile time. Others for including active behavior in rela-
support more dynamic run time rule tional systems often have a range of
modification, including the ability of common characteristics, which stem
rule actions to modify the rule base. from the nature of the underlying pas-
Clearly there is a sliding scale of de- sive database system. For example,
grees of Adaptability: in the context of rules are generally triggered by system-
the dimensions, any system that allows defined operations on the structure of
rules to be created without recompiling the database (e.g., insert a tuple, modify
application code can be considered to a tuple), because until recently, rela-
support run time adaptability. tional systems have rarely supported
There is an extent to which the Data user-defined operations. It can be antic-
Model with which an active rule system ipated that future active rule systems
is associated is independent of the other for relational databases will be ex-
dimensions of rule system functionality. tended so that primitive events include
However, the data model is likely to the execution of stored procedures, but
significantly influence the designers of such functionality is not supported by
an active rule system, and is thus in- the systems reviewed here. Further-
cluded as a dimension. more, because relational languages such
Programmer Support is of para- as SQL provide facilities for expressing
conditions and for performing updates, for the inclusion of active behavior into
the rule description language is often an relational systems, namely Starburst,
extension of the query language. In gen- POSTGRES, Ariel, and SQL-3, fit into
eral, active mechanisms proposed for the framework introduced in the previ-
relational databases support only one or ous three sections. The following sub-
a limited range of coupling modes, and sections describe distinctive features of
have limited support for composite these proposals. Other examples of ac-
event detection. This, however, is not tive extensions to systems with largely
because of any fundamental restrictions relational data models are presented in
imposed by the relational model, and Kotz et al. [1988], Kiernan et al. [1990],
extended proposals may emerge in due Zaniolo [1994], Harrison and Dietrich
course. [1994], Bayer and Jonker [1994], and
Table IV indicates how four proposals Reddi et al. [1995].
6.1.1 Starburst. The Starburst ac- to lead to rule sets that are difficult to
tive rule system adds active functional- understand and maintain.
ity to an extensible relational database
6.1.2 POSTGRES. The active rule
system [Widom and Finkelstein 1990],
system is only one of a number of exten-
and has been used as a testbed for a
sions to the relational model supported
number of database internal applica-
within POSTGRES [Stonebraker and
tions, including integrity constraints
Kemnitz 1991], with others facilitating
[Ceri et al. 1990] and materialized the representation of objects and user-
views [Ceri and Widom 1991]. defined operations. The POSTGRES
Perhaps the most noteworthy feature rule system is considered within the
of the Starburst rule system is its set- section on relational databases because
based execution model, in which rules the object-oriented features of POST-
are triggered by the net effect of a set of GRES seem to have had little bearing
changes to the data stored in the data- on the design of the rule system. The
base. When an operation takes place POSTGRES rule system, like that of
that is being monitored by a rule, the Starburst, can be considered to be quite
nature of the change is logged in a conservative, although a key distinction
transition table. Entries in such tables is that the POSTGRES rule system is
can then be revised to take account of tuple-oriented. Furthermore, the conse-
subsequent update operations; for ex- quences of an event being raised take
ample, if a tuple is inserted and then effect immediately, rather than being
updated, the net-effect is logged as an deferred until a later rule assertion
insert of the updated tuple; if a tuple is point.
inserted and then deleted, the net-effect
is that no operation has taken place. 6.1.3 Ariel. An important character-
The information that is stored in transi- istic of Ariel that distinguishes it from
tion tables is used to trigger rules at Starburst or POSTGRES is the option-
rule assertion points, that may take ality of the event—Ariel principally sup-
place either during or at the end of a ports condition-action rules. The conse-
transaction. In this context, events do quences of this distinction for the
not trigger rules directly. Rather, the implementation of rule systems is con-
sidered in Section 7.5.
fact that an event has occurred is re-
The suitability of condition-action
corded in a transition table for subse-
rules compared with ECA-rules depends
quent consideration, and the timing or
upon the context. There are circum-
order of specific events is not taken into
stances in which it is necessary to make
account by the scheduler.
the event part of a rule explicit to cap-
Each rule that is monitoring a partic- ture the semantics of an application. In
ular event has access to the net-effect of the example application from Section 2,
all updates of relevance to that event, there might be a general policy that no
and that have not already been consid- more than 10% of the total value of the
ered by the rule; when a rule is fired stock owned by Cautious Investments
multiple times within a single transac- should be of the one kind. This could be
tion, the changes it has access to are captured by a condition-action rule
those that have taken place since the thus.
last firing of the rule.
The Starburst rule system can be con- if h.name 5 “Cautious Invest-
sidered to be conservative in its design, ments”
and h.reg# 5 o.reg#
in that a modest and fixed set of facili- and
ties is supported. However, the seman- o.stock# 5 s.stock# and
tics of rule execution in Starburst is still o.qty p s.price . 0.1 p
quite complex, and it can be argued that h.value
supporting many more facilities is likely from h in Holder, o in Owns,
the first work on passive OODBs. This used to store the ECA-rules of the active
rapid and extensive research activity extension. Further distinctive features
has probably been encouraged by the of HiPAC are the parallel execution of
tendency for OODBs to be used in ad- triggered rules as subtransactions, the
vanced applications, where the need for extension of the query algebra with a
comprehensive behavior management changes operator that allows access to
facilities is greater than in more tradi- delta relations that monitor the net ef-
tional domains. Furthermore, the na- fect of a set of changes, and identifica-
ture of certain applications has encour- tion of real-time applications that can
aged investigation of active database benefit from active database facilities.
constructs that are significantly more
6.2.2 EXACT. EXACT, an extensi-
powerful than those described for rela-
ble active rule manager [Diaz et al.
tional systems in Table IV, as shown for
1991; Diaz and Jaime 1997], adds active
selected systems in Tables V and VI. As
facilities to the OODB ADAM, in which
well as being more powerful than most
instances, classes, rules, and events are
extensions to relational databases, a
represented uniformly as database ob-
common difference is that primitive
jects. Two contentions support this
events in active OODBs are often asso-
work, specifically: that control informa-
ciated with method invocations rather
tion rarely refers to single rules but to
than access to or update of structure.
sets of rules, and that rules supporting
This partly derives from the desire to
different applications often require dif-
avoid reducing data independence by
ferent execution models. To support
linking active behavior to structure di-
these contentions, EXACT provides an
rectly, and partly from the fact that
extensible rule model in which collec-
some systems use layered architectures
tions of rules can be developed that
in which it is not straightforward to
share similar features, the functional-
raise events on the basis of structure
ities of which are described by specializ-
operations.
ing the general rule management facili-
The following subsections outline the
ties provided with the system. EXACT
principal features of eight projects de-
has been used for experimentation in
veloping active object-oriented data-
the development of advanced database
bases, four of which are not based upon
facilities [Diaz 1992; Paton et al. 1993;
persistent C11 systems (HiPAC, EX-
Diaz et al. 1994].
ACT, NAOS, and Chimera, as featured
in Table V), and four of which are based 6.2.3 NAOS. NAOS [Collet et al.
on database extensions of C11 (Ode, 1994] is an active rule system for the O2
SAMOS, Sentinel, and REACH, as fea- commercial OODB [Deux et al. 1990].
tured in Table VI). Other examples of As NAOS has been implemented as part
active extensions to OODBs are pre- of the kernel of O2, rather than as a
sented in Dittrich [1993], Etzion et al. layer on top that has not been sanc-
[1994], Naqvi and Ibraham [1994], tioned by the vendor, it may develop
Thomas and Jones [1995], and Dinn et into the first commercially available ac-
al. [1996]. tive OODB.
As O2 provides comprehensive sup-
6.2.1 HiPAC. The HiPAC project port for two languages, O2C and OQL,
[Dayal et al. 1988; Chakravarthy 1989; NAOS has been able to exploit this to
Dayal 1989] pioneered many of the most provide declarative expression of condi-
important ideas in active databases, tions using OQL and powerful action
such as coupling modes and composite expression using O2C. The execution
events, although the resulting design model of NAOS is slightly unusual, in
was not fully implemented. HiPAC was supporting depth-first, recursive pro-
associated with the passive OODB cessing of immediate rules, but breadth-
PROBE, and objects in this model were first, iterative processing of deferred
rules. The NAOS rule system has been and is also being used for experimental
formally specified using denotational work on optimization [Collet and Man-
semantics [Coupaye and Collet 1995], chado 1995].
6.2.4 Chimera. The Chimera [Ceri deductive language for condition expres-
et al. 1996] active rule system is unique sion encourages a set-oriented view of
among those surveyed here in building rule processing, and information is
upon a deductive object-oriented data- passed from the event to the condition
base (another such system is described by querying an event history. Another
in Dinn et al. [1996]). The use of the unusual feature of Chimera is that rule
conditions and actions can access past condition becomes true, its action is ex-
database states, either at the start of ecuted. Once signaled, triggers declared
the current transaction, or when the as once-only are automatically deacti-
rule was last fired. Chimera is imple- vated whereas those declared as perpet-
mented by compiling user statements ual are reactivated automatically. The
into an internal form that is interpreted user can explicitly deactivate a trigger
by a runtime system that stores both using the command deactivate. Unlike
database and rule system data using constraints, triggers with a condition
the ALGRES extended relational stor- that has evaluated to true are executed
age manager. in a separate transaction after the cur-
rent transaction has committed (i.e., the
6.2.5 Ode. The Ode database system event-condition coupling mode is imme-
is defined and manipulated using the diate, whereas the condition-action cou-
O11 database programming language, pling mode is detached dependent).
which extends C11 with database facil- Note that the processing supported by
ities (e.g., persistence, versions). It pro- triggers in Ode is quite distinctive, and
vides two categories of rules that are open to interpretation in different ways.
semantically divided into constraints Here, triggers have been considered as
and triggers, each with a different syn- condition-action rules, but an equally
tax and execution model [Gehani and valid interpretation is that they are
Jagadish 1991]. Although triggers can, event-action rules in which the event is
in general, be used to support con- defined using a rich event algebra and
straints, the authors argue that the dis- Boolean expressions, known as masks.
tinction clarifies the role that is being
played, and facilitates more efficient im- 6.2.6 SAMOS. SAMOS [Gatziu et
plementation. Both constraints and al. 1991; Gatziu and Dittrich 1994] pro-
triggers are defined at the class level, vides active facilities on top of the Ob-
and are subject to inheritance like other jectStore commercial OODB. As the de-
properties of a class. velopers of SAMOS did not have access
A constraint consists of a predicate on to the source of ObjectStore, the active
the state of an object and a single action system is implemented as a layer on top
to be executed if the condition becomes of ObjectStore, rather than as part of
false. Once the action has been exe- the kernel.
cuted, the system checks the condition Perhaps the most significant feature
again. If it is still false, the transaction of SAMOS is its event detector, the se-
is aborted. As for the event-condition mantics of which is based upon Petri
coupling modes, different options are nets, and which, in turn, is imple-
supported depending on whether con- mented using a graph structure that
straints should be checked immediately reflects the structure of the Petri net.
(declared as hard constraints), or de- The event language itself presents users
ferred until the end of transaction (de- with a series of operators that are
clared as soft constraints). Multiple up- shared by other systems with compre-
dates affecting the same hard hensive event languages, such as
constraint in the course of a transaction HiPAC [Dayal et al. 1988], Sentinel
cause the constraint to be evaluated [Chakravarthy et al. 1994], or REACH
once after each update, whereas for a [Buchmann et al. 1995].
soft constraint the check is only carried
out once at the end of the transaction. 6.2.7 Sentinel. Sentinel [Chakra-
Constraints affect all instances of a varthy et al. 1994] is an active exten-
class, and are permanently activated. sion to the C11 based OpenOODB sys-
Unlike constraints, triggers have to tem from Texas Instruments [Wells et
be explicitly activated on particular ob- al. 1992]. The focus in this project has
jects. If a trigger is active, then when its been upon the provision of comprehen-
system have taken place, if any. upon performance and limit what func-
Primitive events are notified from tionality can be supported in terms of
the database or from external sourc- primitive event detection, coupling
es; composite events are constructed modes, and optimization.
from incoming primitive events plus
information about past events that Integrated. The active component is
can be obtained from the history. developed by changing the source of an
existing passive database system. This
(2) The Condition Monitor evaluates
approach frees the designer of the active
the conditions of rules associated
database system from the limitations of
with events that have been detected
the layered approach, and is probably
by (1). In systems that support con-
the preferred model for developing in-
dition-action rules, there is no ex-
dustrial-strength systems. It is worth
plicit statement of the events to be
noting, however, that the number of re-
monitored, although actual imple-
quired changes to the kernel of a system
mentations do have to monitor prim-
to allow it to support active capabilities
itive events. The distinctive imple-
effectively is often not large, and that
mentation strategies that are often
practical systems can be developed us-
used in such systems are considered
ing largely layered software, with a
in Section 7.5.
small number of hooks into the kernel.
(3) The Scheduler compares recently
triggered rules with those that have The first systematic performance
previously been triggered, updates evaluation of different active database
the conflict set, and fires any rules systems and architectures is provided
that are scheduled for immediate by Geppert et al. [1998]. The following
processing. subsections address a range of imple-
(4) The Query Evaluator executes da- mentation issues in more detail.
tabase queries or actions. Access
may be required both to the current 7.1 Event Detection
state of the database and to past There are two principal aspects to the
states in order to support monitor- implementation of event detection—the
ing of how the database is evolving. monitoring of primitive events and the
The functionality of each of the preced- accumulation of information that is of
ing components depends very much on relevance to composite events.
the knowledge and execution models of The detection of primitive events nor-
the active database system to be sup- mally involves some form of check
ported, which in turn are influenced by within the kernel of the database sys-
the environment within which the ac- tem, a characteristic that means it is
tive database is being developed. Archi- often not possible for active functional-
tecturally, two principal categories of ity to be implemented as a layer on top
active database can be identified. of an existing database system. For ex-
ample, to detect that an update has
Layered. The active component is been made to a tuple in a relation, it is
developed as a layer of software on top necessary for the update operation of
of an unchanged passive database sys- the database system to be able to iden-
tem. This approach has the advantage tify which primitive events are associ-
that no access is required to the source ated with the specific update being per-
code of the passive database system, formed. As a further example, in object-
and that the resulting active system oriented databases events are often
may be easily portable for use with dif- raised in response to the invocation of
ferent passive systems. However, the user-defined methods, in which case the
lack of access to the kernel of the under- event detector must be notified of mes-
lying database may have an impact sage-sending events by the method dis-
events that are then consumed as com- may also have access to past states of
posite events are detected. For the ex- the database. For example, in Starburst
ample, in Figure 6, in all event con- [Widom et al. 1991] a transition log
sumption modes except Recent records how tables have changed during
mentioned in Section 4, if N occurrences a transaction, which supports access
of E 1 are raised before any occurrences from the condition of the rule to the
of E 2 , then all N occurrences of E 1 must accumulated changes associated with
be stored in anticipation of the subse- the event that has triggered the rule. A
quent raising of some matching occur- comparable mechanism is required by
rences of E 2 . Such a process can be very any system that supports rule process-
expensive, and in practice care must be ing based upon the net effect of a set of
taken in the design and use of compos- accumulated changes. The contents of
ite event detectors to ensure that the the history in a specific rule system
history datastore in Figure 5 does not thus depend upon the nature of the
become extremely large. event specification language supported,
plus the scope of access to past database
7.2 Condition Monitoring states from the condition/action of the
rule.
The event combined with the condition Some condition languages are based
describes the situation that an ECA- on the declarative query language of the
rule is monitoring. As such, there is underlying database, which raises the
often a close association between the possibility of applying optimization
event detector and the condition moni- techniques to rule conditions. In gen-
tor—the event detector initiates pro- eral, the existing optimizer can be ap-
cessing within the condition monitor, plied directly to the optimization of such
and information about the events that conditions, and significant gains in per-
have occurred must be passed from the formance are likely to be experienced
event detector to the condition monitor. where event parameters are used to re-
The more sophisticated the event detec- strict the information accessed by the
tor, the more complex will be the infor- condition. A similar theme is explored
mation to be passed to the condition by Baralis and Widom [1995], where it
monitor. For example, in the case of a is shown how exploitation of intermedi-
primitive event such as on insert to ate information held by the rule man-
Stock, the only information that needs ager can be used to speed up condition
be passed to the condition monitor evaluation, although this approach only
about the event is the inserted tuple. By provides significant gains where there
contrast, where the event is composite, is repeated triggering of individual
the relevant information about the rules. Furthermore, in systems with
event is also more complex. For exam- rich event algebras that are able to
ple, in a conjunctive event, information match specific values in events, an opti-
should be available to the condition of mizer may be able to move some of the
the rule on all of the events that caused selections from the condition into the
the conjunctive event to be signaled. event detector. It is also shown in Collet
Once rules that are associated with and Manchado [1995] how detailed
detected events have been retrieved analysis of rule conditions and actions
from the rule base and bound to the can be used to identify rules that are
parameters of these events, they must amenable to parallel execution.
be passed to the query evaluator to es- The design and implementation of ef-
tablish which rules have satisfied condi- fective situation monitors for active da-
tions. The query processor is likely to be tabase systems is of considerable impor-
an extension of that used with a passive tance, and various balances have to be
database, as rule conditions are param- struck between the provision of expres-
eterized with bindings from events, and sive facilities and efficiency of process-
ing. For example, expressive event alge- provide access to the current event. For
bras enable more of the situation that is example, the predicate current_occur-
being monitored to be described within rence(O) can be used in rule conditions
the event part of the rule, which in turn or actions in EXACT to obtain the pa-
leads to less frequent invocation of sim- rameters of the event occurrence that
plified rule conditions. However, the re- has triggered the rule. Starburst stores
duced cost of condition evaluation must binding information in transition tables
be balanced against the considerable that record the net effect of tuple modi-
overheads associated with composite fications caused during query process-
event detection. A definitive position on ing. Transition tables can be queried by
the tradeoffs involved in situation mon- the condition or the action of a rule.
itoring awaits further theoretical and Unlike Starburst, POSTGRES has
empirical analyses of alternative ap- tuple-based processing, which consider-
proaches. ably simplifies the bindings, since only
the current tuple needs to be consid-
7.3 Action Execution ered. Correlation names new and old
are provided to allow accessing the
Rules with conditions that are satisfied value of the current tuple before and
are prepared for execution by the sched- after modification.
uler, which also maintains the conflict
set of triggered rules that have yet to be 7.4 Transaction Management
fired. The complexity of the scheduler
also varies considerably from system to It is often the case that sophisticated
system: for example, in POSTGRES facilities in the associated passive data-
[Stonebraker et al. 1990] the scheduler base system can be used to increase the
is quite straightforward, as all rules are functionality of the active mechanisms.
fired as soon as they are triggered, and For example, in active object-oriented
because there is no priority scheme that systems much has been made of the
requires rules to be fired in a specific ability to associate rules with user-de-
order. By contrast, in Starburst [Widom fined operations, and to share active
et al. 1991] the scheduler is more com- behavior within inheritance hierarchies.
plex: rules must be fired in an order Most implemented active database sys-
that is consistent with a priority graph, tems are associated with conventional
and it is possible for a rule to be re- flat transaction models, and thus rules
moved from the conflict set without be- are processed to completion within the
ing fired because the processing of rules same transaction as the events that led
is based upon the net effect of the to their triggering. However, where
changes to the underlying database. more sophisticated transaction manage-
When a rule is scheduled for execu- ment facilities are available, these can
tion, its action is passed to the query be exploited to increase the flexibility of
evaluator, which in turn is likely to conventional rule systems, and to allow
update the database and the history. addition of features that can be used to
The action of a rule is also likely to have support more advanced applications.
access to information on the event that Rich transaction models can be used
caused the rule to be triggered (i.e., to underpin a range of different behav-
BindE ), and may also be passed data ioral extensions to execution models
that have been retrieved by the condi- [Beeri and Milo 1991]. A nested transac-
tion of the rule (i.e., BindC ), for exam- tion is a transaction that contains
ple, the set of objects for which an integ- within it a number of component trans-
rity constraint has been violated. actions, or subtransactions [Moss 1985].
Binding can be supported in different The nested transaction creates the sub-
ways. In HiPAC and EXACT, explicitly transitions and waits until they termi-
specified parameters are available to nate. This model can be extended so
that the nested transaction can run con- 7.5 Production Rule Algorithms
currently with the subtransactions
The architecture presented in Figure 5
[Harder and Rothermel 1993]. As well
makes explicit the role of event detec-
as speeding up the whole process as a tion for situation monitoring, whereas
result of increased concurrency, this some systems, such as Ariel [Hanson
model can be useful for active database 1992] and Amos [Skold and Risch 1995]
systems. For example, if the action of a support production (or condition-action)
rule is unable to carry out the task rules without explicit event specifica-
assigned to it, then there is a significant tions. In practice, however, primitive
chance that the whole transaction will update events must also be detected by
be aborted, potentially undoing a signif- database production systems, as the
icant amount of work. By contrast, if truth of a condition can be changed as a
the action of the rule is executed in a consequence of changes to the underly-
separate subtransaction (the triggered ing database. Figure 5 can thus be seen
transaction) which aborts, then the par- as a potential architecture for imple-
ent transaction (the triggering transac- menting a production rule system, al-
tion) is free to decide how to respond to though algorithms commonly used for
the failure: it could repeat the action a improving the efficiency of condition
set number of times, fire an alternative evaluation are quite different from
action, and so on. Such underlying func- those generally applied in the context of
tionality can be made available to the ECA-rules.
rule programmer as extensions to the Condition-action rules are processed
rule definition that describe how to re- in the context of the following recognize-
spond to failures. act cycle.
In addition, a number of issues can be match
identified that relate to the relationship while (conflict set not
between concurrency control and cou- empty) do
pling modes. If the triggering and trig- conflict resolution
act
gered transaction are executed concur- match
rently, it could happen, depending on end-while
the concurrency control method used,
that the triggered transaction commits In such a cycle, the match phase iden-
while the triggering transaction is still tifies rules with conditions that are true
executing (and thus, potentially abort- with respect to the state of the data-
ing). This possible behavior jeopardizes base, and adds them to the conflict
the concept of causality: an effect should set, which is essentially a queue of
not precede its cause [Hsu et al. 1988]. triggered rules waiting to be fired. The
conflict resolution step selects a
To fall into line with this concept, a
single rule from the conflict set for fur-
schedule must obey the following two
ther processing in the act phase, which
rules: the triggered transaction must be executes the statements in the action of
serialized after the triggering transac- the selected rule.
tion, and the triggered transaction can A naive evaluation of the match
commit only if the triggering transac- phase would evaluate the condition of
tion commits. The user may either every rule to find which rules should be
choose to obey the causality principle or considered for processing. Such an ap-
to allow the triggered transaction to be proach would be prohibitively expen-
executed freely. Using the terminology sive, and is unnecessary, as only a small
introduced in Section 4, these options part of the database over which each
correspond to the detached depen- condition acts is likely to change during
dent and detached independent cou- each cycle. What many methods seek to
pling modes, respectively. do is avoid recomputing the entire con-
dition of a rule by storing information tom of the tree is the result node that
on the partially computed condition of a holds the conflict set.
rule between cycles. The Rete match phase operates by
In what follows, the example relations passing information down through the
from Figure 2 are used to illustrate two network from the root. For example, if a
of the principal approaches. A typical new Holder tuple is entered into the
production rule in Ariel notation [Han- database, it is tested to see if it has a
son 1992] relating to these data could country equal to UK—if so, it is stored
monitor every UK based owner of IBM in the a memory node alpha1. The tuple
stock: is then joined with the a memory node
alpha2, and if tuples result from the
if s.name 5 “IBM” and join, they are stored in the b memory
s.stock# 5 o.stock# and node beta1. Any such new tuples are
o.reg# 5 h.reg# and then joined to the a memory node al-
h.country 5 “UK” pha3 to yield additional data for the
from s in Stock, o in Owns, conflict set.
h in Holder Although Rete has been used in com-
do ^action& mercial production-rule systems, there
The query used to express the condi- are a number of problems, especially
tion involves a join of the Owns relation when large databases are used: the
with both Stock and Holder. space overhead is high, with both a and
The principal notion behind the Rete b memories storing the intermediate re-
[Forgy 1982] matching algorithm, which sults of computation, and maintenance
was originally proposed for implement- of such results, particularly on deletion
of data, imposes a significant overhead.
ing main-memory OPS-5 production
Work on the identification of alterna-
rule systems, is that by storing the par-
tives to Rete has explored two principal
tially computed condition of a rule be-
issues relating to intermediate informa-
tween cycles of rule execution, the effect
tion.
of changes to the database on the con-
flict set can be computed with minimal What to Store. A spectrum can be
additional effort. The partially com- seen to exist, with no storage of inter-
puted condition of a rule is often stored mediate results at one end, and storage
in a graph structure known as a dis- of all intermediate results at the other.
crimination network. The preceding ex- Rete is at the storage-intensive end of
ample query can be represented by the this spectrum, with both a and b mem-
Rete discrimination network in Figure ories being used. A variation of Rete
7. with a but no b memories is TREAT
The Rete network has a number of [Miranker 1987], which outperforms
different node types: a root node serves Rete in many cases [Wang and Hanson
as the entry point to the network; below 1992]. More recent research has shown
the root node are a number of nodes how rules can be analyzed to identify
that represent the base tables; and be- what level of intermediate storage is
low any node that represents a stored most suitable for them [Fabret et al.
table, there can be zero or more filter 1993].
nodes, each of which applies a single
condition to the relation. After a filter How to Store It. Algorithms such as
has been applied, the tuples that have TREAT can be built directly on top of
satisfied the condition in the filter are relational storage structures, but re-
stored in a memory tables. A node with searchers have identified structures
two parents performs a join on its par- that improve certain aspects of condi-
ent relations, the result of which is tion monitoring. For example, Hanson
stored in a b memory node. At the bot- [1992] exploits interval skip lists to re-
duce the cost of searching and updating set of cooperating objects distributed
a memories, and Brant and Miranker throughout a network of loosely coupled
[1993] use a specialized index structure autonomous nodes. Event detection,
to improve join performance. event management, or rule manage-
ment are seen as services that cooperate
7.6 Active Rules in a Distributed to offer the functionality previously
Environment bundled in a monolithic active mecha-
Until now, this article has assumed that nism. Standards such as CORBA [Orfali
active behavior is being supported in a et al. 1996] provide the communication
single centralized database. However, middleware required for cooperation in
many modern applications have a dis- this distributed setting. Figure 8 gives
tributed nature, and a number of pro- an overview of how the architecture pre-
posals have been made for exploiting sented in Figure 11 has been adapted to
active behavior in distributed systems. the new setting. The pioneer work of C2
Here, the active mechanism is seen as a offeine [Koschel et al. 1997] illustrates
this approach. This system enables ECA fers distinct alternatives: (1) a central
rule-based detection, processing, and re- rule manager maintaining a global rule
porting of events and complex situa- base, (2) a set of rule managers in dis-
tions to be done in CORBA-based sys- tinct sites each one with its local rule
tems with heterogeneous and base, and (3) a set of rule managers but
distributed information sources. Despite with a global rule set [von Bueltzings-
the limited experience to date, some in- loewen et al. 1998].
sights can be given about the implica- Being in a distributed context, archi-
tions of distribution of active rule sup- tectural alternatives must consider
port. communication overheads. For instance,
As far as architecture is concerned, CORBA includes an event service that
rule management is no longer central- supports asynchronous communication
ized but distributed. Although Figure 8 between objects. Communication is
suggests that each component is cen- achieved through event channels. An
trally located at a different site, this event channel is a queue onto which
does not need to be so. For instance, events are placed by suppliers and re-
event detection can be distributed moved by consumers. Two models are
among sites [Bacon et al. 1995; Schwid- provided for event communication,
erski 1996]. Each site contains a local based on who initiates the communica-
event detector and a global event detec- tion. The push model allows a supplier
tor. The former basically corresponds to of events to initiate the transfer of the
the detectors found in centralized sys- event data to consumers. The pull
tems, while the latter are responsible model permits a consumer of events to
for monitoring intersite composite request the event data from a supplier.2
events. A global event detector responsi- These options should be considered
ble for event e registers its interest in
e’s components in the corresponding de-
tectors. The detection of a global event 2
A key point, however, is that both the supplier
is then distributed among different and the consumer are aware of event processing;
sites. As soon as an event is detected, a that is, they have to initiate event processing
explicitly, thus violating the nonintrusive princi-
signal is sent to each of the detectors ple that characterizes the event-based paradigm.
that have registered an interest in it. Moreover, CORBA does not explicitly support
Likewise, rule management support of- composite events.
when addressing communication among site has its own local clock, and events
the distinct components supporting the may occur simultaneously at different
active functionality. For instance, sites. As events contributing to a com-
should the signaling phase involving posite event originate from different
communication between event sources sites, an event’s timestamp should be
and the event detector follow a push globally meaningful. Therefore, local
model (also known as reactive) or a pull clocks must be synchronized through
model (also known as proactive)? Reac- special time servers that transmit time
tive models are useful for central event information to each site, and the delay
detectors where every event is relevant in the synchronization among the sites
for the system. Otherwise, an important should be below a parameter P obtained
communication overhead is caused since as the maximum time difference be-
every event must be communicated to tween two “simultaneous” ticks of any
the event detector. On the other hand, two local clocks. Summing up, two time-
proactive models incur a bigger process- stamps are required, namely, local
ing overhead [von Bueltzingsloewen et timestamps, needed for constructing in-
al. 1999]. Likewise, communication be- trasite composite events, and global
tween the event detector and the rule timestamps as a canonical form used in
manager (the triggering phase) can also the detection of intersite composite
follow a reactive or a proactive ap- events [Schwiderski 1996].
proach. The former implies explicit sub- Finally, the execution model also
scription of the rule manager to the set needs to be revised. As a case in point,
of events in which it is interested, the error handling dimension should
whereas the proactive approach leaves now be extended with communication
the rule manager to poll the event col- delays and disruptions to be faced in
lection periodically [von Bueltzingsloe- any messaging among the components
wen et al. 1999]. of the active mechanism. The solution
In addition to architectural consider- will vary depending on the components
ations, both the knowledge and execu- and the impact of the error. For in-
tion models should also be revised when stance, communication delays during
moved to a distributed (and potentially signaling between the event detector
heterogeneous) setting. As for the and an event source can cause global
knowledge model, heterogeneity of the event detectors to receive events in a
event sources can lead to additional different order from their actual occur-
classifications besides those found in rence. Contingency actions can opt for
centralized systems (e.g., workflow asynchronous evaluation or synchronous
events). Also, the diversity of the data evaluation [Schwiderski 1996]. The
sources and the lack of a single state former ignores the fact that there may
requires further precision in setting the be delayed events, and begins evalua-
context in which conditions and actions tion as soon as suitable event occur-
are performed. A complex problem is rences arrive at a composite event de-
that of timestamps. In a centralized sys- tector. Hence, events are not composed
tem there is a single clock that allows a in a way that takes account of the order
total ordering of event instances based of their occurrence, but, on the other
on their occurrence time. That is, two hand, event detection is not blocked by
distinct primitive events e 1 and e 2 can delayed events and is therefore faster.
always be ordered as they cannot occur As an example, consider the event e 1 or
simultaneously: either e 1 happens be- e 2 . If e 2 ’s site fails, the disjunction can
fore e 2 or vice versa. The time of a still be detected whenever e 1 is de-
composite event occurrence is then de- tected. By contrast, synchronous evalu-
rived from the occurrence times of its ation waits for delayed events, and eval-
components. By contrast, distributed uation proceeds only if all relevant
systems do not have global time: each events have arrived at the site of the
global event detector. Although syn- active mechanisms, and which using
chronous evaluation respects the occur- other techniques, and (2) what perfor-
rence order of events, the evaluation mance penalty is likely to result from
may be blocked long-term if there is the use of rules. This is exacerbated
transmission disruption or site failure. by the lack of appropriate design
In the previous disjunctive example, the methodologies.
sites of both e 1 and e 2 are checked for —The functionality of a large rule base
relevant events before a disjunctive may be difficult to understand, with
event occurrence is detected. In most rules interacting in complex ways and
cases, checking reveals that no relevant no single description of how control
events should have been detected. Occa- flows through an application.
sionally, a disruption can occur that de- —The tools associated with an active
lays the arrival of a relevant event. The rule system may be minimal, with
global detector does this checking so little support for browsing, monitor-
that the consumption policy can be ing, or debugging of active rules.
properly supported. As Schwiderski
points out, which strategy is most ap- These points reflect a need for design
propriate depends on the application. methodologies, rule analysis tech-
Likewise, failure of data source access niques, and tools for debugging and ex-
(e.g., due to a node breakdown) during planation. In what follows, recent ad-
condition evaluation or action execution vances in each of these areas are
should be addressed. The options pro- outlined.
posed range from an instead action to
the execution of no action [Koschel et al. 8.1 Rule Design
1997].
Although few details are yet avail- There are well-established techniques
able, distributed active rule manage- for database design that emphasize the
ment is likely to be one of the future description of the structural aspects of
services offered by CORBA-compliant information in a domain (e.g., E/R mod-
suppliers. Its need can be corroborated eling, normalization), and which in turn
by the proposals for event mechanisms are used alongside mechanisms for de-
which, independently of the active scribing processes (e.g., dataflow dia-
DBMS community, have already been grams) to capture the semantics of com-
proposed for supporting debugging plete applications. Although active
[Bates 1995], communication, and inte- behavior is often closely linked to the
gration in distributed applications structures stored in a database, and
[Amouroux 1995; Barghouti and Krish- rule actions carry out tasks that can be
namurthy 1995]. viewed as processes, it is not yet clear
what techniques are most suitable for,
or most easily adapted to address, the
8. DEVELOPING ACTIVE APPLICATIONS
functionalities supported by active
Comprehensive support for active mech- rules. In particular, given the require-
anisms within a database system is no ments of an application, design tech-
guarantee that they will be used. In- niques should provide guidance on the
deed, experience in the application of aspects that should be supported using
active databases often indicates that al- active mechanisms, and those that are
though such facilities are suitable for better addressed using other facilities.
performing a range of different tasks, Where proposals have been made for
they are not straightforward to use. Dif- methods with explicit support for active
ficulties include the following. behavior, this has often been as an ex-
tension to an existing structural data
—It is not obvious (1) which parts of an model. For example, (ER) 2 [Navathe et
application should be supported using al. 1995] is an extension of the E/R
create rule R1 as
on insert to Rel
if num . 10
do insert into Rel values
(5)
Using the approach described previ-
ously, R1 in itself would be considered
to be a potential source of nontermi-
nation, although in practice R1 is
never directly recursive because the
tuple inserted by its action always Figure 10. Graph depicting confluent rule behav-
leads to the condition of the rule be- ior.
ing false. Less conservative ap-
proaches to rule termination analysis
that examine the conditions and the
actions of rules in more detail, but on insert to Owns or update
to reg# of Owns or
which are as a result more system
update to reg# of Holder
specific, are presented in Baralis and if ^amount of stock held by
Widom [1994] and Weik and Heurer Holder h is more than Num-
[1995]. Stocks&
do ^reduce range of stock
—Confluence. Is the result of rule held by Holder h&
processing independent of the order
in which simultaneously triggered These rules clearly implement incon-
rules are selected for processing? If sistent policies regarding stock hold-
the policy Holder relation from Sec- ing; if both rules have the same prior-
tion 2 had an attribute NumStocks, ity and are present in the rule base at
the role of this attribute could be in- the same time, then updates to the
terpreted differently by different database will nondeterministically af-
rules. For example, the following rule fect what stock is held.
would help to maintain NumStocks as Confluence can be understood by con-
the number of items of stock held. sidering that the firing of a rule in
one database state may lead to the
on insert to Owns or creation of a new database state. If
update to reg# of Owns or more than one rule is triggered at the
update to reg# of Holder same time, then more than one poten-
if ^change affects amount of tial successor state exists, as illus-
stock held by Holder h& trated in Figure 10 where the states
do ^update NumStocks at-
tribute of h&
S2 and S3 are the successors of S1
that result from the firing of rules R i
However, an alternative interpreta- and R j , respectively. A rule base is
tion would treat NumStocks as the confluent if for any two rules R i and
maximum number of stocks that a R j triggered in any initial state S1, a
Holder can own at any one time, giv- single final state S4 is guaranteed to
ing rise to the following rule. be reached regardless of the order in
which any subsequent simultaneously plied with active systems, and because
triggered rules are selected for firing it is not always obvious what action
(denoted as * in Figure 10). Note that, should be taken when a potential source
for example, the actions of rules R i of nontermination or nonconfluence is
and R j may have triggered additional detected. There is a range of possible
rules as a side-effect of the transition changes that can be made: rule priori-
from S1 to states S2 and S3, and that ties can be used to tailor the order in
the behaviors of these subsequently which rules fire, rule conditions or ac-
triggered rules have to be taken into tions can be modified to change their
account when considering confluence effect, or rules may be seen to be imple-
of the entire rule base. Work on con- menting conflicting policies and
fluence analysis has developed algo- dropped. The development of effective
rithms for analyzing complete rule rule analysis systems awaits further
bases [Aiken et al. 1992], for consider- work on communicating the results of
ing the effect of an update on the analysis to users, as well as experience
truth of a condition [Baralis and Wi- based upon the use of implemented rule
dom 1994; Levy and Sagiv 1993], and analyzers.
for characterizing the contexts in
which nonconfluent behavior may be 8.3 Rule Debugging
exhibited [van der Voort and Siebes
1994]. Users may be reluctant to apply active
facilities because of anticipated prob-
—Observable determinism. Is the lems with maintenance, unforeseeable
effect of rule processing as observed behavior, and lack of control [Simon and
by a user of the system independent Kotz-Dittrich 1995], which motivates
of the order in which triggered rules the development of debugging environ-
are selected for processing? This no- ments that help in defining safe rule
tion seeks to extend deterministic sets, that is, rules that comply with the
rule system behavior beyond the termination, confluence, and observable
boundaries of the database itself. For determinism properties previously de-
example, the following two rules im- scribed.
plement a response which is confluent Unfortunately, these properties are
but observably nondeterministic. not always easy to ascertain for a fully
on ^event E1& fledged rule language at compile time,
if ^condition C1& and hence research on rule analysis has
do ^send message to user& focused on formal declarative lan-
on ^event E1& guages. However, not all authors agree
if ^condition C1& that active rule systems should neces-
do ^abort& sarily be associated with such lan-
guages, and many implemented rule
In this example, if the first rule is
systems are integrated with imperative
scheduled for firing before the second,
database programming languages
then the user receives a message and
[Buchmann 1994]. Furthermore, the
the transaction over the database is
aborted. By contrast, if the second fact that a rule base exhibits terminat-
rule is scheduled before the first, then ing and confluent behavior does not in
the transaction is aborted, but no itself imply that it is correct. Thus, as
message is sent to the user. rule languages become more compli-
cated, thereby increasing the range of
Initial research into the static analy- applications for which they are suitable,
sis of active rule bases has not, to date, the need for rule debugging environ-
significantly eased the development of ments becomes increasingly pressing.
active applications. This is because such Unfortunately, traditional debugger
rule analyzers are not generally sup- models are not adequate for debugging
The representation is a tree where the size tends to increase in a uniform way,
root is artificially created (the corre- it suggests that the cycle will not termi-
sponding node is labeled with root) and nate. Erroneous rule condition declara-
its direct descendants are the first tions may be suspected if the number of
events to be raised. Nodes can represent times a rule is executed is very low
either events or rules, where event compared to the number of times the
nodes alternate with rule nodes. An arc rule is triggered. Thus, features of sta-
from an event node to a rule node tistical data can point to potentially ab-
means that the event has triggered the normal behavior.
rule. An arc from a rule node to an The preceding approaches have fo-
event node means that the event was cused mainly on displaying the inter-
produced as a result of executing the leaving of events and rules, but are
action of the rule. As execution pro- restricted to primitive events. The mon-
ceeds, the event/rule tree is constructed itoring of composite event occurrences is
depth-first. In Figure 11, event (put_ a more complicated task due to the
projects,before,2#manager) happened be- large number of occurrences that may
fore (modify_method,before,2#manager), need to be shown and the intricate ways
and the leftmost occurrence of rule 12#in- in which events are combined to obtain
tegrity_rule before the leftmost occur- composite event occurrences. A first ap-
rence of rule 14#integrity_rule. More- proach to this issue has been presented
over, Figure 11 also makes explicit the as part of the Sentinel system [Chakra-
conflict set of simultaneously triggered varthy et al. 1995]. Sentinel provides a
rules, once the conflicts among those post-execution debugging tool where in-
rules have been resolved by the rule formation from the execution is stored
manager. An indication of the rules par- in log files that are consulted by the
ticipating in this conflict set is useful debugging tool to simulate runtime ac-
for focusing on a restricted number of tivities. An event tree is created where
rules where complex interactions can primitive events are leaf nodes and
occur. composite events are seen as parents of
Rather than building trees following their component events. A color code is
the execution, an alternative investi- used to represent event status (detected
gated in the visual tool for rule analysis or not detected). This tree grows from
VITAL [Benazet et al. 1995] is to show primitive events to the root. In addition,
the trace in the triggering graph created a transaction tree describes the trigger-
during analysis (see Figure 9). A color ing rule context: the root node repre-
code is used for each event state (i.e., sents the top-level transaction, and
raised or not raised) and each rule state child nodes represent rules fired in the
(i.e., inactive, triggered, or executed). context of their parent node (either the
As execution proceeds the displayed col- user transaction or a rule, as rules are
ors change, and a textual trace of the executed as subtransactions). A color
execution is displayed in a separated code is used to represent the different
window. VITAL also proposes the use of states of subtransactions: running, sus-
a statistics manager that calculates and pended, or committed. Whenever a rule
records statistics on the behavior of the is fired, a line is drawn connecting the
rule processor (e.g., the number of transaction node of the current rule and
tuples inserted, deleted, or modified the triggering event. An example is
during a rule execution cycle, the num- given in Figure 12. The detection of
ber of times a rule is triggered, etc). events e1 and e2 leads to the happening
These data can be used, for instance, to of the conjunction event e5, which in
identify potentially infinite cycles, or to turn causes the triggering of rule R1
help find erroneous rule declarations. (i.e., trans 111). This rule is fired in the
The former can be ascertained by moni- context of the running transaction trans
toring the size of relevant tables: if the 11, which is a child of transaction trans
9. CONCLUSIONS REFERENCES
Research into active databases has pro- ABITEBOUL, S. AND HULL, R. 1987. IFO: A for-
ceeded along similar lines to early re- mal semantic database model. ACM Trans.
Database Syst. 12, 4 (Dec.), 525–565.
search into object-oriented databases, in
AGRAWAL, R., COCHRANE, R., AND LINDSAY, B.
that there has been considerable exper- 1991. On maintaining priorities in a produc-
imentation, but relatively little work on tion rule language. In Proceedings of the Sev-
standardization or theory. This has re- enteenth VLDB, G. Lohman, A. Sernadas, and
sulted in a wide range of constructs, R. Camps, Eds., Morgan-Kaufmann, San Ma-
execution strategies, and software ar- teo, CA, 479 – 487.
chitectures being proposed that have AIKEN, A., WIDOM, J., AND HELLERSTEIN, J. 1992.
Behaviour of database production rules: Ter-
utility in different problem domains mination, confluence, and observable deter-
[Dittrich et al. 1995]. This survey has minism. In SIGMOD Rec. 21, 59 – 68.
reviewed research and development AMOUROUX, R. 1995. Reactive services for sup-
work in active databases by: describing porting tool integration in a development en-
tasks that can benefit from active be- vironment. In Proceedings on Technology of
Object-Oriented Languages and Systems
havior, presenting a framework that (TOOLS), 61–70.
characterizes important aspects of ac- BACON, J., BATES, J., HAYTON, R., AND MOODY,
tive functionality, describing a range of K. 1995. Using events to build distributed
representative systems within the applications. In Proceedings of the Interna-
bases for financial applications. In Proceed- DINN, A., PATON, N., WILLIAMS, M., AND FER-
ings of the Fourth International Workshop on NANDES, A. 1996. An active rule language
Research in Data Engineering (RIDE-ADS), J. for ROCK & ROLL. In Proceedings of the
Widom and S. Chakravarthy, Eds., IEEE, 46 – Fourteenth British National Conference on
52. Databases, Springer-Verlag, 36 –55.
COLLET, C. AND MANCHADO, J. 1995. Optimiza- DITTRICH, A. K. 1993. Adding active functional-
tion of active rules with parallelism. In Pro- ity to an object-oriented database—a layered
ceedings of Active and Real Time Database approach. In Proceedings of Datenbank-
Systems (ARTDB), M. Berndtsson and J. systeme in Buro (Braunschweig, Germany).
Hansson, Eds., Springer-Verlag, 82–103. DITTRICH, K., GATZIU, S., AND GEPPERT, A.
COLLET, C., COUPAYE, T., AND SVENSEN, T. 1994. 1995. The active database management sys-
NAOS: Efficient and modular reactive capa- tem manifesto: A rulebase of ADBMS fea-
bilities in an object-oriented database system. tures. In Rules In Database Systems: Proceed-
In Proceedings of the Twentieth VLDB Confer- ings of the Second International Workshop, T.
ence, J. Bocca, M. Jarke, and C. Zaniolo, Eds., Sellis, Ed., Springer-Verlag, 3–17.
Morgan-Kaufmann, San Mateo, CA, 132–143. ETZION, O. 1993. PARDES—a data-driven ori-
COUPAYE, T. AND COLLET, C. 1995. Denotational ented active database model. SIGMOD Rec.
semantics for an active rule execution model. 22, 1, 7–14.
In Proceedings of the Second International ETZION, O., GAL, A., AND SEGEV, A. 1994. Data
Workshop on Rules in Database Systems, T. driven and temporal rules in PARDES. In
Sellis, Ed., Springer-Verlag, 36 –50. Proceedings of the First International Work-
DAYAL, U. 1989. Active database management shop on Rules in Database Systems, N. Paton
systems. SIGMOD Rec. 18, 3, 150 –169. and M. Williams, Eds., Springer-Verlag, 92–
108.
DAYAL, U., BUCHMANN, A., AND MCCARTHY, D.
1988. Rules are objects too: A knowledge FABRET, F., REGNIER, M., AND SIMON, E. 1993.
model for an active object oriented database An adaptive algorithm for incremental evalu-
system. In Proceedings of the Second Interna- ation of production rules in databases. In
Proceedings of the Nineteenth International
tional Workshop on OODBS, LNCS 334, K.
Conference on Very Large Data Bases, R.
Dittrich, Ed., Springer-Verlag, 129 –143.
Agrawal, S. Baker, and D. Bell, Eds., Morgan-
DAYAL, U., HSU, M., AND LANDIN, R. 1990. Or- Kaufmann, San Mateo, CA, 455– 466.
ganising long-running activities with triggers
FERNANDES, A., WILLIAMS, M., AND PATON, N.
and transactions. In Proceedings of the SIG-
1997. A logic-based integration of active and
MOD Conference, ACM, New York, 204 –214.
deductive databases. New Gen. Comput. 15, 2,
DEUX, O. ET AL. 1990. The story of O 2 . IEEE 205–244.
Trans. Knowl. Data Eng. 2, 1 (March), 91– FERNANDEZ, R. AND DIAZ, O. 1995. Reactive be-
108. haviour support: Themes and variations. In
DIAZ, O. 1992. Deriving rules for constraint Proceedings of the Second International Work-
maintenance in an object-oriented database. shop on Rules in Database Systems, T. Sellis,
In Proceedings of the International Conference Ed., Springer-Verlag, 69 – 85.
on Databases and Expert Systems DEXA, FORGY, C. 1982. Rete: A fast algorithm for the
I. R. A. M. Tjoa, Ed., Springer-Verlag, 332– many pattern/many object pattern match
337. problem. Artif. Intell. 19, 17–37.
DIAZ, O. AND JAIME, A. 1997. EXACT: an EX- FRATERNALI, P. AND TANCA, L. 1995. A struc-
tensible approach to ACTive object-oriented tured approach to the definition of the seman-
databases. VLDB J. 6, 4, 282–295. tics of active databases. ACM Trans. Data-
DIAZ, O., JAIME, A., AND PATON, N. 1994a. base Syst. 20, 4, 414 – 471.
DEAR: A DEbugger for Active Rules in an GATZIU, S. AND DITTRICH, K. 1994. Events in an
object-oriented context. In Proceedings of the active object-oriented database. In Proceed-
First International Workshop on Rules in Da- ings of the First International Workshop on
tabase Systems, N. Paton and M. Williams, Rules in Database Systems, N. Paton and M.
Eds., Springer-Verlag, 180 –193. Williams, Eds., Springer-Verlag, 23–39.
DIAZ, O., JAIME, A., PATON, N., AND AL QAIMARI, G. GATZIU, S., GEPPERT, A., AND DITTRICH, K. 1991.
1994b. Supporting dynamic displays using Integrating active concepts into an object-ori-
active rules. SIGMOD Rec. 23, 1, 21–26. ented database system. In Proceedings of the
DIAZ, O., PATON, N., AND GRAY, P. 1991. Rule Third Workshop on Database Programming
management in object-oriented databases: A Languages, P. Kanellakis and J. Schmidt,
uniform approach. In Proceedings of the Sev- Eds., Morgan-Kaufmann, San Mateo, CA.
enteenth International Conference on Very GEHANI, N. AND JAGADISH, H. 1991. ODE as an
Large Data Bases (Barcelona), G. Lohman, A. Active Database: Constraints and Triggers. In
Sernadas, and R. Camps, Eds., Morgan-Kauf- Proceedings of the Seventeenth International
mann, San Mateo, CA, 317–326. Conference on Very Large Data Bases (Barce-
agement system. Commun. ACM 34, 10 (Oct.), Real Time Database Systems (ARTDB), M.
78 –92. Berndtsson and J. Hansson, Eds., Springer-
STONEBRAKER, M., JHINGRAN, A., GOH, J., AND Verlag, 158 –169.
POTAMIANOS, S. 1990. On rules, procedures, WELLS, D., BLAKELEY, J., AND THOMPSON, C. 1992.
caching and views in database systems. In Architecture of an open object-oriented data-
Proceedings of ACM SIGMOD, 281–290. base management system. IEEE Comput. 25,
THOMAS, I. AND JONES, A. 1995. Design and im- 10 (Oct.).
plementation of an active object-oriented da- WIDOM, J. 1992. A denotational semantics for
tabase supporting construction of database the Starburst production rule language. SIG-
tools. In Proceedings of the Second Interna- MOD Rec. 21, 3, 4 –9.
tional Workshop on Rules in Database Sys-
tems, T. Sellis, Ed., Springer-Verlag, 147–164. WIDOM, J. AND FINKELSTEIN, S. 1990. Set-ori-
ented production rules in relational database
VAN DER VOORT, L. AND SIEBES, A. 1994.
systems. In Proceedings of the ACM SIGMOD
Enforcing confluence of rule execution. In Pro-
International Conference on Management of
ceedings of the First International Workshop
Data, 259 –270.
on Rules in Database Systems, N. Paton and
M. Williams, Eds., Springer-Verlag, 194 –207. WIDOM, J., COCHRANE, R., AND LINDSAY, B. 1991.
VON BUELTZINGSLOEWEN, G., KOSCHEL, A., LOCK-
Implementing set-oriented production rules
EMANN, P., AND WALTER, H. 1999. ECA
as an extension to Starburst. In Proceedings
functionality in a distributed environment. In of the Seventeenth International Conference on
Active Rules in Database Systems. Springer- Very Large Data Bases (Barcelona),
Verlag. R. C. G. M. Lohman and A. Sernadas, Eds.,
WANG, Y.-W. AND HANSON, E. 1992. A perfor- Morgan-Kaufmann, San Mateo, CA, 275–286.
mance comparison of the Rete and TREAT WINSTON, P. 1984. Artificial Intelligence (Sec-
algorithms for testing database rule condi- ond ed.). Addison-Wesley, Reading, MA.
tions. In Proc. of Data Engineering, 88 –97. ZANIOLO, C. 1994. A unified semantics for ac-
WEIK, T. AND HEURER, A. 1995. An algorithm tive and deductive databases. In Rules in
for the analysis of termination of large trigger Database Systems, N. Paton and M. Williams,
sets in an OODBMS. In Proceedings of Active Eds., Springer-Verlag.