Class LPInterpreter
java.lang.Object
org.apache.jena.reasoner.rulesys.impl.LPInterpreter
Bytecode interpreter engine for the LP version of the backward
chaining rule system. An instance of this is forked off for each
parallel query.
-
Constructor Summary
ConstructorDescriptionLPInterpreter
(LPBRuleEngine engine, TriplePattern goal) Constructor used to construct top level calls.LPInterpreter
(LPBRuleEngine engine, TriplePattern goal, boolean isTop) Constructor.LPInterpreter
(LPBRuleEngine engine, TriplePattern goal, List<RuleClauseCode> clauses, boolean isTop) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Bind a value to a variable, recording the binding in the trail.void
close()
Stop the current work.static Node
Dereference a node, following any binding trail.static Triple
Return a dereferenced copy of a triple.static Node
derefPossFunctor
(Node node) Dereference a node which may be a functor nodeReturn the current choice point frame that can be used to restart the interpter at this point.Return the context in which this interpreter is running, that is either the Generator for a tabled goal or a top level iterator.Return the engine which owns this interpreter.static boolean
isGrounded
(Node node) Check if a node values is now groundednext()
Return the next result from this engine, no further initialization.void
Preserve the current interpter state in the consumer choice point at the top of the choice point tree.void
Restore the interpter state according to the given consumer choice point.void
setState
(LPInterpreterState state) Start the interpreter running with the given context.void
setTopInterpreter
(LPInterpreterContext context) Called by top level interpreter to set to execution context for this interpreter to be top level instead of an internal generator.boolean
Unify two nodes.void
unwindTrail
(int mark) Unwind the trail to given low water mark
-
Constructor Details
-
LPInterpreter
Constructor used to construct top level calls.- Parameters:
engine
- the engine which is calling this interpretergoal
- the query to be satisfied
-
LPInterpreter
Constructor.- Parameters:
engine
- the engine which is calling this interpretergoal
- the query to be satisfiedisTop
- true if this is a top level call from the outside iterator, false means it is an internal generator call which means we don't need to insert an tabled call
-
LPInterpreter
public LPInterpreter(LPBRuleEngine engine, TriplePattern goal, List<RuleClauseCode> clauses, boolean isTop) Constructor.- Parameters:
engine
- the engine which is calling this interpretergoal
- the query to be satisfiedclauses
- the set of code blocks needed to implement this goalisTop
- true if this is a top level call from the outside iterator, false means it is an internal generator call which means we don't need to insert an tabled call
-
-
Method Details
-
setTopInterpreter
Called by top level interpreter to set to execution context for this interpreter to be top level instead of an internal generator. -
close
public void close()Stop the current work. This is called if the top level results iterator has either finished or the calling application has had enough. -
setState
Start the interpreter running with the given context. -
next
Return the next result from this engine, no further initialization. Should be called from within an appropriately synchronized block. -
getEngine
Return the engine which owns this interpreter. -
getChoiceFrame
Return the current choice point frame that can be used to restart the interpter at this point. -
getContext
Return the context in which this interpreter is running, that is either the Generator for a tabled goal or a top level iterator. -
preserveState
Preserve the current interpter state in the consumer choice point at the top of the choice point tree. -
restoreState
Restore the interpter state according to the given consumer choice point. -
unify
Unify two nodes. Current implementation does not support functors.- Returns:
- true if the unification succeeds
-
bind
Bind a value to a variable, recording the binding in the trail.- Parameters:
var
- the dereferenced variable to be boundval
- the value to bind to it
-
unwindTrail
public void unwindTrail(int mark) Unwind the trail to given low water mark -
deref
Dereference a node, following any binding trail. -
isGrounded
Check if a node values is now grounded -
deref
Return a dereferenced copy of a triple. -
derefPossFunctor
Dereference a node which may be a functor node
-