Class ProductionRule

java.lang.Object
com.yahoo.prelude.semantics.rule.ProductionRule
Direct Known Subclasses:
AddingProductionRule, ReplacingProductionRule

public abstract class ProductionRule extends Object
A query rewriting rule.
Author:
bratseth
  • Constructor Details

    • ProductionRule

      public ProductionRule()
  • Method Details

    • setCondition

      public void setCondition(Condition condition)
      Sets what must be true for this rule to be true
    • getCondition

      public Condition getCondition()
    • setProduction

      public void setProduction(ProductionList production)
      Sets what is produced when this rule is true
    • getProduction

      public ProductionList getProduction()
    • matches

      public boolean matches(RuleEvaluation e)
      Returns whether this rule matches the given query
    • matchReferences

      public Set<String> matchReferences()
      Returns the set of context names the production of this rule references
      Returns:
      an unmodifiable Set of condition context name Strings
    • makeReferences

      public void makeReferences(RuleBase rules)
    • produce

      public void produce(RuleEvaluation e)
      Carries out the production of this rule
    • toString

      public String toString()
      Returns the canonical string representation of this rule. This string representation can always be reparsed to produce an identical rule to this one.
      Overrides:
      toString in class Object
    • getSymbol

      protected abstract String getSymbol()
      Returns the symbol of this production rule. All rules are on the form condition 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;