Calling "modify" to replace the contents of a slot with the same
object won't actually do anything; the rules won't be reevaluated
because as far as Jess is concerned, the contents of the slot did not
change. You'll have to make the ?security object into a first-class
object, and modify its properties using modify; then Jess will know
about the change and the rules will be re-evaluated as appropriate.
On Jan 23, 2009, at 5:49 AM, [email protected] wrote:
Hello,
I have condition on LHS rule like below:
(deffunction checkProdEmpty (?security)
(if (and (neq (get ?security prod) nil)(neq (get ?security prod)
"")(neq (get ?security prod) "0")) then
(return FALSE)
else
(return TRUE))
)
(defrule RuleFromFacts
(declare (salience ?*CONTENT_SPECIFIC_RULE*) (no-loop TRUE))
?trade <- (TR (instrmt ?security &:(eq (checkProdEmpty ?
security) TRUE)))
(or (SecurityDetails (isin ?isin &:(eq (get ?security ID) ?
isin)) (cusip ?cusip) (bbid ?bbid)(prodType ?prodTyp))
(SecurityDetails (isin ?isin) (cusip ?cusip &:(eq (get ?
security ID) ?cusip)) (bbid ?bbid)(prodType ?prodTyp))
(SecurityDetails (isin ?isin) (cusip ?cusip) (bbid ?bbid &:
(eq (get ?security ID) ?bbid))(prodType ?prodTyp)))
=>
(set ?security prod ?prodTyp)
(modify ?trade (instrmt ?security))
(log-info " Set Prod from Facts - SecurityID: " (get ?security
ID) " Prod: " ?prodTyp)
)
There is 1 SecurtiDetails fact present with cusip same as bbid and
hence the rule is activated twice.
But when the first time rule fires it sets the property prod to
something not null.
It should ideally not fire for second activation.
But it still fires.
Any idea ?
Thanks and regards,
Nikita
************************************************************
HSBC Software Development (India) Pvt Ltd
HSBC Center Riverside,West Avenue ,
25 B Kalyani Nagar Pune 411 006 INDIA
Telephone: +91 20 26683000
Fax: +91 20 26681030
************************************************************
*******************************************************************
This e-mail is confidential. It may also be legally privileged.
If you are not the addressee you may not copy, forward, disclose
or use any part of it. If you have received this message in error,
please delete it and all copies from your system and notify the
sender immediately by return e-mail.
Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability
for any errors or omissions..
*******************************************************************
"SAVE PAPER - THINK BEFORE YOU PRINT!"
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012 [email protected]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------