JESS: Or problem

2005-11-11 Thread mauricio rincon
Hi...I have a problem with OR (v) operator. I´m using this operator in a rule, that should be fired only once when both of the conditions happened . The problem is that if both events are happening, the rule fires twice. example;
(defrule names (or (name mao) (name july)) = (printout "hello world"))

I´m getting: hello world hello world

Would you please help me with this issue ?
regards , Mauricio Rincon.
		Correo Yahoo!Comprueba qué es nuevo, aquíhttp://correo.yahoo.es

Re: JESS: Or problem

2005-11-11 Thread ejfried
I think mauricio rincon wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi...
 I have a problem with OR (v) operator. I_m using this operator in a rule, 
 that should be fired only once when both of the conditions happened . The 
 problem is that if both events are happening, the rule fires twice. example;
 
 (defrule names (or (name mao) (name july)) = (printout hello world))
  
 I_m getting: hello world
  hello world
  

In this particular case the solution is simple: use the 'or'
connective constraint, not the 'or' conditional element:

(defrule names (name mao|july) = (printout hello world))

In the general case, when the 'or' conditional element is really
needed, the solution is to make sure that when the rule fires, it has
some detectable effect, and then match the negation of that effect on the
left-hand-side of the rule; trivially

(defrule names
  (or (name mao) (name july))
  (not (names fired))   
  =
  (assert (names fired))
  (printout hello world))


-
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://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]




JESS: Defquery problem

2004-05-04 Thread Michael Knapik




The following code is a defquery that is not doing anything; I expected a 
printout of a condition code of 1091 - the one that is part of the 
defclass (and thence a definstance executed from within a 
Java program)) declared as: 
(defclass event com.phs3.data.ojb.EventImpl )
I know event has the conditionCodeId 1091 in that slot as I have printed it 
out in the RHS of other rules. And an AbstractList$Itr is returned after the 
query call as in the JIA example. 
Thoughts?


(defquery find-conditions
;; pattern matches all the events whose conditionCodeID slot holds a number; 
only one for now
(declare (variables ?wantedConditionCode))
(event (conditionCodeId ?ccId:( = ?wantedConditionCode

;; now invoke the query
(bind ?it (run-query find-conditions 1091))
(bind ?token (call ?it next))
(while (?it hasNext)
(bind ?token (call ?it next))
(bind ?fact (call ?token fact 1))
(bind ?conditionCodeId (fact-slot-value ?fact conditionCodeId))
(printout t "Defquery says " ?conditionCodeId 
crlf))


JESS: Classpath problem

2004-04-27 Thread dnoelke
Hello,

I have a problem like this:

I added a selfwritten class compiled to a directory, that is included in my windows 
classpath. But i think jess cant retrieve it. is there any other classpath to set?  
jess always gives the error message:
cant find method in class java.lang.string

What may be the problem?

greetings


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]