[rules-users] Multivariable and multislots

Lars Braubach braubach at informatik.uni-hamburg.de
Wed Sep 12 03:18:44 EDT 2007


Hi,

I was wondering how I can express pattern matchings in drools
that operate on sets of values (multivalues). As an example I
composed a Jess/Clips rule that is able to match every block
that has a green as well as a red block on top of it.

(deftemplate Block
  (slot name(type STRING)) 
  (slot color(type STRING))
  (multislot on (type symbol))
)

(defrule multimatch
  ?b1 <- (Block (on $?a1 ?x $?c1) (color "red"))
  ?b2 <- (Block (on $?a2 ?x $?c2) (color "green"))
 =>(printout t "match multimatch:" ?x ?b1 ?b2))

This rules triggers for every value of the multislot "on" which
is contained in both multifields. I tried playing around with
"memberof" and "contains" in drools but found no possibility
to operate on two sets. Is it possible?

Kind regards,
Lars



More information about the rules-users mailing list