Drools is an open-source rule engine,which supports the jsr94 specification and performs the matching algorithm of the Rete pattern with the object-oriented(OO) method. Experimental results have shown that Rete algorithm is a highly effective matching-pattern,but its high efficiency is at the cost of a mass of memory. That is to say, Rete algorithm remembers all intermediate results by recording all tuples of all predicate that are buffered in the memory,and the associating tuples are updated and propageted when a fact object is asserted into working memory or is retracted/deleted from working memory, which has a negative effect on effectivity of drools.Aimming at the deficiency of the Rete algorithm, this paper uses the Leaps algorithm to improve the operation process of the objects. Leap algorithm does not materialize all the tuples, which is a main excellency, and this algorithm takes a compromised way.Engine does not cost many resources when matching the simple condition restriction, so engine need not materialize the tuples only when needed on the condition of including not or exist condition in a rule in order to memory intermediate results when they are updated and propagated, which is the Lazy condition evaluation strategy.In this way,it can enhance the efficiency of the algorithm and reduce the usage of memory theoretically.This paper compares the algorithm models between Rete and Leaps, then analyses insufficiency of Rete and introduces the compromised method of Leaps, finally, provides the design and implementation. At present, there are many products based on Rete algorithm, for example, CLIPS, Jess, Eclipse and OPS5, which are influenced deeply if Leaps algorithm is proved to be efficient. |