clipsexpert-systemrete

Rete network without beta network?


I'm trying to draw a Rete network for a sample rule which has no binding between variables in different patterns. I know that beta network is used to make sure that the bended variable in different patterns are consistent.

(defrule R1
  (type1 c1 c2)
  (type2 c3)
 =>
)

(defrule R2
  (type2 c3)
  (type3 c4 v1)
  (type4 c5 v1)
 =>
) 

In R1, there is no binded variables between the two patterns, how should I combine their result in the Rete network then? In R2, two rules have binded variable while the third has not. How to combine the three rules in the network? I searched for Rete network example for such a situation but didn't find any. I tried to draw the network and below is my network. Is it right?

UPDATE: New network based on Gary's answer

enter image description here Thanks


Solution

  • Beta nodes store partial matches regardless of whether there are variables specified in the patterns that need to be checked for consistency. The variables bindings just serve to filter the partial matches that are stored in the beta memory. If there are no variables, then all generated partial matches will be stored in the beta memories.

    Your diagram should look like this:

    a1    a2   a3   a4
      \  /  \  /    /
       b1    b2    /
       |       \  /
       r1       b3
                |
                r2