Hello,
In the rather simple program below, I get as output
Jess Version 7.0p1 12/21/2006
----------------- defrules
----------------- assert
Assert user-right
----------------- retracts
retracting
----------------- re-defrule
Retract user right
----------------- cleanup
retracting (MAIN::client3 (id "123") (userInitials "fnf"))
While I would expect
Jess Version 7.0p1 12/21/2006
----------------- defrules
----------------- assert
Assert user-right
----------------- retracts
retracting
Retract user right
----------------- re-defrule
----------------- cleanup
retracting (MAIN::client3 (id "123") (userInitials "fnf"))
The "remove" rule doesn't fire, unless I reenter the exact same rule.
Any ideas?
Regards,
Florian Fischer
---------------------------------------------------------------------------
(deftemplate def-right
(slot user)
(slot accessRight)
)
(deftemplate user-right
(slot clientId)
(slot userInitials)
(slot accessRight)
)
(deftemplate client3
(slot id)
(slot userInitials)
)
;---------------------------
(printout t (jess-version-string) crlf)
(printout t "----------------- defrules" crlf)
(defrule debug-add-right
(client3 (id ?clientId) (userInitials ?init&~nil))
(def-right (user ?init) (accessRight ?right) )
(not (user-right (clientId ?clientId) (userInitials ?init)
(accessRight ?right)) )
=>
(printout t "Assert user-right" crlf);
(assert (user-right (clientId ?clientId) (userInitials ?init)
(accessRight ?right)) )
)
(defrule debug-remove-right
(global (serverMode ?mode))
?f <- (user-right (clientId ?clientId) (userInitials ?init)
(accessRight ?right) )
(not (and
(client3 (id ?clientId) (userInitials ?init&~nil))
(def-right (user ?init) (accessRight ?right) )
) )
=>
(printout t "Retract user right" crlf);
(retract ?f)
)
(run)
(printout t "----------------- assert" crlf)
(assert
(client3 (id "123") (userInitials "fnf"))
(def-right (user "fnf") (accessRight "EDIT"))
)
(run)
(printout t "----------------- retracts" crlf)
(defrule tmp
?f <- (def-right (user "fnf"))
=>
(printout t "retracting" crlf)
(retract ?f)
)
(run)
(undefrule tmp)
(printout t "----------------- re-defrule" crlf)
(defrule debug-remove-right
(global (serverMode ?mode))
?f <- (user-right (clientId ?clientId) (userInitials ?init)
(accessRight ?right) )
(not (and
(client3 (id ?clientId) (userInitials ?init&~nil))
(def-right (user ?init) (accessRight ?right) )
) )
=>
(printout t "Retract user right" crlf);
(retract ?f)
)
(run)
(printout t "----------------- cleanup" crlf)
(defrule tmp
?f <- (user-right)
=>
(printout t "retracting " (?f toString) crlf)
(retract ?f)
)
(run)
(defrule tmp
?f <- (def-right)
=>
(printout t "retracting " (?f toString) crlf)
(retract ?f)
)
(run)
(defrule tmp
?f <- (client3)
=>
(printout t "retracting " (?f toString) crlf)
(retract ?f)
)
(run)
(undefrule tmp)
(undefrule debug-add-right)
(undefrule debug-remove-right)
--------------------------------------------------------------------
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]
--------------------------------------------------------------------