
@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 GenericRStarTreeKNNQuery<O extends SpatialComparable,D extends Distance<D>> extends AbstractDistanceKNNQuery<O,D>
G. R. Hjaltason, H. Samet
Ranking in spatial databases
In: 4th Symposium on Advances in Spatial Databases, SSD'95
| Modifier and Type | Field and Description |
|---|---|
protected SpatialPrimitiveDistanceFunction<? super O,D> |
distanceFunction
Spatial primitive distance function
|
protected AbstractRStarTree<?,?> |
tree
The index to use
|
distanceQueryrelationHINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE| Constructor and Description |
|---|
GenericRStarTreeKNNQuery(AbstractRStarTree<?,?> tree,
SpatialDistanceQuery<O,D> distanceQuery)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
batchNN(AbstractRStarTreeNode<?,?> node,
Map<DBID,KNNHeap<D>> knnLists)
Performs a batch knn query.
|
protected void |
doKNNQuery(O object,
KNNHeap<D> knnList)
Performs a k-nearest neighbor query for the given NumberVector with the
given parameter k and the according distance function.
|
private D |
expandNode(O object,
KNNHeap<D> knnList,
Heap<GenericDistanceSearchCandidate<D>> pq,
D maxDist,
Integer nodeID) |
List<KNNResult<D>> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
void |
getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
Bulk query method configured by a map.
|
KNNResult<D> |
getKNNForDBID(DBIDRef id,
int k)
Get the k nearest neighbors for a particular id.
|
KNNResult<D> |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
protected List<DistanceEntry<D,SpatialEntry>> |
getSortedEntries(AbstractRStarTreeNode<?,?> node,
DBIDs ids)
Sorts the entries of the specified node according to their minimum distance
to the specified objects.
|
getRelationprotected final AbstractRStarTree<?,?> tree
protected final SpatialPrimitiveDistanceFunction<? super O extends SpatialComparable,D extends Distance<D>> distanceFunction
public GenericRStarTreeKNNQuery(AbstractRStarTree<?,?> tree, SpatialDistanceQuery<O,D> distanceQuery)
tree - Index to usedistanceQuery - Distance query to useprotected void doKNNQuery(O object, KNNHeap<D> knnList)
object - the query objectknnList - the knn list containing the resultprivate D expandNode(O object, KNNHeap<D> knnList, Heap<GenericDistanceSearchCandidate<D>> pq, D maxDist, Integer nodeID)
protected void batchNN(AbstractRStarTreeNode<?,?> node, Map<DBID,KNNHeap<D>> knnLists)
node - the node for which the query should be performedknnLists - a map containing the knn lists for each query objectspublic void getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
KNNQueryheaps - Map of heaps to fill.protected List<DistanceEntry<D,SpatialEntry>> getSortedEntries(AbstractRStarTreeNode<?,?> node, DBIDs ids)
node - the nodeids - the id of the objectspublic KNNResult<D> getKNNForObject(O obj, int k)
KNNQuerygetKNNForObject in interface KNNQuery<O extends SpatialComparable,D extends Distance<D>>getKNNForObject in class AbstractDistanceKNNQuery<O extends SpatialComparable,D extends Distance<D>>obj - Query objectk - Number of neighbors requestedpublic KNNResult<D> getKNNForDBID(DBIDRef id, int k)
KNNQuerygetKNNForDBID in interface KNNQuery<O extends SpatialComparable,D extends Distance<D>>getKNNForDBID in class AbstractDistanceKNNQuery<O extends SpatialComparable,D extends Distance<D>>id - query object IDk - Number of neighbors requestedpublic List<KNNResult<D>> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQueryids - query object IDsk - Number of neighbors requested