Remember that pattern-matching is driven by fact assertions, retractions, and modifications. Matches involving global variables will be evaluated when working memory changes cause the patterns to be matched. Changing a global variable will *not* cause the matching to be reevaluated. So, for example, if you have the following facts:

(deffacts facts
   (f 1)
   (f 2)
   (f 3))

and this variable

(set-reset-globals FALSE)
(defglobal ?*g* = 0)

and this rule

(defrule my-rule
    (f ?*g*)
     =>
    (printout t "Found a match" crlf))

and you say

(reset)
(run)

Then this rule won't fire, of course. But if you then say

(bind ?*g* 1)
(run)

it *still* won't fire, and I suspect that's what's happening to you here. Changing the global variable doesn't reevaluate the matches; they were done when the rule was first defined.

BUT... if you say

(reset)
(run)

the rule *will* fire, since reset will remove and replace the facts, and this time the matches will be evaluated with the new value of ?*g* .


On Nov 27, 2007, at 4:09 PM, A.I. Mannette-Wright wrote:

Hi!

I am a relatively new Jess user so please forgive me
if this question is trivial.

I am running Protege 3.2.1 using JessTab under which I
am running Jess V7.0p1.  I have an ontology built in
Protege which I map to Jess facts using the mapclass
function in JessTab.  I wrote a rule which uses a
global variable. However the value of the global
variable seems to unknown to the rule. Am I correct
that Jess rules are unaware of the values of variables
that are known to the rest of the Jess environment?
NOte: when I use the printout function I get a valaue
for the variable.  Any help would be appreciated.
Thanks..........Anne



______________________________________________________________________ ______________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http:// overview.mail.yahoo.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 owner-jess- [EMAIL PROTECTED]
--------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
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]
--------------------------------------------------------------------

Reply via email to