Module org.apache.jena.core
Class ConsumerChoicePointFrame
java.lang.Object
org.apache.jena.reasoner.rulesys.impl.FrameObject
org.apache.jena.reasoner.rulesys.impl.GenericChoiceFrame
org.apache.jena.reasoner.rulesys.impl.GenericTripleMatchFrame
org.apache.jena.reasoner.rulesys.impl.ConsumerChoicePointFrame
- All Implemented Interfaces:
LPAgendaEntry
,LPInterpreterState
public class ConsumerChoicePointFrame
extends GenericTripleMatchFrame
implements LPAgendaEntry, LPInterpreterState
Frame in the LPInterpreter's control stack used to represent matching
to the results of a tabled predicate. Conventionally the system state which
finds and tables the goal results is called the generator and states which
require those results are called consumers.
This is used in the inner loop of the interpreter and so is a pure data structure not an abstract data type and assumes privileged access to the interpreter state.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the frame actively.Return the interpeter context which is reading the results of this consumer.Return the generator associated with this entry (might be the entry itself)void
init
(LPInterpreter interpreter) Initialize the choice point state.boolean
isReady()
Return true if this choice point could usefully be restarted.nextMatch
(LPInterpreter interpreter) Find the next result triple and bind the result vars appropriately.void
preserveState
(List<Node> trail) Preserve the state of an interpreter into this frame.void
pump()
Reactivate this choice point to return new results.void
restoreState
(LPInterpreter interp) Restore the state of an interpreter from this framevoid
Notify that this consumer choice point has finished consuming all the results of a closed generator.void
setReady()
Called by generator when there are more results available.Methods inherited from class org.apache.jena.reasoner.rulesys.impl.GenericTripleMatchFrame
bindResult, functorMatch
Methods inherited from class org.apache.jena.reasoner.rulesys.impl.GenericChoiceFrame
setContinuation
Methods inherited from class org.apache.jena.reasoner.rulesys.impl.FrameObject
fastLinkTo, getLink, linkTo
-
Constructor Details
-
ConsumerChoicePointFrame
Constructor.- Parameters:
interpreter
- the parent interpreter whose state is to be preserved here, its arg stack defines the parameters for the target goal
-
-
Method Details
-
init
Initialize the choice point state.- Overrides:
init
in classGenericTripleMatchFrame
- Parameters:
interpreter
- the parent interpreter whose state is to be preserved here, its arg stack defines the parameters for the target goal
-
preserveState
Preserve the state of an interpreter into this frame. -
restoreState
Restore the state of an interpreter from this frame -
nextMatch
Find the next result triple and bind the result vars appropriately.- Parameters:
interpreter
- the calling interpreter whose trail should be used- Returns:
- FAIL if there are no more matches and the generator is closed, SUSPEND if there are no more matches but the generator could generate more, SATISFIED if a match has been found.
-
isReady
public boolean isReady()Return true if this choice point could usefully be restarted.- Specified by:
isReady
in interfaceLPAgendaEntry
-
setReady
public void setReady()Called by generator when there are more results available. -
close
public void close()Description copied from class:FrameObject
Close the frame actively. This frees any internal resources, frees this frame and frees the frame to which this is linked.- Overrides:
close
in classFrameObject
-
setFinished
public void setFinished()Notify that this consumer choice point has finished consuming all the results of a closed generator. -
pump
public void pump()Reactivate this choice point to return new results.- Specified by:
pump
in interfaceLPAgendaEntry
-
getGenerator
Return the generator associated with this entry (might be the entry itself)- Specified by:
getGenerator
in interfaceLPAgendaEntry
-
getConsumingContext
Return the interpeter context which is reading the results of this consumer.
-