This works:
(assert (fact1))
(assert (fact2))
(defrule exec-itm_command-string
(declare (salience 10000))
?f <- (TgeFact text TGE-Command: ?cmd)
=>
(printout t "cmd = " (str-cat ?cmd) crlf )
(call (engine) executeCommand (str-cat ?cmd))
(retract ?f)
)
(assert (TgeFact text TGE-Command: "(facts)") )
Here is the output:
==> f-0 (fact1) ==> f-1 (fact2) exec-itm_command-string: +1+1+1+1+1+t ==>
f-2 (TgeFact text TGE-Command: "(facts)") ==> Activation:
exec-itm_command-string : f-2 FIRE 1 exec-itm_command-string f-2 cmd =
(facts)
f-0 (fact1)
f-1 (fact2)
f-2 (TgeFact text TGE-Command: "(facts)")
For a total of 3 facts.
<== f-2 (TgeFact text TGE-Command: "(facts)") 1
Good luck!
alan
-----Original Message-----
From: Thomas Gentsch [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 3:28 PM
To: Jess
Subject: JESS: Debug rule
Hello,
I wanted to create a rule as some kind of an debugging-aid which allows
me to submit facts that are interpreted as regular commands.
I tried the following in different variations but can't get it to work
as expected:
(defrule exec-itm_command-string
(declare (salience 10000))
?f <- (TgeFact (text TGE-Command: ?cmd))
=>
(build ?cmd)
(retract ?f)
)
and asserted e.g.
(TgeFact (text TGE-Command: "(facts)"))
Nothing happens. Similraly I tried out (eval ) and multifields for ?cmd
(passed as (explode$ ?cmd) of course.
Is there any nice way how to accomplish that?
Thanks a lot,
tge
--
Thomas Gentsch
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
---------------------------------------------------------------------
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]
---------------------------------------------------------------------