| java.lang.Object com.hp.hpl.jena.reasoner.rulesys.impl.LPInterpreter
LPInterpreter | public class LPInterpreter (Code) | | Bytecode interpeter engine for the LP version of the backward
chaining rule system. An instance of this is forked off for each
parallel query.
author: Dave Reynolds version: $Revision: 1.15 $ on $Date: 2008/01/02 12:06:17 $ |
Method Summary | |
public void | bind(Node var, Node val) Bind a value to a variable, recording the binding in the trail. | public void | close() Stop the current work. | public static Node | deref(Node node) Derefernce a node, following any binding trail. | public static Triple | deref(TriplePattern t) Return a dereferenced copy of a triple. | public static Node | derefPossFunctor(Node node) | public FrameObject | getChoiceFrame() Return the current choice point frame that can be used to restart the
interpter at this point. | public LPInterpreterContext | getContext() Return the context in which this interpreter is running, that is
either the Generator for a tabled goal or a top level iterator. | public LPBRuleEngine | getEngine() Return the engine which owns this interpreter. | public static boolean | isGrounded(Node node) | public Object | next() Return the next result from this engine, no further initialization. | public void | preserveState(ConsumerChoicePointFrame ccp) Preserve the current interpter state in the consumer choice point at the top
of the choice point tree. | public void | restoreState(ConsumerChoicePointFrame ccp) Restore the interpter state according to the given consumer choice point. | protected StateFlag | run() Restore the current choice point and restart execution of the LP code
until either find a successful branch (in which case exit with StateFlag.ACTIVE
and variables bound to the correct results) or exhaust all choice points (in
which case exit with StateFlag.FAIL and no bound results). | public void | setState(LPInterpreterState state) Start the interpreter running with the given context. | public void | setTopInterpreter(LPInterpreterContext context) Called by top level interpeter to set to execution context for this interpeter to be
top level instead of an internal generator. | public boolean | unify(Node n1, Node n2) Unify two nodes. | public void | unwindTrail(int mark) |
argVars | protected Node[] argVars(Code) | | The set of argument variables (Ai) in use by this interpreter
|
context | protected RuleContext context(Code) | | The execution context description to be passed to builtins
|
isComplete | protected boolean isComplete(Code) | | True if the engine has terminated
|
pVars | protected Node[] pVars(Code) | | The set of "permanent" variables (Yi) in use by this interpreter
|
tVars | protected Node[] tVars(Code) | | The set of temporary variables (Ti) in use by this interpreter
|
topTMFrame | protected TopLevelTripleMatchFrame topTMFrame(Code) | | Trick to allow the very top level triple lookup to return results with reduced store turnover
|
trail | protected ArrayList trail(Code) | | The trail of variable bindings that have to be unwound on backtrack
|
LPInterpreter | public LPInterpreter(LPBRuleEngine engine, TriplePattern goal)(Code) | | Constructor used to construct top level calls.
Parameters: engine - the engine which is calling this interpreter Parameters: goal - the query to be satisfied |
LPInterpreter | public LPInterpreter(LPBRuleEngine engine, TriplePattern goal, boolean isTop)(Code) | | Constructor.
Parameters: engine - the engine which is calling this interpreter Parameters: goal - the query to be satisfied Parameters: isTop - true if this is a top level call from the outside iterator, false means it is aninternal generator call which means we don't need to insert an tabled call |
LPInterpreter | public LPInterpreter(LPBRuleEngine engine, TriplePattern goal, List clauses, boolean isTop)(Code) | | Constructor.
Parameters: engine - the engine which is calling this interpreter Parameters: goal - the query to be satisfied Parameters: clauses - the set of code blocks needed to implement this goal Parameters: isTop - true if this is a top level call from the outside iterator, false means it is aninternal generator call which means we don't need to insert an tabled call |
bind | public void bind(Node var, Node val)(Code) | | Bind a value to a variable, recording the binding in the trail.
Parameters: var - the dereferenced variable to be bound Parameters: val - the value to bind to it |
close | public void close()(Code) | | Stop the current work. This is called if the top level results iterator has
either finished or the calling application has had enough.
|
deref | public static Node deref(Node node)(Code) | | Derefernce a node, following any binding trail.
|
derefPossFunctor | public static Node derefPossFunctor(Node node)(Code) | | Derefernce a node which may be a functor node
|
getChoiceFrame | public FrameObject getChoiceFrame()(Code) | | Return the current choice point frame that can be used to restart the
interpter at this point.
|
getContext | public LPInterpreterContext getContext()(Code) | | Return the context in which this interpreter is running, that is
either the Generator for a tabled goal or a top level iterator.
|
isGrounded | public static boolean isGrounded(Node node)(Code) | | Check if a node values is now grounded
|
next | public Object next()(Code) | | Return the next result from this engine, no further initialization.
Should be called from within an appropriately synchronized block.
Parameters: context - the generator choice point or top level iterator which is requesting this result and might have preserved state to restore either a StateFlag or a result Triple |
preserveState | public void preserveState(ConsumerChoicePointFrame ccp)(Code) | | Preserve the current interpter state in the consumer choice point at the top
of the choice point tree.
|
run | protected StateFlag run()(Code) | | Restore the current choice point and restart execution of the LP code
until either find a successful branch (in which case exit with StateFlag.ACTIVE
and variables bound to the correct results) or exhaust all choice points (in
which case exit with StateFlag.FAIL and no bound results). In future tabled
version could also exit with StateFlag.SUSPEND in cases whether the intepreter
needs to suspend to await tabled results from a parallel proof tree.
|
setTopInterpreter | public void setTopInterpreter(LPInterpreterContext context)(Code) | | Called by top level interpeter to set to execution context for this interpeter to be
top level instead of an internal generator.
|
unify | public boolean unify(Node n1, Node n2)(Code) | | Unify two nodes. Current implementation does not support functors.
true if the unifcation succeeds |
unwindTrail | public void unwindTrail(int mark)(Code) | | Unwind the trail to given low water mark
|
|
|