RE: JESS: calling a method on a matched shadow fact

2007-01-15 Thread Skeptic 2000
Hi,
In the LHS of a rule, could I bind to a variable a object that is returned from 
a method called on a matched fact ?
 
 
(rule x 
(theShadowfact ?o)
(... ?o getXYZ ... )
 
The purpose of doing this is to have a variable on which to do some tests 
without having to call getXYZ for each one of them.
 
Thanks



 From: [EMAIL PROTECTED] Subject: Re: JESS: calling a method on a matched 
 shadow fact Date: Fri, 3 Nov 2006 00:46:42 -0500 To: jess-users@sandia.gov 
  On Nov 2, 2006, at 1:29 PM, Skeptic 2000 wrote: Let's say I have 
 something like :   (defclass xyz x.y.com.XYZ)   (defrule x  
 ?x-(xyz)  =  (...)   In the RHS, I would like to call a method that 
 is not a bean get/   set on the matched 'xyz', what would be the proper 
 way? (If   possible, this method would take a string as argument)   ?x 
 is a jess.Fact object; it has a slot named OBJECT containing the  actual XYZ 
 object. So you could say  ((?x getSlotValue OBJECT) theMethodName the 
 argument)  Alternatively, you could bind the OBJECT slot on the LHS, and 
 then  you'd have a variable on which you could call the method directly.  
 - 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://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] 
  
_
Soyez parmi les premiers à essayer Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d

Re: JESS: calling a method on a matched shadow fact

2007-01-15 Thread Ernest Friedman-Hill

One way to do this would be to use progn in a test CE:

(defrule x
  (theShadowFact (OBJECT ?o))
  (test (progn
  (bind ?xyz (?o getXYZ))
  (and ( ?xyz 10)
   ( ?xyz 100
  = ...

progn executes all the function calls inside it, then returns the  
value of the last one.



On Jan 15, 2007, at 4:00 PM, Skeptic 2000 wrote:


Hi,

In the LHS of a rule, could I bind to a variable a object that is  
returned from a method called on a matched fact ?



(rule x
(theShadowfact ?o)
(... ?o getXYZ ... )

The purpose of doing this is to have a variable on which to do some  
tests without having to call getXYZ for each one of them.


Thanks


 From: [EMAIL PROTECTED]
 Subject: Re: JESS: calling a method on a matched shadow fact
 Date: Fri, 3 Nov 2006 00:46:42 -0500
 To: jess-users@sandia.gov

 On Nov 2, 2006, at 1:29 PM, Skeptic 2000 wrote:


 
  Let's say I have something like :
 
  (defclass xyz x.y.com.XYZ)
 
  (defrule x
  ?x-(xyz)
  =
  (...)
 
  In the RHS, I would like to call a method that is not a bean get/
  set on the matched 'xyz', what would be the proper way? (If
  possible, this method would take a string as argument)
 

 ?x is a jess.Fact object; it has a slot named OBJECT containing the
 actual XYZ object. So you could say

 ((?x getSlotValue OBJECT) theMethodName the argument)

 Alternatively, you could bind the OBJECT slot on the LHS, and then
 you'd have a variable on which you could call the method directly.

 -
 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://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 owner-jess- 
[EMAIL PROTECTED]

 



Soyez parmi les premiers à essayer Windows Live Mail.


-
Ernest Friedman-Hill
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (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]




JESS: calling a method on a matched shadow fact

2006-11-02 Thread Skeptic 2000


Hi,

Let's say I have something like :

(defclass xyz x.y.com.XYZ)

(defrule x
 ?x-(xyz)
=
(...)

In the RHS, I would like to call a method that is not a bean get/set on the 
matched 'xyz', what would be the proper way? (If possible, this method would 
take a string as argument)


Thanks,

JFL


From: Ernest Friedman-Hill [EMAIL PROTECTED]
Reply-To: jess-users@sandia.gov
To: jess-users@sandia.gov
Subject: Re: JESS: Symplified syntax jess 7
Date: Thu, 2 Nov 2006 13:03:08 -0500

Only simple expressions as described in the manual are handled in  this 
release. Parenthesized expressions are not implemented -- yet.


On Nov 2, 2006, at 5:36 AM, Negoita, Cristian wrote:


The simplified rule should look like below:


(defrule Rule-KDF-BDF-Promo-1

(Input

   {bestandFirma  5  ((promotionalCode  == 
'M' || promotionalCode == 'X')  kontoFirma == 5)}


)

=...

But his expression cannot be parsed by Jess.


-
Ernest Friedman-Hill
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (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]




_
Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca



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]




Re: JESS: calling a method on a matched shadow fact

2006-11-02 Thread Ernest Friedman-Hill

On Nov 2, 2006, at 1:29 PM, Skeptic 2000 wrote:




Let's say I have something like :

(defclass xyz x.y.com.XYZ)

(defrule x
 ?x-(xyz)
=
(...)

In the RHS, I would like to call a method that is not a bean get/ 
set on the matched 'xyz', what would be the proper way? (If  
possible, this method would take a string as argument)




?x is a jess.Fact object; it has a slot named OBJECT containing the  
actual XYZ object. So you could say


((?x getSlotValue OBJECT) theMethodName the argument)

Alternatively, you could bind the OBJECT slot on the LHS, and then  
you'd have a variable on which you could call the method directly.


-
Ernest Friedman-Hill
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (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]