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
ConstructorDescriptionBufferedStore
(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 TypeMethodDescriptionvoid
addNegatedNeighbour
(And join) add a negated rule body operator as next operatorvoid
addNeighbour
(And join) add a rule body operator as next operatorvoid
add a whole relation at the beginninglong
void
clear()
free up ressourcesvoid
evaluate()
evaluate a process during reasoning.void
evaluationFinished
(long querykey) the whole evaluation is finishedget all received tuplesget the last stores resultsget all neighboursget the basic tuple storeboolean
Store is subsumed.void
readAccessBegin
(Set<Integer> tickets, boolean lock) Reading of the store by an operator starts.boolean
readAccessEnd
(ProcessImp source, Set<Integer> tickets, boolean lock, boolean notDissolve) Reading of a store ends.boolean
receive a whole relationboolean
receiveTuple
(int tuple) receive a single tupleboolean
receiveTuple
(long[] tuple) receive a single tupleboolean
receiveTuple
(TupleBuffer tuple) receive a single tuplevoid
reset1()
long
size()
void
triggerNeighbours
(int ticket) trigger neighbours for evaluationvoid
tuplesFinished
(boolean isBottomUp) finish delivering single tuplesvoid
tuplesFinished
(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, toString
Methods inherited from class com.semedy.reasoner.reasoning.processes.ProcessImp
addNextReceiver, dispose, evaluationFinished, getPriority, getStratum, isNotQueuedSetQueued, isQueued, nextReceiver, operationFinished, setDataFlowGraph, setQueued, setStratum
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.semedy.reasoner.reasoning.processes.Process
addNextReceiver, dispose, getPriority, getStratum, isNotQueuedSetQueued, isQueued, nextReceiver, operationFinished, setDataFlowGraph, setQueued, setStratum
Methods 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:Process
the whole evaluation is finished- Specified by:
evaluationFinished
in interfaceProcess
- Specified by:
evaluationFinished
in interfaceStore
- Overrides:
evaluationFinished
in classUnbufferedStore
- Throws:
ReasoningException
SemReasonerException
-
size
- Specified by:
size
in interfaceStore
- Overrides:
size
in classUnbufferedStore
- Returns:
- Throws:
IOException
EDBException
- How many tuples are stored
-
getAllTuples
- Specified by:
getAllTuples
in interfaceStore
- Overrides:
getAllTuples
in classUnbufferedStore
- Returns:
- Throws:
EDBException
- get a list of all relations stored in storeIOException
-
getAllTuplesInOne
Description copied from interface:Store
get all received tuples- Specified by:
getAllTuplesInOne
in interfaceStore
- Overrides:
getAllTuplesInOne
in classUnbufferedStore
- Returns:
- Throws:
IOException
EDBException
-
addNegatedNeighbour
Description copied from interface:Store
add a negated rule body operator as next operator- Specified by:
addNegatedNeighbour
in interfaceStore
- Overrides:
addNegatedNeighbour
in classUnbufferedStore
-
addNeighbour
Description copied from interface:Store
add a rule body operator as next operator- Specified by:
addNeighbour
in interfaceStore
- Overrides:
addNeighbour
in classUnbufferedStore
-
readAccessBegin
Description copied from interface:Store
Reading of the store by an operator starts.
Every reading is uniquely identified by a ticket.
Lock indicates that ressources must be locked- Specified by:
readAccessBegin
in interfaceStore
- Overrides:
readAccessBegin
in classUnbufferedStore
-
readAccessEnd
public boolean readAccessEnd(ProcessImp source, Set<Integer> tickets, boolean lock, boolean notDissolve) throws SemReasonerException, IOException Description copied from interface:Store
Reading of a store ends.- Specified by:
readAccessEnd
in interfaceStore
- Overrides:
readAccessEnd
in 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:
SemReasonerException
IOException
-
reset1
- Throws:
IOException
-
receiveRelation
public boolean receiveRelation(ReasoningRelation R) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
receive a whole relation- Specified by:
receiveRelation
in interfaceReceiver
- Specified by:
receiveRelation
in interfaceStore
- Overrides:
receiveRelation
in classUnbufferedStore
- Parameters:
R
- the whole relation to be received- Returns:
- true, if relation is later on dissolved, false otherwise
- Throws:
ReasoningException
InterruptedException
IOException
SemReasonerException
-
addRelation
Description copied from interface:Receiver
add a whole relation at the beginning- Specified by:
addRelation
in interfaceProcess
- Specified by:
addRelation
in interfaceReceiver
- Specified by:
addRelation
in interfaceStore
- Overrides:
addRelation
in classUnbufferedStore
- Parameters:
R
- the relation to be added- Throws:
IOException
EDBException
-
triggerNeighbours
Description copied from interface:Store
trigger neighbours for evaluation- Specified by:
triggerNeighbours
in interfaceStore
- Overrides:
triggerNeighbours
in classUnbufferedStore
- Throws:
IOException
ReasoningException
SemReasonerException
-
isSubsumed
public boolean isSubsumed()Description copied from interface:Store
Store is subsumed. This means that no additional tuples are stored.- Specified by:
isSubsumed
in interfaceStore
- Overrides:
isSubsumed
in classUnbufferedStore
- Returns:
-
receiveTuple
Description copied from interface:Receiver
receive a single tuple- Specified by:
receiveTuple
in interfaceReceiver
- Specified by:
receiveTuple
in interfaceStore
- Overrides:
receiveTuple
in classUnbufferedStore
- Parameters:
tuple
- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerException
IOException
-
receiveTuple
Description copied from interface:Receiver
receive a single tuple- Specified by:
receiveTuple
in interfaceReceiver
- Overrides:
receiveTuple
in classProcessImp
- Parameters:
tuple
- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
ReasoningException
SemReasonerException
IOException
-
receiveTuple
Description copied from interface:Receiver
receive a single tuple- Specified by:
receiveTuple
in interfaceReceiver
- Specified by:
receiveTuple
in interfaceStore
- Overrides:
receiveTuple
in classUnbufferedStore
- Parameters:
tuple
- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerException
IOException
-
getTupleStore
Description copied from interface:Receiver
get the basic tuple store- Specified by:
getTupleStore
in interfaceProcess
- Specified by:
getTupleStore
in interfaceReceiver
- Specified by:
getTupleStore
in interfaceStore
- Overrides:
getTupleStore
in classUnbufferedStore
- Returns:
- the tuple store
-
evaluate
Description copied from interface:Process
evaluate a process during reasoning.
Returns how the number of tuples sent away- Specified by:
evaluate
in interfaceProcess
- Specified by:
evaluate
in interfaceStore
- Overrides:
evaluate
in classUnbufferedStore
- Throws:
InterruptedException
ReasoningException
IOException
SemReasonerException
-
tuplesFinished
public void tuplesFinished(String annotation, ReasoningRelation R1, ReasoningRelation R2) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
Finish delivering single tuples.
Cache result and annotate result.- Specified by:
tuplesFinished
in interfaceReceiver
- Specified by:
tuplesFinished
in interfaceStore
- Overrides:
tuplesFinished
in classUnbufferedStore
- Parameters:
annotation
- , an annotation used for cachingR1
- , the relations which have been combinedR2
- , the relations which have been combined- Throws:
ReasoningException
SemReasonerException
InterruptedException
IOException
-
clear
Description copied from class:ProcessImp
free up ressources- Specified by:
clear
in interfaceProcess
- Overrides:
clear
in classUnbufferedStore
- Throws:
IOException
-
tuplesFinished
public void tuplesFinished(boolean isBottomUp) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
finish delivering single tuples- Specified by:
tuplesFinished
in interfaceReceiver
- Specified by:
tuplesFinished
in interfaceStore
- Overrides:
tuplesFinished
in classUnbufferedStore
- Parameters:
isBottomUp
- TODO- Throws:
ReasoningException
SemReasonerException
InterruptedException
IOException
-
getNeighbours
Description copied from interface:Store
get all neighbours- Specified by:
getNeighbours
in interfaceStore
- Overrides:
getNeighbours
in classUnbufferedStore
- Returns:
-
bufferedSize
- Throws:
IOException
EDBException
-
getLastResults
Description copied from interface:Store
get the last stores results- Specified by:
getLastResults
in interfaceStore
- Overrides:
getLastResults
in classUnbufferedStore
- Returns:
-