de.lmu.ifi.dbs.elki.database
Interface Database

All Superinterfaces:
HierarchicalResult, Result
All Known Subinterfaces:
UpdatableDatabase
All Known Implementing Classes:
AbstractDatabase, HashmapDatabase, ProxyDatabase, StaticArrayDatabase

public interface Database
extends HierarchicalResult

Database specifies the requirements for any database implementation. Note that any implementing class is supposed to provide a constructor without parameters for dynamic instantiation.


Method Summary
 void accumulateDataStoreEvents()
          Collects all insertion, deletion and update events until 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 accumulateDataStoreEvents() has been called.
 SingleObjectBundle getBundle(DBID id)
          Returns the DatabaseObject represented by the specified id.
 StaticDBIDs getDBIDs()
          Deprecated. 
<O,D extends Distance<D>>
DistanceQuery<O,D>
getDistanceQuery(Relation<O> relation, DistanceFunction<? super O,D> distanceFunction, Object... hints)
          Get the distance query for a particular distance function.
 Collection<Index> getIndexes()
          Collection of known indexes
<O,D extends Distance<D>>
KNNQuery<O,D>
getKNNQuery(DistanceQuery<O,D> distanceQuery, Object... hints)
          Get a KNN query object for the given distance query.
<O,D extends Distance<D>>
RangeQuery<O,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>>
RKNNQuery<O,D>
getRKNNQuery(DistanceQuery<O,D> distanceQuery, Object... hints)
          Get a rKNN query object for the given distance query.
<O,D extends Distance<D>>
SimilarityQuery<O,D>
getSimilarityQuery(Relation<O> relation, SimilarityFunction<? super O,D> similarityFunction, Object... hints)
          Get the similarity query for a particular similarity function.
 void initialize()
          Initialize the database, for example by loading the input data.
 void removeDataStoreListener(DataStoreListener l)
          Removes a listener previously added with addDataStoreListener(DataStoreListener).
 void removeIndex(Index index)
          Remove a particular index
 int size()
          Deprecated. 
 
Methods inherited from interface de.lmu.ifi.dbs.elki.result.HierarchicalResult
getHierarchy, setHierarchy
 
Methods inherited from interface de.lmu.ifi.dbs.elki.result.Result
getLongName, getShortName
 

Method Detail

initialize

void initialize()
Initialize the database, for example by loading the input data. (Since this should NOT be done on construction time!)


size

@Deprecated
int size()
Deprecated. 

Returns the number of objects contained in this Database.

Returns:
the number of objects in this Database

getRelations

Collection<Relation<?>> getRelations()
Get all relations of a database.

Returns:
All relations in the database

getRelation

<O> Relation<O> getRelation(TypeInformation restriction,
                            Object... hints)
                        throws NoSupportedDataTypeException
Get an object representation.

Type Parameters:
O - Object type
Parameters:
restriction - Type restriction
hints - Optimizer hints
Returns:
representation
Throws:
NoSupportedDataTypeException

getDistanceQuery

<O,D extends Distance<D>> DistanceQuery<O,D> getDistanceQuery(Relation<O> relation,
                                                              DistanceFunction<? super O,D> distanceFunction,
                                                              Object... hints)
Get the distance query for a particular distance function.

Type Parameters:
O - Object type
D - Distance result type
Parameters:
relation - Relation used
distanceFunction - Distance function to use
hints - Optimizer hints
Returns:
Instance to query the database with this distance

getSimilarityQuery

<O,D extends Distance<D>> SimilarityQuery<O,D> getSimilarityQuery(Relation<O> relation,
                                                                  SimilarityFunction<? super O,D> similarityFunction,
                                                                  Object... hints)
Get the similarity query for a particular similarity function.

Type Parameters:
O - Object type
D - Similarity result type
Parameters:
relation - Relation used
similarityFunction - Similarity function to use
hints - Optimizer hints
Returns:
Instance to query the database with this similarity

getKNNQuery

<O,D extends Distance<D>> KNNQuery<O,D> getKNNQuery(DistanceQuery<O,D> distanceQuery,
                                                    Object... hints)
Get a KNN query object for the given distance query. When possible, this will use an index, but it may default to an expensive linear scan. Hints include:

Type Parameters:
O - Object type
D - Distance type
Parameters:
distanceQuery - Distance query
hints - Optimizer hints
Returns:
KNN Query object

getRangeQuery

<O,D extends Distance<D>> RangeQuery<O,D> getRangeQuery(DistanceQuery<O,D> distanceQuery,
                                                        Object... hints)
Get a range query object for the given distance query. When possible, this will use an index, but it may default to an expensive linear scan. Hints include:

Type Parameters:
O - Object type
D - Distance type
Parameters:
distanceQuery - Distance query
hints - Optimizer hints
Returns:
KNN Query object

getRKNNQuery

<O,D extends Distance<D>> RKNNQuery<O,D> getRKNNQuery(DistanceQuery<O,D> distanceQuery,
                                                      Object... hints)
Get a rKNN query object for the given distance query. When possible, this will use an index, but it may default to an expensive linear scan. Hints include:

Type Parameters:
O - Object type
D - Distance type
Parameters:
distanceQuery - Distance query
hints - Optimizer hints
Returns:
KNN Query object

getBundle

SingleObjectBundle getBundle(DBID id)
Returns the DatabaseObject represented by the specified id.

Parameters:
id - the id of the Object to be obtained from the Database
Returns:
Bundle containing the objects' data

getDBIDs

@Deprecated
StaticDBIDs getDBIDs()
Deprecated. 

Returns a list comprising all IDs currently in use. The list returned shall not be linked to any actual list possibly hold in the database implementation.

Returns:
a list comprising all IDs currently in use

addIndex

void addIndex(Index index)
Add a new index to the database.

Parameters:
index - Index to add

getIndexes

Collection<Index> getIndexes()
Collection of known indexes


removeIndex

void removeIndex(Index index)
Remove a particular index

Parameters:
index - Index to remove

addDataStoreListener

void addDataStoreListener(DataStoreListener l)
Adds a listener for the DataStoreEvent posted after the content of the database changes.

Parameters:
l - the listener to add
See Also:
removeDataStoreListener(DataStoreListener), DataStoreListener, DataStoreEvent

removeDataStoreListener

void removeDataStoreListener(DataStoreListener l)
Removes a listener previously added with addDataStoreListener(DataStoreListener).

Parameters:
l - the listener to remove
See Also:
addDataStoreListener(DataStoreListener), DataStoreListener, DataStoreEvent

accumulateDataStoreEvents

void accumulateDataStoreEvents()
Collects all insertion, deletion and update events until flushDataStoreEvents() is called.

See Also:
DataStoreEvent

flushDataStoreEvents

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 accumulateDataStoreEvents() has been called.

See Also:
DataStoreListener, DataStoreEvent

Release 0.4.0 (2011-09-20_1324)