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
ConstructorsConstructorDescriptionMainMemorySubRelation(List<Relation> relations, long[] filter, int arity, long[] grounds) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddTuple(int tuple) add a tuple to the relationbooleanaddTuple(long[] tuple) add a tuple to the relationbooleanaddTuple(TupleBuffer tuple) add a tuple to the relationlong[]longgetNumberOfDifferentValues(int argument) Returns the number of different values at the argument positions.longgetNumberOfDifferentValues(int argument, long value) Returns the number of values occurring at the argument positions
Used for statisticsbooleanisEmpty()Is the relation empty?booleanremoveTuple(int tuple) remove a tuple from the relationbooleanremoveTuple(long[] tuple) remove a tuple from the relationbooleanremoveTuple(TupleBuffer tuple) remove a tuple from the relationvoidselect()intialize the use: the tuples are copied from the persistent part to the main memory partlongsize()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, transactionRollbackMethods 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:
IOExceptionEDBException
-
-
Method Details
-
size
Description copied from interface:BaseRelationreturns the number of tuples in relation- Specified by:
sizein interfaceBaseRelation- Overrides:
sizein classMixedRelation- Returns:
- number of tuples in relation
- Throws:
IOExceptionEDBException
-
getFilter
public long[] getFilter() -
addTuple
Description copied from interface:BaseRelationadd a tuple to the relation- Specified by:
addTuplein interfaceBaseRelation- Overrides:
addTuplein classMixedRelation- Parameters:
tuple- the tuple to add- Returns:
- tuple has been added
- Throws:
IOException
-
addTuple
Description copied from interface:BaseRelationadd a tuple to the relation- Specified by:
addTuplein interfaceBaseRelation- Overrides:
addTuplein classMixedRelation- Parameters:
tuple- the tuple to add- Returns:
- tuple has been added
- Throws:
IOException
-
addTuple
Description copied from interface:BaseRelationadd a tuple to the relation- Specified by:
addTuplein interfaceBaseRelation- Overrides:
addTuplein classMainMemoryRelation- Parameters:
tuple- the tuple to add- Returns:
- tuple has been added
- Throws:
IOException
-
removeTuple
Description copied from interface:BaseRelationremove a tuple from the relation- Specified by:
removeTuplein interfaceBaseRelation- Overrides:
removeTuplein classMixedRelation- Parameters:
tuple- , tuple to be removed- Returns:
- true, if tuple has been removed
- Throws:
IOException
-
removeTuple
Description copied from interface:BaseRelationremove a tuple from the relation- Specified by:
removeTuplein interfaceBaseRelation- Overrides:
removeTuplein classMixedRelation- Parameters:
tuple- , tuple to be removed- Returns:
- true, if tuple has been removed
- Throws:
IOException
-
removeTuple
Description copied from interface:BaseRelationremove a tuple from the relation- Specified by:
removeTuplein interfaceBaseRelation- Overrides:
removeTuplein classMainMemoryRelation- Parameters:
tuple- , address of tuple in tuple store- Returns:
- true, if tuple has been removed
- Throws:
IOException
-
select
Description copied from class:MixedRelationintialize the use: the tuples are copied from the persistent part to the main memory part- Specified by:
selectin interfaceBaseRelation- Specified by:
selectin interfaceRelation- Overrides:
selectin classMixedRelation- Throws:
IOExceptionEDBException
-
getNumberOfDifferentValues
Description copied from interface:RelationReturns the number of different values at the argument positions.
Used for statistics.- Specified by:
getNumberOfDifferentValuesin interfaceRelation- Overrides:
getNumberOfDifferentValuesin classMixedRelation- Parameters:
argument- , argument position- Returns:
- Throws:
EDBExceptionIOException
-
getNumberOfDifferentValues
Description copied from interface:RelationReturns the number of values occurring at the argument positions
Used for statistics- Specified by:
getNumberOfDifferentValuesin interfaceRelation- Overrides:
getNumberOfDifferentValuesin classMixedRelation- Parameters:
argument- , argument positionvalue- , the concrete value- Returns:
- Throws:
EDBExceptionIOException
-
isEmpty
Description copied from interface:BaseRelationIs the relation empty?- Specified by:
isEmptyin interfaceBaseRelation- Overrides:
isEmptyin classMixedRelation- Returns:
- relation is empty
- Throws:
IOException
-