E.1 OPS5

OPS5 rulebases may be readily converted into KnowledgeWorks rulebases. The main OPS5 forms needing conversion are:

literalize
into
def-kb-struct
or
def-kb-class
. For example

(literalize employee name father-name mother-name)

could become

(def-kb-struct employee name father-name mother-name)

strategy
into a defcontext form with the right conflict resolution strategy. For example

(strategy lex)

could become

(defcontext ops5 :strategy (lex specificity))

and

(strategy mea)

could become

(defcontext ops5 :strategy (mea lex specificity))

In OPS5 you cannot have different conflict resolution strategies for different sets of rules. The KnowledgeWorks context mechanism for passing control is much clearer and more powerful than, for instance, the use of the MEA strategy as sole control mechanism in OPS5.

p
into
defrule
. For example, the OPS5 rule

(p recognize-pair

(employee ^name <parent>)

(employee ^name <child> ^mother-name <parent>)

-->

(make pair))

will become

(defrule recognize-pair :forward

(employee ? name ?parent)

(employee ? name ?child mother-name ?parent)

-->

(assert (pair ?)))

As an extended example below are given some OPS5 rules from the Monkey and Banana problem (see Examples):