Skip to: Site menu | Main content

Drools

Java Rules Engine

Rete Vs Reteoo Print

This is an attempt to show the difference for network building between rete and reteoo. What it boils down to is that rete only ever allows single declaration tuples for the right hand side of a join. I've illustrated the different networks using a two condition example and then a three condition example.

Next I'm going to exlore the indexing differences, ie propogating of TupleSets.

Notation
(...) <- expresions
[...] <- joins

Two Condition Example

Reteoo - (A==B) and (C==D)
  A   B   C   D
   \ /     \ /
  [A+B]   [C+D]
    |       |
  (A==B) (C==D)
     \     / 
      \   /
    [A,B+C,D]
        |
    [Terminal]
Rete - (A==B) and (C==D)
 A   B     C      D
  \ /      |     /
 [A+B]     |    /
   |       |   / 
 (A==B)    /   |   
    \     /    |      
     \   /     |     
  [A+B+C]      |
        \      |  
         \     | 
        [A,B,C,D]
            |
          (C==D)    
            |
        [Terminal] 

Three Condition Example

Reteoo - (A==B) and (C==D) and (A==B==C==D)
 
  A   B     C   D
   \ /       \ /
  [A+B]     [C+D]
    |         |
  (A==B)   (C==D)
     \       / 
      \     /
     [A,B+C,D]
         |
    (A==B==C==D)
         |
     [Terminal]     
Rete - (A==B) and (C==D) and (A==B==C==D)
 
  A   B     C       D
   \ /      |      /
  [A+B]     |     /
    |       |    / 
  (A==B)   /    |   
     \    /     |      
      \  /      |     
    [A+B+C]     |
          \     |  
           \    | 
          [A,B,C,D]
              |
            (C==D)
              |
          (A==B==C==D)
              |
          [Terminal]