@Reference(authors="G. R. Hjaltason, H. Samet", title="Ranking in spatial databases", booktitle="Advances in Spatial Databases - 4th Symposium, SSD\'95", url="http://dx.doi.org/10.1007/3-540-60159-7_6") public class RStarTreeKNNQuery<O extends SpatialComparable> extends Object implements KNNQuery<O>
G. R. Hjaltason, H. Samet
Ranking in spatial databases
In: 4th Symposium on Advances in Spatial Databases, SSD'95
Modifier and Type | Class and Description |
---|---|
(package private) static class |
RStarTreeKNNQuery.DoubleDistanceEntry
Optimized double distance entry implementation.
|
Modifier and Type | Field and Description |
---|---|
protected SpatialPrimitiveDistanceFunction<? super O> |
distanceFunction
Spatial primitive distance function.
|
protected Relation<? extends O> |
relation
Relation we query.
|
protected AbstractRStarTree<?,?,?> |
tree
The index to use
|
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
Constructor and Description |
---|
RStarTreeKNNQuery(AbstractRStarTree<?,?,?> tree,
Relation<? extends O> relation,
SpatialPrimitiveDistanceFunction<? super O> distanceFunction)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
batchNN(AbstractRStarTreeNode<?,?> node,
Map<DBID,KNNHeap> knnLists)
Performs a batch knn query.
|
private double |
expandNode(O object,
KNNHeap knnList,
ComparableMinHeap<DoubleDistanceSearchCandidate> pq,
double maxDist,
int nodeID) |
List<KNNList> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
KNNList |
getKNNForDBID(DBIDRef id,
int k)
Get the k nearest neighbors for a particular id.
|
KNNList |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
protected List<RStarTreeKNNQuery.DoubleDistanceEntry> |
getSortedEntries(AbstractRStarTreeNode<?,?> node,
DBIDs ids)
Sorts the entries of the specified node according to their minimum distance
to the specified objects.
|
protected final AbstractRStarTree<?,?,?> tree
protected final SpatialPrimitiveDistanceFunction<? super O extends SpatialComparable> distanceFunction
protected Relation<? extends O extends SpatialComparable> relation
public RStarTreeKNNQuery(AbstractRStarTree<?,?,?> tree, Relation<? extends O> relation, SpatialPrimitiveDistanceFunction<? super O> distanceFunction)
tree
- Index to userelation
- Data relation to querydistanceFunction
- Distance functionpublic KNNList getKNNForDBID(DBIDRef id, int k)
KNNQuery
getKNNForDBID
in interface KNNQuery<O extends SpatialComparable>
id
- query object IDk
- Number of neighbors requestedpublic KNNList getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O extends SpatialComparable>
obj
- Query objectk
- Number of neighbors requestedprivate double expandNode(O object, KNNHeap knnList, ComparableMinHeap<DoubleDistanceSearchCandidate> pq, double maxDist, int nodeID)
protected void batchNN(AbstractRStarTreeNode<?,?> node, Map<DBID,KNNHeap> knnLists)
node
- the node for which the query should be performedknnLists
- a map containing the knn lists for each query objectsprotected List<RStarTreeKNNQuery.DoubleDistanceEntry> getSortedEntries(AbstractRStarTreeNode<?,?> node, DBIDs ids)
node
- the nodeids
- the id of the objectspublic List<KNNList> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
getKNNForBulkDBIDs
in interface KNNQuery<O extends SpatialComparable>
ids
- query object IDsk
- Number of neighbors requestedCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.