I think Jeremic Zoran wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > (deftemplate passed_concepts > (slot ID (type INTEGER))) > > (deftemplate concept > (slot ID (type INTEGER)) > (multislot prerequisite) > (slot ordinalNumber (type INTEGER)) > (slot minKnowledgeLevel (type INTEGER))) > > there could be up to 23 passed_concepts in memory, and every concept could have 1, 2 > or 3 prerequisites. I need to write rule that will find concept (fire rule) if all > prerequisites exists in working memory. > Thank you for help.
If I understand you correctly, the multislot in "concept" contains a list of ids of "passed_concepts" facts, and you want to identify the concepts which point only to existing passed_concepts facts. One way to do it would look like this: (defrule all-prerequisites ;; There's a concept... (concept (id ?id)) ;; ... and it's not true that for any prerequsite ?one of this ;; concept, there's no matching passed_concepts fact. (not (and (concept (id ?id) (prerequisite $?first ?one $?rest)) (not (passed_concepts (id ?one))))) => (printout t "All prerequisities for concept " ?id " are satisfied." 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] --------------------------------------------------------------------