The RETE Algorithm


if	match(red,green)
and	data(X, X)
and	data(Y, green)
then	...
if	match(X, red)
and	data(Colour, X)
and	Colour \= green
and	data(X, X)
then	...

Pattern Network


Join Network

Once it has been determined which patterns have been matched by facts, comparisons of variable bindings across patterns must be checked to ensure that variables used in more than one pattern have consistent values.

Join network for rete-rule-2


Compiling Rules


	a & b | c -> d

a & e -> f

test a

iffalse L1

test b

iftrue L2

test e

iftrue L3

L1: test c

iffalse ......

L2: do d


L3: do f