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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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)voidinit(LPInterpreter interpreter) Initialize the choice point state.booleanisReady()Return true if this choice point could usefully be restarted.nextMatch(LPInterpreter interpreter) Find the next result triple and bind the result vars appropriately.voidpreserveState(List<Node> trail) Preserve the state of an interpreter into this frame.voidpump()Reactivate this choice point to return new results.voidrestoreState(LPInterpreter interp) Restore the state of an interpreter from this framevoidNotify that this consumer choice point has finished consuming all the results of a closed generator.voidsetReady()Called by generator when there are more results available.Methods inherited from class org.apache.jena.reasoner.rulesys.impl.GenericTripleMatchFrame
bindResult, functorMatchMethods inherited from class org.apache.jena.reasoner.rulesys.impl.GenericChoiceFrame
setContinuationMethods 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:
initin 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:
isReadyin interfaceLPAgendaEntry
-
setReady
public void setReady()Called by generator when there are more results available. -
close
public void close()Description copied from class:FrameObjectClose the frame actively. This frees any internal resources, frees this frame and frees the frame to which this is linked.- Overrides:
closein 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:
pumpin interfaceLPAgendaEntry
-
getGenerator
Return the generator associated with this entry (might be the entry itself)- Specified by:
getGeneratorin interfaceLPAgendaEntry
-
getConsumingContext
Return the interpeter context which is reading the results of this consumer.
-