RE: JESS: [EXTERNAL] Dynamic rule matching in the LHS

2013-07-31 Thread Friedman-Hill, Ernest
re once for every bag for which this condition holds. -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Aurelien Mazurie Sent: Wednesday, July 31, 2013 1:13 AM To: jess-users Subject: Re: JESS: [EXTERNAL] Dynamic rule matching in the LHS Thank yo

Re: JESS: [EXTERNAL] Dynamic rule matching in the LHS

2013-07-31 Thread Wolfgang Laun
On 30/07/2013, Aurelien Mazurie wrote: > Thank you very much for this answer. It seems like 'forall' will fire the > rule only if all the 'bag-of-items' facts are validated (i.e., if all of > them have 'item' facts with the names listed in their 'names' slot). Is that > correct? Yes. > > If yes,

Re: JESS: [EXTERNAL] Dynamic rule matching in the LHS

2013-07-31 Thread Aurelien Mazurie
Thank you for this tip. It is not what I am trying to achieve, however. I must apologize if my original email was misunderstood. My goal is to write a rule that would fire for any 'bag-of-items' fact whose item names, as listed in a multislot, are all represented by 'item' facts. The rule shoul

Re: JESS: [EXTERNAL] Dynamic rule matching in the LHS

2013-07-30 Thread Aurelien Mazurie
Thank you very much for this answer. It seems like 'forall' will fire the rule only if all the 'bag-of-items' facts are validated (i.e., if all of them have 'item' facts with the names listed in their 'names' slot). Is that correct? If yes, then what I am trying to do is slightly different. I do

Re: JESS: [EXTERNAL] Dynamic rule matching in the LHS

2013-07-30 Thread Jason Morris
Another "old skool" way of doing it using predicate constraints is... (clear) (deftemplate item (slot name)) (deftemplate bag-of-items (multislot item-names)) (defrule fire-for-all-members-in-bag ; If you have a bag of item names ... (bag-of-items (item-names $?item-names)) ; and there is a

RE: JESS: [EXTERNAL] Dynamic rule matching in the LHS

2013-07-30 Thread Friedman-Hill, Ernest
Not sure what "dynamic" means in this context. But you can use the "forall" conditional element to implement this rule. You could read the LHS here as "For all values of ?name in bag-of-items, there's a corresponding item fact." (defrule check-bag-valid (forall (bag-of-items (names $