Re: JESS: or/exists/unique question
Maybe you could use a 3rd value... (not syntaxically correct as well, but the idea remains the same) (defrule ruleA (and (not(found ?f)) (or (value1 ?v1) (value2 ?v2)) == (printout t GOT IT crlf) (assert (found ?f))) Regards, Bruno Bob Stewart wrote: Hello, I have a situation where I want to match a rule only one time, but the rule has an or clause in it. Here is a simple (not 100% syntactically correct) example. (defrule ruleA (or (value1 ?v1) (value2 ?v2)) == (printout t GOT IT crlf)) if I were to assert two facts, (assert (value1 Yes)) (assert (value2 No)) And do a (run), I will get two matches. I looked at unique, but that can only be used with one value. I also tried exists, but I have had no success. I would like for GOT IT to be printed out only once. Thanks, Bob Stewart - 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: fact-slot-value
Hi, I've got a question concerning the right use of the (fact-slot-value) function. Here is what I enter in the engine : (deftemplate type-module (slot module) (slot sorte)) (assert (type-module (module FXINT) (sorte CP))) ... (defrule test ?corres -(type-module (module FXINT)) = (assert (module-is-found-and-sort-is (fact-slot-value ?corres sorte ... and at the runtime, Jess raises an exception saying : Jess reported an error in routine call while executing (call (engine) findFactByID ?__fact-id) while executing (bind ?__fact (call (engine) findFactByID ?__fact-id)) while executing deffunction fact-slot-value while executing (fact-slot-value ?corres sorte) while executing (assert (module-is-found-and-sort-is (fact-slot-value ?corres sorte))) while executing defrule test while executing (run). Message: No overloading of method 'findFactByID' in class jess.Rete I can call with these arguments: (call (engine) findFactByID ?__fact-id). When I run manually (fact-slot-value 1 sorte) that works fine. It looks like the fact-id I get in the LHS isn't the good type. So, how can I get the fact-id working in the function ? Thanks, B.SINTES - 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: [Modifying facts in deffunction]
I found a 'solution' to my problem (well, it's working so far, so I consider it is a solution !) (defrule foo ... ?ac - (action yes) = (retract ?ac) ) ... (deffunction menu-handler (?event) (assert (action yes)) (run) ) Because when the user doesn't do anything (and no rule has to be fired), the engine stops. So when there is an action commited, I assert the fact and run the engine. I don't know if it is clever, but it works. Bruno SINTES [EMAIL PROTECTED] wrote: Hi, There's no neat way to do what you're asking about (at least not in the current versions of Jess.) What you could do, though, is use Beans instead of facts. Keep a reference to the Bean available someplace, and have the item-listener change the properties of the Bean. If the Bean is definstanced, then it will be available for matching by rules just as the current facts are -- the rules would likely not need to be changed. I think sintes wrote: [Charset ISO-8859-1 unsupported, filtering to ASCII...] Hi all ! I'd like to know how to get a fact-id in a function. I create a GUI with awt objects, I add listeners to those objects and when something happens, I'd like to modify the fact involved in the control. Here is my sample (deffact act (action no)) ... (defrule foo ... ?ac - (action yes) = ...) ... (deffunction itemlistener (?event) ;;I dunno how to modify the fact action, as I dunno how to get the fact-id ?bar-(action no) ;;? (modify ?bar (action yes)) ;;? ) Thank you, Bruno SINTES - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (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] - - 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: Modifying facts in deffunction
Hi all ! I'd like to know how to get a fact-id in a function. I create a GUI with awt objects, I add listeners to those objects and when something happens, I'd like to modify the fact involved in the control. Here is my sample (deffact act (action no)) ... (defrule foo ... ?ac - (action yes) = ...) ... (deffunction itemlistener (?event) ;;I dunno how to modify the fact action, as I dunno how to get the fact-id ?bar-(action no) ;;? (modify ?bar (action yes)) ;;? ) Thank you, Bruno SINTES