|
|
— |
clips:clip2pk5 [2010/01/04 19:46] (current) |
| |
| <HTML> |
| <HEAD> |
| <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> |
| <TITLE>DEFRULE</TITLE> |
| </HEAD> |
| |
| <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> |
| |
| <OBJECT TYPE="application/x-oleobject" CLASSID="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e"> |
| <PARAM NAME="Keyword" VALUE="DEFRULE"> |
| </OBJECT> |
| |
| <H1><A NAME="defrule"></A>DEFRULE</H1> |
| |
| <P>One of the primary methods of representing knowledge in CLIPS is a rule. </P> |
| |
| <P>A rule is a collection of conditions and the actions to be taken if the </P> |
| |
| <P>conditions are met. The developer of an expert system defines the rules </P> |
| |
| <P>which describe how to solve a problem. Rules execute (or fire) based on </P> |
| |
| <P>the existence or non-existence of facts. CLIPS provides the mechanism </P> |
| |
| <P>(the inference engine) which attempts to match the rules to the current </P> |
| |
| <P>state of the system (as represented by the fact-list) and applies the </P> |
| |
| <P>actions. </P> |
| |
| <PRE><CODE>(defrule <rule-name> [<comment>] |
| [<declaration>] |
| <conditional-element>* |
| => |
| <action>*) |
| </CODE></PRE> |
| |
| <P><B><U>DECLARATIONS</U></B></P> |
| |
| <PRE><CODE><declaration> ::= (declare <rule-property>+) |
| |
| <rule-property> ::= (salience <integer-expression>) | |
| (auto-focus <boolean-symbol>) |
| </CODE></PRE> |
| |
| <P><B><U>CONDITIONAL ELEMENTS</U></B></P> |
| |
| <PRE><CODE><conditional-element> ::= <pattern-CE> | <assigned-pattern-CE> | |
| <not-CE> | <and-CE> | <or-CE> | |
| <logical-CE> | <test-CE> | |
| <exists-CE> | <forall-CE> |
| |
| <test-CE> ::= (test <function-call>) |
| |
| <not-CE> ::= (not <conditional-element>) |
| |
| <and-CE> ::= (and <conditional-element>+) |
| |
| <or-CE> ::= (or <conditional-element>+) |
| |
| <exists-CE> ::= (exists <conditional-element>+) |
| |
| <forall-CE> ::= (forall <conditional-element> |
| <conditional-element>+) |
| |
| <logical-CE> ::= (logical <conditional-element>+) |
| </CODE></PRE> |
| |
| <P><B><U>PATTERN CONDITIONAL ELEMENT</U></B></P> |
| |
| <PRE><CODE><assigned-pattern-CE>::= ?<variable-symbol> <- <pattern-CE> |
| |
| <pattern-CE> ::= <ordered-pattern-CE> | |
| <template-pattern-CE> | |
| <object-pattern-CE> |
| |
| <ordered-pattern-CE> ::= (<symbol> <constraint>*) |
| |
| <template-pattern-CE>::= (<deftemplate-name <LHS-slot>*) |
| |
| <object-pattern-CE> ::= (object <attribute-constraint>*) |
| |
| <attribute-constraint> ::= (is-a <constraint>) | |
| (name <constraint>) | |
| (<slot-name> <constraint>*) |
| |
| <LHS-slot> ::= <single-field-LHS-slot> | |
| <multifield-LHS-slot> |
| |
| <LHS-slot> ::= <single-field-LHS-slot> | |
| <multifield-LHS-slot> |
| |
| <single-field-LHS-slot> ::= (<slot-name> <constraint>) |
| |
| <multifield-LHS-slot> ::= (<slot-name> <constraint>*) |
| </CODE></PRE> |
| |
| <P><B><U>PATTERN CONSTRAINTS</U></B></P> |
| |
| <PRE><CODE><constraint> ::= ? | $? | <connected-constraint> |
| |
| <connected-constraint> |
| ::= <single-constraint> | |
| <single-constraint> & <connected-constraint> | |
| <single-constraint> | <connected-constraint> |
| |
| <single-constraint> ::= <term> | ~<term> |
| |
| <term> ::= <constant> | |
| <single-field-variable> | |
| <multifield-variable> | |
| :<function-call> | |
| =<function-call></CODE></PRE> |
| |
| </BODY> |
| </HTML> |
| |