Thank you ever so much.

One more quick question. In my rule I have calculated the following:

(/ ?mv ?io)

Is there anyway to save this along with the Fact reference in ?b ??

Thanks 

Chirag

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: 02 August 2004 15:31
To: [EMAIL PROTECTED]
Subject: Re: JESS: Newbie questions

I think Mehta, Chirag (IT) wrote:
> 
> I cannot seem to figure out what is wrong!

The things on the left-hand-side of a rule are always conditional
elements (patterns or groups of patterns), not function calls. Jess is
trying to interpret "(bind ?noncomp (/ ?mv ?io))" as a pattern that
matches "bind" facts, and it's complaining because (/ ?mv ?io) isn't a
valid slot value constraint.

There's no way to bind a variable on the LHS of a rule and see it on the
RHS of a rule other than by directly matching it. You're going to have
to compute (/ ?mv ?io) twice, once in the "test" CE and once on the RHS
of the rule.

I think, by the way, that you've done something else wrong here. Each of
the three bondMVMax patterns above can match a difference bondMVMax
fact. Since each one matches a different slot, I'm guessing you actually
mean for all the patterns to apply to the *same* fact; you're not trying
to find sets of three facts, but single facts that pass all these
criteria. You need to write all the criteria as one pattern:

(defrule calcifnc
  (bondMVMax (cusip ?c) 
             (mv ?mv)
             (issue_outstanding ?io&~nil))
  (test (> (/ ?mv ?io) 10))
  =>
  (printout t ?c " is Non Complaint nc = " (/ ?mv ?io) crlf))


> 
> Also, I wish to save all the facts that meet the tests to a data
> structure and then return the data to my java program. What is the
best
> method to do this??

You can have the rule store a reference to the fact each time it
fires; for example , in your Java code

  Rete engine = ...
  ArrayList result = new ArrayList();
  engine.store("RESULT", result);

Then make the rule look like

(defrule calcifnc 
  ?b <- (bondMVMax (cusip ?c) 
                   (mv ?mv)
                   (issue_outstanding ?io&~nil))
  (test (> (/ ?mv ?io) 10))
  =>
  (printout t ?c " is Non Complaint nc = " (/ ?mv ?io) crlf)
  ((fetch RESULT) add ?b))

After running the engine, the ArrayList "result" will contain
references to all the jess.Fact objects that match the criteria.

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

--------------------------------------------------------------------
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]
-------------------------------------------------------------------- 
--------------------------------------------------------
 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive 
confidentiality or privilege, and use is prohibited. 
 

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