Package com.semedy.reasoner.edb.ramstore
Class MainMemorySubRelation
java.lang.Object
com.semedy.reasoner.edb.ramstore.MainMemoryRelation
com.semedy.reasoner.edb.ramstore.MixedRelation
com.semedy.reasoner.edb.ramstore.MainMemorySubRelation
- All Implemented Interfaces:
BaseRelation
,Relation
,CacheUnit
A sub relation of a persistent relation defined by a filter.
Sub relation is kept in main memory.
Sub relation is kept in main memory.
- Author:
- juergen
-
Field Summary
Fields inherited from class com.semedy.reasoner.edb.ramstore.MainMemoryRelation
_baseRelation
-
Constructor Summary
ConstructorDescriptionMainMemorySubRelation
(List<Relation> relations, long[] filter, int arity, long[] grounds) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addTuple
(int tuple) add a tuple to the relationboolean
addTuple
(long[] tuple) add a tuple to the relationboolean
addTuple
(TupleBuffer tuple) add a tuple to the relationlong[]
long
getNumberOfDifferentValues
(int argument) Returns the number of different values at the argument positions.long
getNumberOfDifferentValues
(int argument, long value) Returns the number of values occurring at the argument positions
Used for statisticsboolean
isEmpty()
Is the relation empty?boolean
removeTuple
(int tuple) remove a tuple from the relationboolean
removeTuple
(long[] tuple) remove a tuple from the relationboolean
removeTuple
(TupleBuffer tuple) remove a tuple from the relationvoid
select()
intialize the use: the tuples are copied from the persistent part to the main memory partlong
size()
returns the number of tuples in relationMethods inherited from class com.semedy.reasoner.edb.ramstore.MixedRelation
checkSanity, clear, close, count, delete, destroy, flush, getDataFilePath, getLast, getMaxValue, getMinValue, getNext, getPersistentRelation, isReleasable, readTupleFile, release, remove, setLast, setNext, setPersistentRelation, sizeInBytes, toString, touch, transactionBegin, transactionCommit, transactionRollback
Methods inherited from class com.semedy.reasoner.edb.ramstore.MainMemoryRelation
addSubRelation, containsTuple, containsTuple, containsTuple, createIndex, createSortedIndex, deSelect, elements, elements, getArity, getCacheInfo, getDirectEncodedType, getFilename, getGrounds, getIdentifier, getIndex, getInputBuffer, getInternalArity, getName, getPredicateSymbol, getSortedIndex, getTupleStore, getValues, hasDuplicates, isDirectEncoded, isOverwrittenByTuple, isPersistent, isTemporary, lastModificationTime, mayContainDuplicates, overwriteTuple, overwriteTuple, readBinaryFromBackup, registerListener, union, writeBinary, writeBinaryToBackup, writeBinaryWithGrounds
-
Constructor Details
-
MainMemorySubRelation
public MainMemorySubRelation(List<Relation> relations, long[] filter, int arity, long[] grounds) throws IOException, EDBException - Parameters:
relations
-filter
-arity
-grounds
-- Throws:
IOException
EDBException
-
-
Method Details
-
size
Description copied from interface:BaseRelation
returns the number of tuples in relation- Specified by:
size
in interfaceBaseRelation
- Overrides:
size
in classMixedRelation
- Returns:
- number of tuples in relation
- Throws:
IOException
EDBException
-
getFilter
public long[] getFilter() -
addTuple
Description copied from interface:BaseRelation
add a tuple to the relation- Specified by:
addTuple
in interfaceBaseRelation
- Overrides:
addTuple
in classMixedRelation
- Parameters:
tuple
- the tuple to add- Returns:
- tuple has been added
- Throws:
IOException
-
addTuple
Description copied from interface:BaseRelation
add a tuple to the relation- Specified by:
addTuple
in interfaceBaseRelation
- Overrides:
addTuple
in classMixedRelation
- Parameters:
tuple
- the tuple to add- Returns:
- tuple has been added
- Throws:
IOException
-
addTuple
Description copied from interface:BaseRelation
add a tuple to the relation- Specified by:
addTuple
in interfaceBaseRelation
- Overrides:
addTuple
in classMainMemoryRelation
- Parameters:
tuple
- the tuple to add- Returns:
- tuple has been added
- Throws:
IOException
-
removeTuple
Description copied from interface:BaseRelation
remove a tuple from the relation- Specified by:
removeTuple
in interfaceBaseRelation
- Overrides:
removeTuple
in classMixedRelation
- Parameters:
tuple
- , tuple to be removed- Returns:
- true, if tuple has been removed
- Throws:
IOException
-
removeTuple
Description copied from interface:BaseRelation
remove a tuple from the relation- Specified by:
removeTuple
in interfaceBaseRelation
- Overrides:
removeTuple
in classMixedRelation
- Parameters:
tuple
- , tuple to be removed- Returns:
- true, if tuple has been removed
- Throws:
IOException
-
removeTuple
Description copied from interface:BaseRelation
remove a tuple from the relation- Specified by:
removeTuple
in interfaceBaseRelation
- Overrides:
removeTuple
in classMainMemoryRelation
- Parameters:
tuple
- , address of tuple in tuple store- Returns:
- true, if tuple has been removed
- Throws:
IOException
-
select
Description copied from class:MixedRelation
intialize the use: the tuples are copied from the persistent part to the main memory part- Specified by:
select
in interfaceBaseRelation
- Specified by:
select
in interfaceRelation
- Overrides:
select
in classMixedRelation
- Throws:
IOException
EDBException
-
getNumberOfDifferentValues
Description copied from interface:Relation
Returns the number of different values at the argument positions.
Used for statistics.- Specified by:
getNumberOfDifferentValues
in interfaceRelation
- Overrides:
getNumberOfDifferentValues
in classMixedRelation
- Parameters:
argument
- , argument position- Returns:
- Throws:
EDBException
IOException
-
getNumberOfDifferentValues
Description copied from interface:Relation
Returns the number of values occurring at the argument positions
Used for statistics- Specified by:
getNumberOfDifferentValues
in interfaceRelation
- Overrides:
getNumberOfDifferentValues
in classMixedRelation
- Parameters:
argument
- , argument positionvalue
- , the concrete value- Returns:
- Throws:
EDBException
IOException
-
isEmpty
Description copied from interface:BaseRelation
Is the relation empty?- Specified by:
isEmpty
in interfaceBaseRelation
- Overrides:
isEmpty
in classMixedRelation
- Returns:
- relation is empty
- Throws:
IOException
-