hello I intend to tell my problem clearly.
My question is how to pass value of ?i and ?slot in rule (matching-similar-case) to ?i and ?slot in rule(idea-combination). The purpose is to retrieve the value of concept slot in rule(idea-combination) by matching content of issue slot and solution slot in different cases. lai ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ((deftemplate idea (slot issue) (slot concept) (slot solution) (slot description)) (defmodule casebase) (defrule matching-similar-case (declare (salience 290)) (answer (ident q2)(text ?i)) (answer (ident q3)(text ?c)) ?fact <- (idea (issue ?i)(concept ?c)) => (printout t "Design ideas are " ?fact crlf) (bind ?slot (fact-slot-value ?fact solution)) (printout t ?slot crlf) (retract ?fact) (save-facts idea2 MAIN::idea)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Module matching (defmodule matching) (defrule idea-combination (answer (ident q2)(text ?i)) ?fact <- (idea (issue ?i)(concept ?slot)) => (printout t "Combined idea is " ?fact crlf) (bind ?slot (fact-slot-value ?fact concept)) (printout t ?slot crlf)) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Tuesday, March 16, 2004 2:28 AM To: [EMAIL PROTECTED] Subject: Re: JESS: Snding the same value between different rules I think lai wrote: > Hello > > How can I have the same value of ?i and ?slot between rule (matching-similar-case) > and rule(idea-combination)? (see the following two rules) > Could anyone help me? I'm afraid I don't understand your question; perhaps you could explain what you want to happen. Note that fact-slot-value is for the (fairly unusual) case where you have a reference to a fact object which didn't come from matching a fact on the LHS of a rule. Otherwise, it's much nicer to simply bind the value of the slot of interest to a variable on the LHS. What I'm finding hard to follow is why, in the following rule, you're using fact-slot-value to get the contents of a slot whose value you've already matched, and setting the variable that already contains that value to contain it once again. The following rule (which simply omits the call to fact-slot-value entirely) is precisely equivalent to your "idea-combination:" (defrule idea-combination (answer (ident q2)(text ?i)) ?fact <- (idea (issue ?i) (concept ?slot)) => (printout t "Combined idea is " ?fact crlf) (printout t ?slot crlf)) > (defrule idea-combination > (answer (ident q2)(text ?i)) > ?fact <- (idea (issue ?i)(concept ?slot)) > => > (printout t "Combined idea is " ?fact crlf) > (bind ?slot (fact-slot-value ?fact concept)) > (printout t ?slot crlf)) --------------------------------------------------------- Ernest Friedman-Hill Science and Engineering PSEs 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] -------------------------------------------------------------------- -------------------------------------------------------------------- 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] --------------------------------------------------------------------
