public class RETERuleContext extends Object implements RuleContext
| Constructor and Description |
|---|
RETERuleContext(ForwardRuleInfGraphI graph,
RETEEngine engine)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Triple t)
Assert a new triple in the deduction graph, triggering any consequent processing as appropriate.
|
boolean |
contains(Node s,
Node p,
Node o)
Return true if the triple pattern is already in either the graph or the stack.
|
boolean |
contains(Triple t)
Return true if the triple is already in either the graph or the stack.
|
ClosableIterator<Triple> |
find(Node s,
Node p,
Node o)
In some formulations the context includes deductions that are not yet
visible to the underlying graph but need to be checked for.
|
RETEEngine |
getEngine()
Returns the RETE engine associated with this context.
|
BindingEnvironment |
getEnv()
Returns the current variable binding environment for the current rule.
|
InfGraph |
getGraph()
Returns the graph.
|
Rule |
getRule()
Returns the rule.
|
void |
remove(Triple t)
Remove a triple from the deduction graph (and the original graph if relevant).
|
void |
setEnv(BindingEnvironment env)
Sets the current binding environment for this context.
|
void |
setRule(Rule rule)
Sets the rule.
|
boolean |
shouldFire(boolean allowUnsafe)
Check whether the rule should fire in this context.
|
boolean |
shouldStillFire()
Check if a rule from the conflict set is still OK to fire.
|
void |
silentAdd(Triple t)
Assert a new triple in the deduction graph, bypassing any processing machinery.
|
public RETERuleContext(ForwardRuleInfGraphI graph, RETEEngine engine)
graph - the inference graph which owns this context.public BindingEnvironment getEnv()
getEnv in interface RuleContextpublic InfGraph getGraph()
getGraph in interface RuleContextpublic RETEEngine getEngine()
public Rule getRule()
getRule in interface RuleContextpublic void setRule(Rule rule)
setRule in interface RuleContextrule - The rule to setpublic void setEnv(BindingEnvironment env)
env - the binding environment so farpublic boolean contains(Triple t)
contains in interface RuleContextpublic boolean contains(Node s, Node p, Node o)
contains in interface RuleContextpublic ClosableIterator<Triple> find(Node s, Node p, Node o)
find in interface RuleContextpublic void silentAdd(Triple t)
silentAdd in interface RuleContextpublic void remove(Triple t)
remove in interface RuleContextpublic void add(Triple t)
add in interface RuleContextpublic boolean shouldFire(boolean allowUnsafe)
public boolean shouldStillFire()
Licenced under the Apache License, Version 2.0