Class SwappableRelation
java.lang.Object
com.semedy.reasoner.edb.persistentstore.AbstractCacheUnit
com.semedy.reasoner.reasoning.processes.SwappableRelation
- All Implemented Interfaces:
CacheUnit
- Direct Known Subclasses:
SwappableIncrementalRelation
Store for a swappable relation.
Either relation is in main memory or it is persistent.
Main memory incremental relation can be swapped out.
Either relation is in main memory or it is persistent.
Main memory incremental relation can be swapped out.
- Author:
- angele
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSwappableRelation
(int arity, ReasoningMonitor monitor, String tempDir, boolean releasable, boolean cepReasoning, boolean retracts) SwappableRelation
(int arity, ReasoningMonitor monitor, String tempDir, boolean releasable, boolean cepReasoning, boolean retracts, boolean duplicates) the receiver it is a part of -
Method Summary
Modifier and TypeMethodDescriptionboolean
addTuple
(int tuple) add a tupleboolean
addTuple
(long[] tuple) add a tupleboolean
addTuple
(TupleBuffer tuple) add a tuplevoid
clear()
clear relationvoid
destroy()
destroy it.void
finalize()
finally destroy itget all tuples as reasoning relationget the tuple store behindboolean
is it in main memoryboolean
is it releasable?void
release()
swap out.void
remove()
remove all tupleslong
size()
number of tupleslong
get the approximate size in bytes used in main memoryswapout and return it as (persistent) reasoning relationvoid
swapOut()
swap out to temp dirvoid
swap out to tuple fileSwap out to a tuple file with a generic name in temp directory
-
Field Details
-
_tupleStore
tuple store
-
-
Constructor Details
-
SwappableRelation
public SwappableRelation(int arity, ReasoningMonitor monitor, String tempDir, boolean releasable, boolean cepReasoning, boolean retracts, boolean duplicates) the receiver it is a part of -
SwappableRelation
public SwappableRelation(int arity, ReasoningMonitor monitor, String tempDir, boolean releasable, boolean cepReasoning, boolean retracts)
-
-
Method Details
-
clear
clear relation- Throws:
IOException
-
isInMemory
public boolean isInMemory()is it in main memory- Returns:
-
addTuple
add a tuple- Parameters:
tuple
-- Returns:
- Throws:
IOException
EDBException
-
addTuple
add a tuple- Parameters:
tuple
-- Returns:
- Throws:
IOException
EDBException
-
addTuple
add a tuple- Parameters:
tuple
-- Returns:
- Throws:
IOException
EDBException
-
getTuples
get all tuples as reasoning relation -
getTupleStore
get the tuple store behind- Returns:
-
sizeInBytes
public long sizeInBytes()get the approximate size in bytes used in main memory- Specified by:
sizeInBytes
in interfaceCacheUnit
- Specified by:
sizeInBytes
in classAbstractCacheUnit
- Returns:
-
swapout
swapout and return it as (persistent) reasoning relation- Parameters:
tupleFile
-- Returns:
- Throws:
IOException
EDBException
-
swapOutToTupleFile
Swap out to a tuple file with a generic name in temp directory- Returns:
- Throws:
IOException
EDBException
-
swapOut
swap out to tuple file- Parameters:
tupleFile
-- Throws:
IOException
EDBException
-
swapOut
swap out to temp dir- Throws:
IOException
EDBException
-
release
swap out. Used in cache manager- Specified by:
release
in interfaceCacheUnit
- Specified by:
release
in classAbstractCacheUnit
- Throws:
EDBException
IOException
-
isReleasable
is it releasable?- Specified by:
isReleasable
in interfaceCacheUnit
- Specified by:
isReleasable
in classAbstractCacheUnit
- Returns:
- Throws:
IOException
-
remove
remove all tuples- Throws:
IOException
-
size
number of tuples- Returns:
- Throws:
IOException
EDBException
-
destroy
public void destroy()destroy it. Used in cache manager -
finalize
public void finalize()finally destroy it
-