In your implementation you will get at most one result.
I suggest that you return instead a java.util.Vector object instead.
Create the Vector object as part of your initialization and store it in RESULT.
Example: (defglobal ?*v* = (new Vector)) (store RESULT ?*v*)
In the RHS of your rule write (call ?*v* addElement ?x)

Ashraf





"Matteo Melideo" <[EMAIL PROTECTED]> on 05/17/2000 11:10:03 AM

Please respond to "Matteo Melideo" <[EMAIL PROTECTED]>

To:   "JESS" <[EMAIL PROTECTED]>
cc:   "JESS-Users" <[EMAIL PROTECTED]> (bcc: Ashraf Afifi/Bsg/MetLife/US)
Subject:  JESS: A Rule returns more than one result!!!



Hi All,

this is an extract of my Java program:

r.executeCommand("(defrule CheckDiscount-1 " +

                 " (prodotto ?x) " +

                 " (utenti (scelta ?x)) " +

                 " => " +

                 " (store RESULT ?x))");



r.run();

As the rule should match 5 facts at least, I expect that ?x contains this value,
but it seems that my expectations aren't correct because it doesn't work.

How can I retrieve these results? I have tried to use the guideline offered by
the manual in the example used for the Defqueries but it seems not to be the
right way.



--
Matteo Melideo
Direct Phone: +39 06 44741145 - Operator: +39 06 4474111
Engineering SpA - R&D Lab -, Fax: +39 06 4465981
Viale del Castro Pretorio, 116 E-mail: [EMAIL PROTECTED] or [EMAIL PROTECTED]
00184 Roma - Italy
--

Hi All,

this is an extract of my Java program:

r.executeCommand("(defrule CheckDiscount-1 " +

                 " (prodotto ?x) " +

                 " (utenti (scelta ?x)) " +

                 " => " +

                 " (store RESULT ?x))");

r.run();

As the rule should match 5 facts at least, I expect that ?x contains this value, but it seems that my expectations aren't correct because it doesn't work.

How can I retrieve these results? I have tried to use the guideline offered by the manual in the example used for the Defqueries but it seems not to be the right way.   

 

--
Matteo Melideo  
Direct Phone: +39 06 44741145 - Operator: +39 06 4474111
Engineering SpA - R&D Lab -, Fax: +39 06 4465981
Viale del Castro Pretorio, 116 E-mail: [EMAIL PROTECTED] or [EMAIL PROTECTED]
00184 Roma - Italy
--

Reply via email to