Class RETERuleContext
java.lang.Object
org.apache.jena.reasoner.rulesys.impl.RETERuleContext
- All Implemented Interfaces:
RuleContext
An implementation of the generic RuleContext for use in the RETE implementation.
The RuleContext is used to supply context information to the builtin operations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Assert a new triple in the deduction graph, triggering any consequent processing as appropriate.boolean
Return true if the triple pattern is already in either the graph or the stack.boolean
Return true if the triple is already in either the graph or the stack.In some formulations the context includes deductions that are not yet visible to the underlying graph but need to be checked for.Returns the RETE engine associated with this context.getEnv()
Returns the current variable binding environment for the current rule.getGraph()
Returns the graph.getRule()
Returns the rule.void
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
Sets the rule.boolean
shouldFire
(boolean allowUnsafe) Check whether the rule should fire in this context.boolean
Check if a rule from the conflict set is still OK to fire.void
Assert a new triple in the deduction graph, bypassing any processing machinery.
-
Constructor Details
-
RETERuleContext
Constructor.- Parameters:
graph
- the inference graph which owns this context.
-
-
Method Details
-
getEnv
Returns the current variable binding environment for the current rule.- Specified by:
getEnv
in interfaceRuleContext
- Returns:
- BindingEnvironment
-
getGraph
Returns the graph.- Specified by:
getGraph
in interfaceRuleContext
- Returns:
- InfGraph
-
getEngine
Returns the RETE engine associated with this context. -
getRule
Returns the rule.- Specified by:
getRule
in interfaceRuleContext
- Returns:
- Rule
-
setRule
Sets the rule.- Specified by:
setRule
in interfaceRuleContext
- Parameters:
rule
- The rule to set
-
setEnv
Sets the current binding environment for this context.- Parameters:
env
- the binding environment so far
-
contains
Return true if the triple is already in either the graph or the stack. I.e. it has already been deduced.- Specified by:
contains
in interfaceRuleContext
-
contains
Return true if the triple pattern is already in either the graph or the stack. I.e. it has already been deduced.- Specified by:
contains
in interfaceRuleContext
-
find
In some formulations the context includes deductions that are not yet visible to the underlying graph but need to be checked for. However, currently this calls the graph find directly.- Specified by:
find
in interfaceRuleContext
-
silentAdd
Assert a new triple in the deduction graph, bypassing any processing machinery.- Specified by:
silentAdd
in interfaceRuleContext
-
remove
Remove a triple from the deduction graph (and the original graph if relevant).- Specified by:
remove
in interfaceRuleContext
-
add
Assert a new triple in the deduction graph, triggering any consequent processing as appropriate.- Specified by:
add
in interfaceRuleContext
-
shouldFire
public boolean shouldFire(boolean allowUnsafe) Check whether the rule should fire in this context. -
shouldStillFire
public boolean shouldStillFire()Check if a rule from the conflict set is still OK to fire. Just checks the non-monotonic guards such as noValue.
-