Package com.yahoo.prelude.semantics.rule
Class ProductionRule
java.lang.Object
com.yahoo.prelude.semantics.rule.ProductionRule
- Direct Known Subclasses:
AddingProductionRule
,ReplacingProductionRule
A query rewriting rule.
- Author:
- bratseth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
Returns the symbol of this production rule.boolean
isLoop()
Returns true if it is known that this rule matches its own output.void
makeReferences
(RuleBase rules) boolean
Returns whether this rule matches the given queryReturns the set of context names the production of this rule referencesvoid
Carries out the production of this rulevoid
setCondition
(Condition condition) Sets what must be true for this rule to be truevoid
setProduction
(ProductionList production) Sets what is produced when this rule is truetoString()
Returns the canonical string representation of this rule.
-
Constructor Details
-
ProductionRule
public ProductionRule()
-
-
Method Details
-
setCondition
Sets what must be true for this rule to be true -
getCondition
-
setProduction
Sets what is produced when this rule is true -
getProduction
-
matches
Returns whether this rule matches the given query -
matchReferences
Returns the set of context names the production of this rule references- Returns:
- an unmodifiable Set of condition context name Strings
-
makeReferences
-
produce
Carries out the production of this rule -
toString
Returns the canonical string representation of this rule. This string representation can always be reparsed to produce an identical rule to this one. -
getSymbol
Returns the symbol of this production rule. All rules are on the formcondition symbol production
. -
isLoop
public boolean isLoop()Returns true if it is known that this rule matches its own output. If it does, it will only be evaluated once, to avoid infinite loops. This default implementation returns false;
-