|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
O
- the type of DatabaseObject as element of the databasepublic 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. |
|
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<Pair<O,Associations>> objectsAndAssociationsList)
Initializes the database by inserting the specified objects and their associations into the database. |
|
Integer |
insert(Pair<O,Associations> 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,
List<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, collectOptions, getParameters, setParameters, shortDescription |
Method Detail |
---|
void insert(List<Pair<O,Associations>> objectsAndAssociationsList) throws UnableToComplyException
objectsAndAssociationsList
- the list of objects and their associations to be inserted
UnableToComplyException
- if initialization is not possibleInteger insert(Pair<O,Associations> 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<DistanceResultPair<D>> 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.
The query result is sorted in ascending order w.r.t. the distance to the query object.
D
- distance typeid
- the ID of the query objectepsilon
- the string representation of the query rangedistanceFunction
- the distance function that computes the distances between the
objects
<D extends Distance<D>> List<DistanceResultPair<D>> kNNQueryForID(Integer id, int k, DistanceFunction<O,D> distanceFunction)
Performs a k-nearest neighbor query for the given object ID.
The query result is sorted in ascending order w.r.t. the distance to the query object.
The general contract for the result of kNN queries in ELKI is that the resulting list contains exactly k nearest neighbors including the query object. Generally, ties will be resolved by the order of objects in the database. Any implementing method should inform about the exact policy of resolving ties.
Generally, it is assumed that the database does not contain less than k objects.
D
- distance typeid
- the ID of the query objectk
- the number of nearest neighbors to be returneddistanceFunction
- the distance function that computes the distances between the
objects
<D extends Distance<D>> List<DistanceResultPair<D>> kNNQueryForObject(O queryObject, int k, DistanceFunction<O,D> distanceFunction)
Performs a k-nearest neighbor query for the given object.
The query result is sorted in ascending order w.r.t. the distance to the query object.
The general contract for the result of kNN queries in ELKI is that the resulting list contains exactly k nearest neighbors including the query object if it is an element of this database. Generally, ties will be resolved by the order of objects in the database. Any implementing method should inform about the exact policy of resolving ties.
Generally, it is assumed that the database does not contain less than k objects.
D
- distance typequeryObject
- the query objectk
- the number of nearest neighbors to be returneddistanceFunction
- the distance function that computes the distances between the
objects
<D extends Distance<D>> List<List<DistanceResultPair<D>>> bulkKNNQueryForID(List<Integer> ids, int k, DistanceFunction<O,D> distanceFunction)
Performs k-nearest neighbor queries for the given object IDs.
The query result is sorted in ascending order w.r.t. the distance to the query object.
The general contract for the result of kNN queries in ELKI is that the resulting lists contain exactly k nearest neighbors including the query objects. Generally, ties will be resolved by the order of objects in the database. Any implementing method should inform about the exact policy of resolving ties.
Generally, it is assumed that the database does not contain less than k objects.
D
- distance typeids
- the IDs of the query objectsk
- the number of nearest neighbors to be returneddistanceFunction
- the distance function that computes the distances between the
objects
<D extends Distance<D>> List<DistanceResultPair<D>> reverseKNNQuery(Integer id, int k, DistanceFunction<O,D> distanceFunction)
Performs a reverse k-nearest neighbor query for the given object ID.
The query result is sorted in ascending order w.r.t. the distance to the query object.
Generally, it is assumed that the database does not contain less than k objects.
D
- distance typeid
- the ID of the query objectk
- the size of k-nearest neighborhood of any database object o
to contain a database object in order to include o
in the result listdistanceFunction
- the distance function that computes the distances between 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
T
- association data typeassociationID
- 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
T
- association data typeassociationID
- 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)
T
- association data typeassociationID
- 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)
T
- association data typeassociationID
- the id of the association, respectively the name of the
relation
Iterator<Integer> iterator()
iterator
in interface Iterable<Integer>
- for a Database {@code db}, this allows the construct {@code for(Integer id : db) // work with database ids }.
List<Integer> getIDs()
Map<Integer,Database<O>> partition(Map<Integer,List<Integer>> partitions, Class<? extends Database<O>> dbClass, List<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 |