|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.rules.AbleInferenceEngine | +--com.ibm.able.rules.AblePatternMatchEngine
This class provides the inferencing algorithm for processing a set of pattern match rules in a ruleblock using data-driven or forward chaining. This engine implements the Rete' network algorithm which caches partial matches. It will produce identical results to the AblePatternMatchLiteEngine but with be more efficient when used for problems with large numbers of rules and/or working memory objects. When objects are added to working memory, only those test conditions which must be evaluated are processed.
The AblePatternMatchEngine processes AbleAssertionRules and AblePatternMatchRules and ignores all others.
The major processing method is infer() which is called by the AbleRuleSet bean as part of the normal bean process() method.
Instances of this class are not directly constructed by the user but are dynamically created by the AbleRuleBlock init() method.
AbleRuleSet
,
AbleRuleBlock
,
AblePatternMatchRule
,
AblePatternMatchLiteEngine
, Serialized FormField Summary | |
---|---|
protected java.util.Hashtable |
firedRuleBindingPairs
|
protected com.ibm.able.rules.AblePatternMatchNetwork |
myPatternMatchNet
|
Fields inherited from class com.ibm.able.rules.AbleInferenceEngine |
---|
myDebugLevel, myRuleBlock, myRuleSet, myRulesFiredCount, myTracer, myWorkingMemory |
Constructor Summary | |
---|---|
AblePatternMatchEngine(AbleRuleSet theRuleSet,
AbleLogger theTracer,
AbleRuleBlock theRuleBlock)
Create a new inference engine. |
Method Summary | |
---|---|
void |
addRuleToConflictSet(java.util.Vector theConflictSet,
AblePatternMatchRule theRule)
Inserts the Rule into the conflict set based on priority and specificity. |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
protected void |
evalPatternMatchRule(AblePatternMatchRule theRule)
Evaluate a pattern-match (when-do) rule. |
java.lang.Object |
getControlParameter(java.lang.String theControlParameter)
Returns the specified control parameter on the associated inference engine. |
void |
infer(AbleRuleBlock theRuleBlock)
Fire the rules in the ruleset using pattern match rules and forward chaining inferencing. |
boolean |
isRuleBlockValid(AbleRuleBlock theRuleBlock)
Make sure the current ruleblock is "executable" by this inference engine. |
protected void |
logConflictSet(java.util.Vector conflictSet)
Write the contents of the conflict set (triggered rules) to the Inference trace log |
protected void |
logWorkingMemory()
Write the contents of working memory out to the Inference trace log. |
void |
setControlParameter(java.lang.String theControlParameter,
java.lang.Object theValue)
Set the specified control parameter on the associated inference engine. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected com.ibm.able.rules.AblePatternMatchNetwork myPatternMatchNet
protected java.util.Hashtable firedRuleBindingPairs
Constructor Detail |
public AblePatternMatchEngine(AbleRuleSet theRuleSet, AbleLogger theTracer, AbleRuleBlock theRuleBlock)
theRuleSet
- A ruleset whose context is used for inferencing
by this inference engine.
theTracer
- A tracer object to which this inference engine can log
information. This may be null, in which case no
information is logged.
theRuleBlock
- A ruleblock whose rules are to be used for inferencing
by this inference engine.
Method Detail |
public boolean isRuleBlockValid(AbleRuleBlock theRuleBlock)
The ruleblock is invalid if any of the following are present in the ruleblock:
All reasons for validation failures are appended to the AbleRuleSet's myIsExReason variable. If validation fails, the inference engine must call myRuleSet.addIsExReason(java.lang.String) to append the reason.
isRuleBlockValid
in class AbleInferenceEngine
public void infer(AbleRuleBlock theRuleBlock) throws AbleDataException
The order of processing is as follows:
infer
in class AbleInferenceEngine
theRuleBlock
- The ruleblock to be processed.
AbleDataException
- When any error occurs.protected void evalPatternMatchRule(AblePatternMatchRule theRule) throws AbleDataException
Procesing is as follows:
evalPatternMatchRule
in class AbleInferenceEngine
AbleDataException
- when the data types are incompatible, or when the
relational operator is invalid for the current
situation or unrecognized.protected void logWorkingMemory()
protected void logConflictSet(java.util.Vector conflictSet)
public void addRuleToConflictSet(java.util.Vector theConflictSet, AblePatternMatchRule theRule) throws AbleDataException
conflictSet
- the Vector to which the rule is addedtheRule
- the Rule that needs to be addedpublic void setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue) throws AbleDataException
setControlParameter
in class AbleInferenceEngine
public java.lang.Object getControlParameter(java.lang.String theControlParameter) throws AbleDataException
getControlParameter
in class AbleInferenceEngine
public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |