I think what you're trying to do is this:

 (defrule rule
  "Rule"
  (constant ?X&:(eq ?X ?*constant1*))
 =>
 (printout t "Constant Value -> " ?X crlf)
 )


This rule fires, for example, if a fact (constant "foo") is asserted,
and the defglobal ?*constant1* contains the String "foo"; it prints

Constant Value -> foo

I think Bijal Modi wrote:
> 
> Hello,
> 
>   I am trying to use some constants declared in a Java class in my Jess
> rules. I achieve this by defining a global variable:
> 
> (defglobal ?*constant1* = (get-member Constants CONSTANT1))
> 
>   How can I use this constant in a rule? I want to do something like:
> 
> (defrule rule
>  "Rule"
>  (constant ?*constant1*)
> =>
> (printout t "Constant Value -> " ?*constant1* crlf)
> )
> 
>  However, for obvious reasons, if I assert a fact (constant X), the
> printout
> is "Constant Value -> X" etc. How else can I define a constant which I
> can
> then use in LHS?
> 
> thanks,
> 
> -Bijal Modi
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
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