Hi Matthew,
I'm not sure what the problem is that you're having -- you're
outlining a perfectly reasonable approach. Can you be more specific
about what you've tried and what doesn't work?
You say you "can not see how I can check every instance of an error
deftemplate." Maybe you mean that you want the code below to run for
every (error) fact? If you simply write a rule like
(defrule rule-1
(error (type ?t) (keywords $?error-list))
(search $?search)
=>
(foreach ?element $?search ... ))
it will fire once for each (error) fact, which is what you want, I
think. If you retract the (search) fact as soon as you find a match,
then subsequent firings will be cancelled.
Actually, finding the common elements of $?search and $?error-list
could be done entirely on the LHS too, as pattern matching, but in
some cases it will be more efficient to do it as you've shown.
I think Matthew Vivian wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi,
> I am developing an expert system that helps a user recover from errors that
> may occur during software installation. I have a list keywords related to a
> particular type of error contained in a deftemplate:
>
> (error (type hard-disk) (keywords disk space hard IDE))
> (error (type font) (keywords font Tahoma Helvetica true type))
> (error (type network) (keywords connection tcp/ip host server))
>
> an error message is input by the user and exploded:
>
> (search out of disk space)
>
> I am trying to use the error message input by the user to establish what
> type of error has occurred. So if any of the words in the search fact are
> present in the keyword list of an error fact then assert the type of the
> error. I have experimented with the following but am hitting problems:
>
>
> (foreach ?element $?search
> (if (member ?element $?error-list) then
> (assert ?type))
>
> I first thought that I could match the error deftemplate on the LHS of a
> rule and then run the code listed above on the RHS. However, I can not see
> how I can check every instance of an error deftemplate. Does anyone have any
> suggestions or hints?
>
>
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (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]
---------------------------------------------------------------------