Class SynchronizedBufferedStore
java.lang.Object
com.semedy.reasoner.reasoning.processes.ProcessImp
com.semedy.reasoner.reasoning.processes.UnbufferedStore
com.semedy.reasoner.reasoning.processes.BufferedStore
com.semedy.reasoner.reasoning.processes.SynchronizedBufferedStore
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
Synchronized version used for sensor builtins
For recursive rules or recursion cycles results must be buffered.
Performs duplicate elimination if necessary
Synchronized version used for sensor builtins
- Author:
- angele
-
Constructor Summary
ConstructorDescriptionSynchronizedBufferedStore
(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
add a whole relation at the beginningvoid
evaluate()
evaluate a process during reasoning.void
readAccessBegin
(Set<Integer> tickets, boolean lockit) Reading of the store by an operator starts.boolean
readAccessEnd
(ProcessImp source, Set<Integer> tickets, boolean unlockit, boolean pushed) Reading of a store ends.boolean
receive a whole relationstartTuples
(Receiver source, boolean check4Duplicates) start delivering single tuplesvoid
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.BufferedStore
addNegatedNeighbour, addNeighbour, bufferedSize, clear, evaluationFinished, getAllTuples, getAllTuplesInOne, getLastResults, getNeighbours, getTupleStore, isSubsumed, receiveTuple, receiveTuple, receiveTuple, reset1, size
Methods inherited from class com.semedy.reasoner.reasoning.processes.UnbufferedStore
getArity, incrementalRelations, incrementalSize, relations, 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, toString
-
Constructor Details
-
SynchronizedBufferedStore
public SynchronizedBufferedStore(InterruptFlag interruptFlag, ReasoningMonitor monitor, int arity, String predicate, boolean cepReasoning, boolean cepReasoningWithRetracts, String tempDir, boolean swapping, ProcessExecutor executor, boolean sorted)
-
-
Method Details
-
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 classBufferedStore
-
readAccessEnd
public boolean readAccessEnd(ProcessImp source, Set<Integer> tickets, boolean unlockit, boolean pushed) throws SemReasonerException, IOException Description copied from interface:Store
Reading of a store ends.- Specified by:
readAccessEnd
in interfaceStore
- Overrides:
readAccessEnd
in classBufferedStore
- Parameters:
source
- , the readertickets
- , the ticket of the reading processunlockit
- , was a lock required at begin of the reading processpushed
- , have relations be pushed instead of joined- Returns:
- Throws:
SemReasonerException
IOException
-
receiveRelation
public boolean receiveRelation(ReasoningRelation R) throws InterruptedException, IOException, SemReasonerException Description copied from interface:Receiver
receive a whole relation- Specified by:
receiveRelation
in interfaceReceiver
- Specified by:
receiveRelation
in interfaceStore
- Overrides:
receiveRelation
in classBufferedStore
- Parameters:
R
- the whole relation to be received- Returns:
- true, if relation is later on dissolved, false otherwise
- Throws:
InterruptedException
IOException
ReasoningException
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 classBufferedStore
- Parameters:
R
- the relation to be added- Throws:
IOException
EDBException
-
triggerNeighbours
public void triggerNeighbours(int ticket) Description copied from interface:Store
trigger neighbours for evaluation- Specified by:
triggerNeighbours
in interfaceStore
- Overrides:
triggerNeighbours
in classBufferedStore
-
startTuples
Description copied from interface:Receiver
start delivering single tuples- Specified by:
startTuples
in interfaceReceiver
- Specified by:
startTuples
in interfaceStore
- Overrides:
startTuples
in classUnbufferedStore
- Parameters:
source
- , the delivering processcheck4Duplicates
- , check for duplicates in the target store- Returns:
- an object receiving the results
-
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 classBufferedStore
- Throws:
InterruptedException
IOException
ReasoningException
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 classBufferedStore
- Parameters:
annotation
- , an annotation used for cachingR1
- , the relations which have been combinedR2
- , the relations which have been combined- Throws:
ReasoningException
SemReasonerException
InterruptedException
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 classBufferedStore
- Parameters:
isBottomUp
- TODO- Throws:
ReasoningException
SemReasonerException
InterruptedException
IOException
-