public abstract class AbstractDatabase extends AbstractHierarchicalResult implements Database
Modifier and Type | Field and Description |
---|---|
protected DatabaseEventManager |
eventManager
The event manager, collects events and fires them on demand.
|
static OptionID |
INDEX_ID
Parameter to specify the indexes to use.
|
protected List<Index> |
indexes
Indexes.
|
protected Collection<IndexFactory<?,?>> |
indexFactories
Index factories.
|
protected List<Relation<?>> |
relations
The relations we manage.
|
Constructor and Description |
---|
AbstractDatabase()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
accumulateDataStoreEvents()
Collects all insertion, deletion and update events until
Database.flushDataStoreEvents() is called. |
void |
addDataStoreListener(DataStoreListener l)
Adds a listener for the
DataStoreEvent posted after the
content of the database changes. |
void |
addIndex(Index index)
Add a new index to the database.
|
void |
flushDataStoreEvents()
Fires all collected insertion, deletion and update events as one
DataStoreEvent, i.e. notifies all registered DataStoreListener how the
content of the database has been changed since
Database.accumulateDataStoreEvents() has been called. |
SingleObjectBundle |
getBundle(DBIDRef id)
Returns the DatabaseObject represented by the specified id.
|
<O,D extends Distance<D>> |
getDistanceQuery(Relation<O> objQuery,
DistanceFunction<? super O,D> distanceFunction,
Object... hints)
Get the distance query for a particular distance function.
|
List<Index> |
getIndexes()
Collection of known indexes
|
<O,D extends Distance<D>> |
getKNNQuery(DistanceQuery<O,D> distanceQuery,
Object... hints)
Get a KNN query object for the given distance query.
|
protected abstract Logging |
getLogger() |
String |
getLongName()
A "pretty" name for the result, for use in titles, captions and menus.
|
<O,D extends Distance<D>> |
getRangeQuery(DistanceQuery<O,D> distanceQuery,
Object... hints)
Get a range query object for the given distance query.
|
<O> Relation<O> |
getRelation(TypeInformation restriction,
Object... hints)
Get an object representation.
|
Collection<Relation<?>> |
getRelations()
Get all relations of a database.
|
<O,D extends Distance<D>> |
getRKNNQuery(DistanceQuery<O,D> distanceQuery,
Object... hints)
Get a rKNN query object for the given distance query.
|
String |
getShortName()
A short name for the result, useful for file names.
|
<O,D extends Distance<D>> |
getSimilarityQuery(Relation<O> objQuery,
SimilarityFunction<? super O,D> similarityFunction,
Object... hints)
Get the similarity query for a particular similarity function.
|
void |
removeDataStoreListener(DataStoreListener l)
Removes a listener previously added with
Database.addDataStoreListener(DataStoreListener) . |
void |
removeIndex(Index index)
Remove a particular index
|
addChildResult, getHierarchy, setHierarchy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize
getHierarchy, setHierarchy
public static final OptionID INDEX_ID
Key: -db.index
protected final DatabaseEventManager eventManager
protected final Collection<IndexFactory<?,?>> indexFactories
public void addIndex(Index index)
Database
public List<Index> getIndexes()
Database
getIndexes
in interface Database
public void removeIndex(Index index)
Database
removeIndex
in interface Database
index
- Index to removepublic SingleObjectBundle getBundle(DBIDRef id)
Database
public Collection<Relation<?>> getRelations()
Database
getRelations
in interface Database
public <O> Relation<O> getRelation(TypeInformation restriction, Object... hints) throws NoSupportedDataTypeException
Database
getRelation
in interface Database
O
- Object typerestriction
- Type restrictionhints
- Optimizer hintsNoSupportedDataTypeException
public <O,D extends Distance<D>> DistanceQuery<O,D> getDistanceQuery(Relation<O> objQuery, DistanceFunction<? super O,D> distanceFunction, Object... hints)
Database
getDistanceQuery
in interface Database
O
- Object typeD
- Distance result typeobjQuery
- Relation useddistanceFunction
- Distance function to usehints
- Optimizer hintspublic <O,D extends Distance<D>> SimilarityQuery<O,D> getSimilarityQuery(Relation<O> objQuery, SimilarityFunction<? super O,D> similarityFunction, Object... hints)
Database
getSimilarityQuery
in interface Database
O
- Object typeD
- Similarity result typeobjQuery
- Relation usedsimilarityFunction
- Similarity function to usehints
- Optimizer hintspublic <O,D extends Distance<D>> KNNQuery<O,D> getKNNQuery(DistanceQuery<O,D> distanceQuery, Object... hints)
Database
DatabaseQuery.HINT_BULK
bulk
query neededgetKNNQuery
in interface Database
O
- Object typeD
- Distance typedistanceQuery
- Distance queryhints
- Optimizer hintspublic <O,D extends Distance<D>> RangeQuery<O,D> getRangeQuery(DistanceQuery<O,D> distanceQuery, Object... hints)
Database
DatabaseQuery.HINT_BULK
bulk
query neededgetRangeQuery
in interface Database
O
- Object typeD
- Distance typedistanceQuery
- Distance queryhints
- Optimizer hintspublic <O,D extends Distance<D>> RKNNQuery<O,D> getRKNNQuery(DistanceQuery<O,D> distanceQuery, Object... hints)
Database
DatabaseQuery.HINT_BULK
bulk
query neededgetRKNNQuery
in interface Database
O
- Object typeD
- Distance typedistanceQuery
- Distance queryhints
- Optimizer hintspublic void addDataStoreListener(DataStoreListener l)
Database
DataStoreEvent
posted after the
content of the database changes.addDataStoreListener
in interface Database
l
- the listener to addDatabase.removeDataStoreListener(DataStoreListener)
,
DataStoreListener
,
DataStoreEvent
public void removeDataStoreListener(DataStoreListener l)
Database
Database.addDataStoreListener(DataStoreListener)
.removeDataStoreListener
in interface Database
l
- the listener to removeDatabase.addDataStoreListener(DataStoreListener)
,
DataStoreListener
,
DataStoreEvent
public void accumulateDataStoreEvents()
Database
Database.flushDataStoreEvents()
is called.accumulateDataStoreEvents
in interface Database
DataStoreEvent
public void flushDataStoreEvents()
Database
Database.accumulateDataStoreEvents()
has been called.flushDataStoreEvents
in interface Database
DataStoreListener
,
DataStoreEvent
public String getLongName()
Result
getLongName
in interface Result
public String getShortName()
Result
getShortName
in interface Result
protected abstract Logging getLogger()