Class BufferedStore
java.lang.Object
com.semedy.reasoner.reasoning.processes.ProcessImp
com.semedy.reasoner.reasoning.processes.UnbufferedStore
com.semedy.reasoner.reasoning.processes.BufferedStore
- Direct Known Subclasses:
EmptyStore,SynchronizedBufferedStore,TopDownBufferedStore
Stores intermediate results: results between two rule bodies or results of
rule evaluations
For recursive rules or recursion cycles results must be buffered.
Performs duplicate elimination if necessary
For recursive rules or recursion cycles results must be buffered.
Performs duplicate elimination if necessary
- Author:
- angele
-
Constructor Summary
ConstructorsConstructorDescriptionBufferedStore(InterruptFlag interruptFlag, ReasoningMonitor monitor, int arity, String predicate, boolean cepReasoning, boolean cepReasoningWithRetracts, ProcessExecutor executor, boolean sorted) BufferedStore(InterruptFlag interruptFlag, ReasoningMonitor monitor, int arity, String predicate, boolean cepReasoning, boolean cepReasoningWithRetracts, String tempDir, boolean swapping, ProcessExecutor executor, boolean sorted) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNegatedNeighbour(And join) add a negated rule body operator as next operatorvoidaddNeighbour(And join) add a rule body operator as next operatorvoidadd a whole relation at the beginninglongvoidclear()free up ressourcesvoidevaluate()evaluate a process during reasoning.voidevaluationFinished(long querykey) the whole evaluation is finishedget all received tuplesget the last stores resultsget all neighboursget the basic tuple storebooleanStore is subsumed.voidreadAccessBegin(Set<Integer> tickets, boolean lock) Reading of the store by an operator starts.booleanreadAccessEnd(ProcessImp source, Set<Integer> tickets, boolean lock, boolean notDissolve) Reading of a store ends.booleanreceive a whole relationbooleanreceiveTuple(int tuple) receive a single tuplebooleanreceiveTuple(long[] tuple) receive a single tuplebooleanreceiveTuple(TupleBuffer tuple) receive a single tuplevoidreset1()longsize()voidtriggerNeighbours(int ticket) trigger neighbours for evaluationvoidtuplesFinished(boolean isBottomUp) finish delivering single tuplesvoidtuplesFinished(String annotation, ReasoningRelation R1, ReasoningRelation R2) Finish delivering single tuples.Methods inherited from class com.semedy.reasoner.reasoning.processes.UnbufferedStore
getArity, incrementalRelations, incrementalSize, relations, startTuples, toStringMethods inherited from class com.semedy.reasoner.reasoning.processes.ProcessImp
addNextReceiver, dispose, evaluationFinished, getPriority, getStratum, isNotQueuedSetQueued, isQueued, nextReceiver, operationFinished, setDataFlowGraph, setQueued, setStratumMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.semedy.reasoner.reasoning.processes.Process
addNextReceiver, dispose, getPriority, getStratum, isNotQueuedSetQueued, isQueued, nextReceiver, operationFinished, setDataFlowGraph, setQueued, setStratumMethods inherited from interface com.semedy.reasoner.reasoning.processes.Store
getArity, incrementalRelations, relations, startTuples, toString
-
Constructor Details
-
BufferedStore
public BufferedStore(InterruptFlag interruptFlag, ReasoningMonitor monitor, int arity, String predicate, boolean cepReasoning, boolean cepReasoningWithRetracts, String tempDir, boolean swapping, ProcessExecutor executor, boolean sorted) -
BufferedStore
public BufferedStore(InterruptFlag interruptFlag, ReasoningMonitor monitor, int arity, String predicate, boolean cepReasoning, boolean cepReasoningWithRetracts, ProcessExecutor executor, boolean sorted)
-
-
Method Details
-
evaluationFinished
Description copied from interface:Processthe whole evaluation is finished- Specified by:
evaluationFinishedin interfaceProcess- Specified by:
evaluationFinishedin interfaceStore- Overrides:
evaluationFinishedin classUnbufferedStore- Throws:
ReasoningExceptionSemReasonerException
-
size
- Specified by:
sizein interfaceStore- Overrides:
sizein classUnbufferedStore- Returns:
- Throws:
IOExceptionEDBException- How many tuples are stored
-
getAllTuples
- Specified by:
getAllTuplesin interfaceStore- Overrides:
getAllTuplesin classUnbufferedStore- Returns:
- Throws:
EDBException- get a list of all relations stored in storeIOException
-
getAllTuplesInOne
Description copied from interface:Storeget all received tuples- Specified by:
getAllTuplesInOnein interfaceStore- Overrides:
getAllTuplesInOnein classUnbufferedStore- Returns:
- Throws:
IOExceptionEDBException
-
addNegatedNeighbour
Description copied from interface:Storeadd a negated rule body operator as next operator- Specified by:
addNegatedNeighbourin interfaceStore- Overrides:
addNegatedNeighbourin classUnbufferedStore
-
addNeighbour
Description copied from interface:Storeadd a rule body operator as next operator- Specified by:
addNeighbourin interfaceStore- Overrides:
addNeighbourin classUnbufferedStore
-
readAccessBegin
Description copied from interface:StoreReading of the store by an operator starts.
Every reading is uniquely identified by a ticket.
Lock indicates that ressources must be locked- Specified by:
readAccessBeginin interfaceStore- Overrides:
readAccessBeginin classUnbufferedStore
-
readAccessEnd
public boolean readAccessEnd(ProcessImp source, Set<Integer> tickets, boolean lock, boolean notDissolve) throws SemReasonerException, IOException Description copied from interface:StoreReading of a store ends.- Specified by:
readAccessEndin interfaceStore- Overrides:
readAccessEndin classUnbufferedStore- Parameters:
source- , the readertickets- , the ticket of the reading processlock- , was a lock required at begin of the reading processnotDissolve- , have relations be pushed instead of joined- Returns:
- Throws:
SemReasonerExceptionIOException
-
reset1
- Throws:
IOException
-
receiveRelation
public boolean receiveRelation(ReasoningRelation R) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiverreceive a whole relation- Specified by:
receiveRelationin interfaceReceiver- Specified by:
receiveRelationin interfaceStore- Overrides:
receiveRelationin classUnbufferedStore- Parameters:
R- the whole relation to be received- Returns:
- true, if relation is later on dissolved, false otherwise
- Throws:
ReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
addRelation
Description copied from interface:Receiveradd a whole relation at the beginning- Specified by:
addRelationin interfaceProcess- Specified by:
addRelationin interfaceReceiver- Specified by:
addRelationin interfaceStore- Overrides:
addRelationin classUnbufferedStore- Parameters:
R- the relation to be added- Throws:
IOExceptionEDBException
-
triggerNeighbours
Description copied from interface:Storetrigger neighbours for evaluation- Specified by:
triggerNeighboursin interfaceStore- Overrides:
triggerNeighboursin classUnbufferedStore- Throws:
IOExceptionReasoningExceptionSemReasonerException
-
isSubsumed
public boolean isSubsumed()Description copied from interface:StoreStore is subsumed. This means that no additional tuples are stored.- Specified by:
isSubsumedin interfaceStore- Overrides:
isSubsumedin classUnbufferedStore- Returns:
-
receiveTuple
Description copied from interface:Receiverreceive a single tuple- Specified by:
receiveTuplein interfaceReceiver- Specified by:
receiveTuplein interfaceStore- Overrides:
receiveTuplein classUnbufferedStore- Parameters:
tuple- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerExceptionIOException
-
receiveTuple
Description copied from interface:Receiverreceive a single tuple- Specified by:
receiveTuplein interfaceReceiver- Overrides:
receiveTuplein classProcessImp- Parameters:
tuple- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
ReasoningExceptionSemReasonerExceptionIOException
-
receiveTuple
Description copied from interface:Receiverreceive a single tuple- Specified by:
receiveTuplein interfaceReceiver- Specified by:
receiveTuplein interfaceStore- Overrides:
receiveTuplein classUnbufferedStore- Parameters:
tuple- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerExceptionIOException
-
getTupleStore
Description copied from interface:Receiverget the basic tuple store- Specified by:
getTupleStorein interfaceProcess- Specified by:
getTupleStorein interfaceReceiver- Specified by:
getTupleStorein interfaceStore- Overrides:
getTupleStorein classUnbufferedStore- Returns:
- the tuple store
-
evaluate
Description copied from interface:Processevaluate a process during reasoning.
Returns how the number of tuples sent away- Specified by:
evaluatein interfaceProcess- Specified by:
evaluatein interfaceStore- Overrides:
evaluatein classUnbufferedStore- Throws:
InterruptedExceptionReasoningExceptionIOExceptionSemReasonerException
-
tuplesFinished
public void tuplesFinished(String annotation, ReasoningRelation R1, ReasoningRelation R2) throws SemReasonerException, InterruptedException, IOException Description copied from interface:ReceiverFinish delivering single tuples.
Cache result and annotate result.- Specified by:
tuplesFinishedin interfaceReceiver- Specified by:
tuplesFinishedin interfaceStore- Overrides:
tuplesFinishedin classUnbufferedStore- Parameters:
annotation- , an annotation used for cachingR1- , the relations which have been combinedR2- , the relations which have been combined- Throws:
ReasoningExceptionSemReasonerExceptionInterruptedExceptionIOException
-
clear
Description copied from class:ProcessImpfree up ressources- Specified by:
clearin interfaceProcess- Overrides:
clearin classUnbufferedStore- Throws:
IOException
-
tuplesFinished
public void tuplesFinished(boolean isBottomUp) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiverfinish delivering single tuples- Specified by:
tuplesFinishedin interfaceReceiver- Specified by:
tuplesFinishedin interfaceStore- Overrides:
tuplesFinishedin classUnbufferedStore- Parameters:
isBottomUp- TODO- Throws:
ReasoningExceptionSemReasonerExceptionInterruptedExceptionIOException
-
getNeighbours
Description copied from interface:Storeget all neighbours- Specified by:
getNeighboursin interfaceStore- Overrides:
getNeighboursin classUnbufferedStore- Returns:
-
bufferedSize
- Throws:
IOExceptionEDBException
-
getLastResults
Description copied from interface:Storeget the last stores results- Specified by:
getLastResultsin interfaceStore- Overrides:
getLastResultsin classUnbufferedStore- Returns:
-