The RETE Algorithm

Example

rete-rule-1:
if	match(red,green)
and	data(X, X)
and	data(Y, green)
then	...
	
rete-rule-2:
if	match(X, red)
and	data(Colour, X)
and	Colour \= green
and	data(X, X)
then	...

Pattern Network

[Image]

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

[Image]

Compiling Rules

Example

	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

......