![](bg3.png)
alpha nodes have exactly one positive input and an ar-
bitrary number of negated inputs. Negated condition
elements can thus be realized in the alpha and beta
network.
If a negated edge connects the output of x with
an input of y, we call x a negatively connected node
(NCN) of y.
The possible implementations of negations are
now discussed briefly. As above we start in the beta
network.
Variant I in the Beta Network
The already mentioned method of implementation
in a beta node shall be explained in more detail. A
beta node with positively connected nodes (PCNs)
and NCNs joins with the PCNs and filters using
the NCNs. If a new fact tuple reaches the node
from a PCN it is joined with the other PCNs. The
result is stored in the node’s memory only if no
matching fact tuples can be found in any of the
NCNs. Deleting a fact tuple in a PCN deletes the
fact tuples resulting from that fact. A new fact tu-
ples reaching the node on a NCN is joined with
the current result set and matching fact tuples are
deleted. If a fact tuple is deleted in a NCN, match-
ing fact tuples are searched for in the PCNs or
their joins. Fact tuples found are filtered by NCNs
and added to the result set.
Variant II in the Beta Network
The second method tries to reduce the compara-
tively high effort of the joins needed in a variant I
beta node if a fact tuple is deleted in a NCN. For
that purpose all join results of the PCNs are saved
instead of only saving a filtered set. To every fact
tuple a counting field is added for every NCN.
The counting field holds the number of matching
fact tuples in the corresponding NCN. Only the
fact tuples with zeros in their counting fields are
relevant to successor nodes. If a new fact tuple
reaches the node from a PCN, it is joined with the
other PCNs and added to the result set. The count-
ing fields are filled with the sizes of the particular
joins with every NCN. Deleting a fact tuple in
a PCN deletes the fact tuples resulting from that
fact. A new fact tuple reaching the node from a
NCN is joined with the result set and the counting
fields of the matching fact tuples are increased by
one. One of the counting fields raising from zero
triggers a propagation of the corresponding fact
tuple to successor nodes as deleted. If a fact tu-
ple is deleted in a NCN, it is joined with the re-
sult set and the counting fields of the matching
fact tuples are decreased by one. A counting field
dropping to zero has the corresponding fact tu-
ple propagated as new to successor nodes. The
rule based system Jamocha (Jamocha, 2006) uses
nodes of this kind.
Negation in the Alpha Network
As mentioned above, negation can also be imple-
mented in the alpha network. The implementation
is similar to the second variant in the beta network
adding counting fields for the NCNs. If a new fact
reaches the node, it is joined with the NCNs and
saves the join size in the counting fields. Only if
no matching facts are found, the fact is passed on
to successor nodes. Deleting a fact in the node
propagates the fact to successor nodes only if the
counting field is zero. A new fact reaching a
NCN is joined with the node and the counting
fields of the fact tuples in the join result are in-
creased by one. One of the counting fields rais-
ing from zero triggers a propagation of the cor-
responding fact to successor nodes as deleted. If
a fact in a NCN is deleted, it is joined with the
node and the counting fields of the fact tuples in
the join result are decreased by one. A count-
ing field dropping to zero has the correspond-
ing fact propagated as new to successor nodes.
Gator (Hanson and Hasan, 1993) (Hanson, 1993)
uses negation in this way.
The methods mentioned above are certainly not
the only ways to implement negation, but one possi-
bility to negate in the alpha network and two funda-
mentally different variants to negate in the beta net-
work with dissimilar pros and cons have been pre-
sented. It has been clarified that a negated condition
element does not change the nodes themselves, but
how facts from the corresponding nodes are handled.
The possibility to negate in the alpha network already
offers potential for network optimization.
On the other hand the task to estimate the costs
for a negation in a network has become more diffi-
cult than just estimating the costs of nodes concerning
joins. Here the costs arising from a negation are to be
added to the costs of the adjacent nodes. However to
estimate the cost in a proper way, both mechanisms
have to be rateable. If it is not known how a network
implements negations, it is rated as if it uses variant I.
According to the considerations above, the con-
straints for rateable networks can be summarised as
follows: Each rule condition has at least one non-
negated condition element and different negated con-
dition elements don’t have shared bound variables.
Alpha nodes with negated edges always have an in-
ternal memory.
4.1.4 Processing Tokens
Upon creation of a new fact f (by a rule for example)
DATA2013-2ndInternationalConferenceonDataManagementTechnologiesandApplications
34