|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Database<O extends DatabaseObject>
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 |
addDatabaseListener(DatabaseListener l)
Adds a listener for the DatabaseEvent
posted after the database changes. |
|
|
associate(AssociationID<T> associationID,
Integer objectID,
T association)
Associates a association in a certain relation to a certain Object. |
|
|
associateGlobally(AssociationID<T> associationID,
T association)
Associates a global association in a certain relation to the database. |
|
|
bulkKNNQueryForID(List<Integer> ids,
int k,
DistanceFunction<O,D> distanceFunction)
Performs k-nearest neighbor queries for the given object IDs. |
|
O |
delete(Integer id)
Removes and returns the object with the given id from the database. |
|
void |
delete(O object)
Removes all objects from the database that are equal to the given object. |
|
String |
description()
Returns a short description of the database. |
|
int |
dimensionality()
Returns the dimensionality of the data contained by this database in case of O extends FeatureVector . |
|
O |
get(Integer id)
Returns the DatabaseObject represented by the specified id. |
|
|
getAssociation(AssociationID<T> associationID,
Integer objectID)
Returns the association specified by the given associationID and related to the specified Object. |
|
Associations |
getAssociations(Integer id)
Returns all associations for a given ID. |
|
|
getGlobalAssociation(AssociationID<T> associationID)
Returns the global association specified by the given associationID. |
|
List<Integer> |
getIDs()
Returns a list comprising all IDs currently in use. |
|
void |
insert(List<ObjectAndAssociations<O>> objectsAndAssociationsList)
Initializes the database by inserting the specified objects and their associations into the database. |
|
Integer |
insert(ObjectAndAssociations<O> objectAndAssociations)
Inserts the given object into the database. |
|
boolean |
isSet(AssociationID<?> associationID)
Checks whether an association is set for at least one id in the database. |
|
boolean |
isSetForAllObjects(AssociationID<?> associationID)
Checks whether an association is set for every id in the database. |
|
boolean |
isSetGlobally(AssociationID<?> associationID)
Checks whether a global association is set in the database. |
|
Iterator<Integer> |
iterator()
Returns an iterator iterating over all keys of the database. |
|
|
kNNQueryForID(Integer id,
int k,
DistanceFunction<O,D> distanceFunction)
Performs a k-nearest neighbor query for the given object ID. |
|
|
kNNQueryForObject(O queryObject,
int k,
DistanceFunction<O,D> distanceFunction)
Performs a k-nearest neighbor query for the given object. |
|
Map<Integer,Database<O>> |
partition(Map<Integer,List<Integer>> partitions)
Returns a Map of partition IDs to Databases according to the specified Map of partition IDs to Lists of IDs. |
|
Map<Integer,Database<O>> |
partition(Map<Integer,List<Integer>> partitions,
Class<? extends Database<O>> dbClass,
String[] dbParameters)
Returns a Map of partition IDs to Databases of the specified class according to the specified Map of partition IDs to Lists of IDs. |
|
Set<Integer> |
randomSample(int k,
long seed)
Returns a random sample of k ids. |
|
|
rangeQuery(Integer id,
String epsilon,
DistanceFunction<O,D> distanceFunction)
Performs a range query for the given object ID with the given epsilon range and the according distance function. |
|
void |
removeDatabaseListener(DatabaseListener l)
Removes a listener previously added with addTreeModelListener . |
|
|
reverseKNNQuery(Integer id,
int k,
DistanceFunction<O,D> distanceFunction)
Performs a reverse k-nearest neighbor query for the given object ID. |
|
int |
size()
Returns the number of objects contained in this Database. |
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable |
---|
checkGlobalParameterConstraints, getAttributeSettings, getParameters, getPossibleOptions, inlineDescription, setParameters |
Method Detail |
---|
void insert(List<ObjectAndAssociations<O>> objectsAndAssociationsList) throws UnableToComplyException
objectsAndAssociationsList
- the list of objects and their associations to be inserted
UnableToComplyException
- if initialization is not possibleInteger insert(ObjectAndAssociations<O> objectAndAssociations) throws UnableToComplyException
objectAndAssociations
- the object and its associations to be inserted
UnableToComplyException
- if insertion is not possiblevoid delete(O object)
object
- the object to be removed from databaseO delete(Integer id)
id
- the id of an object to be removed from the database
int size()
Set<Integer> randomSample(int k, long seed)
k
- the number of ids to returnseed
- for random generator
<D extends Distance<D>> List<QueryResult<D>> rangeQuery(Integer id, String epsilon, DistanceFunction<O,D> distanceFunction)
id
- the ID of the query objectepsilon
- the string representation of the query rangedistanceFunction
- the distance function that computes the distances beween the
objects
<D extends Distance<D>> List<QueryResult<D>> kNNQueryForID(Integer id, int k, DistanceFunction<O,D> distanceFunction)
id
- the ID of the query objectk
- the number of nearest neighbors to be returneddistanceFunction
- the distance function that computes the distances beween the
objects
<D extends Distance<D>> List<QueryResult<D>> kNNQueryForObject(O queryObject, int k, DistanceFunction<O,D> distanceFunction)
queryObject
- the query objectk
- the number of nearest neighbors to be returneddistanceFunction
- the distance function that computes the distances beween the
objects
<D extends Distance<D>> List<List<QueryResult<D>>> bulkKNNQueryForID(List<Integer> ids, int k, DistanceFunction<O,D> distanceFunction)
ids
- the IDs of the query objectsk
- the number of nearest neighbors to be returneddistanceFunction
- the distance function that computes the distances beween the
objects
<D extends Distance<D>> List<QueryResult<D>> reverseKNNQuery(Integer id, int k, DistanceFunction<O,D> distanceFunction)
id
- the ID of the query objectk
- the number of nearest neighbors to be returneddistanceFunction
- the distance function that computes the distances beween the
objects
O get(Integer id)
id
- the id of the Object to be obtained from the Database
<T> void associate(AssociationID<T> associationID, Integer objectID, T association) throws ClassCastException
associationID
- the id of the association, respectively the name of the
relationobjectID
- the id of the Object to which the association is relatedassociation
- the association to be associated with the specified Object
ClassCastException
- if the association cannot be cast as the class that is specified by the associationID<T> void associateGlobally(AssociationID<T> associationID, T association) throws ClassCastException
associationID
- the id of the association, respectively the name of the
relationassociation
- the association to be associated with the database
ClassCastException
- if the association cannot be cast as the class that is specified by the associationIDAssociations getAssociations(Integer id)
id
- the id for which the associations are to be returned
<T> T getAssociation(AssociationID<T> associationID, Integer objectID)
associationID
- the id of the association, respectively the name of the
relationobjectID
- the id of the Object to which the association is related
<T> T getGlobalAssociation(AssociationID<T> associationID)
associationID
- the id of the association, respectively the name of the
relation
Iterator<Integer> iterator()
List<Integer> getIDs()
String description()
description
in interface Parameterizable
Map<Integer,Database<O>> partition(Map<Integer,List<Integer>> partitions, Class<? extends Database<O>> dbClass, String[] dbParameters) throws UnableToComplyException
partitions
- a Map of partition IDs to Lists of IDs defining a partition of the databasedbClass
- the class of the databases to be returned, if this argument is null
the returned databases have the same class as this databasedbParameters
- the parameter array of the returned database class, only necessary if parameter
dbClass
is not null
UnableToComplyException
- in case of problems during insertion or class instantiationMap<Integer,Database<O>> partition(Map<Integer,List<Integer>> partitions) throws UnableToComplyException
partition(partitions, null, null)
.
partitions
- a Map of partition IDs to Lists of IDs defining a partition of the database
UnableToComplyException
- in case of problems during insertionboolean isSetForAllObjects(AssociationID<?> associationID)
associationID
- an association id to be checked
boolean isSet(AssociationID<?> associationID)
associationID
- an association id to be checked
boolean isSetGlobally(AssociationID<?> associationID)
associationID
- an association id to be checked
int dimensionality() throws UnsupportedOperationException
O
extends FeatureVector
.
UnsupportedOperationException
- if O
does not extend FeatureVector
or the database is emptyvoid addDatabaseListener(DatabaseListener l)
DatabaseEvent
posted after the database changes.
l
- the listener to addremoveDatabaseListener(de.lmu.ifi.dbs.elki.database.DatabaseListener)
void removeDatabaseListener(DatabaseListener l)
addTreeModelListener
.
l
- the listener to removeaddDatabaseListener(de.lmu.ifi.dbs.elki.database.DatabaseListener)
|
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |