@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 DoubleDistanceRStarTreeKNNQuery<O extends SpatialComparable> extends AbstractDistanceKNNQuery<O,DoubleDistance>
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) class |
DoubleDistanceRStarTreeKNNQuery.DoubleDistanceEntry
Optimized double distance entry implementation.
|
Modifier and Type | Field and Description |
---|---|
protected SpatialPrimitiveDoubleDistanceFunction<? super O> |
distanceFunction
Spatial primitive distance function
|
protected AbstractRStarTree<?,?> |
tree
The index to use
|
distanceQuery
relation
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
Constructor and Description |
---|
DoubleDistanceRStarTreeKNNQuery(AbstractRStarTree<?,?> tree,
DistanceQuery<O,DoubleDistance> distanceQuery,
SpatialPrimitiveDoubleDistanceFunction<? super O> distanceFunction)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
batchNN(AbstractRStarTreeNode<?,?> node,
Map<DBID,DoubleDistanceKNNHeap> knnLists)
Performs a batch knn query.
|
protected void |
doKNNQuery(O object,
DoubleDistanceKNNHeap knnList)
Performs a k-nearest neighbor query for the given NumberVector with the
given parameter k and the according distance function.
|
private double |
expandNode(O object,
DoubleDistanceKNNHeap knnList,
Heap<DoubleDistanceSearchCandidate> pq,
double maxDist,
int nodeID) |
List<DoubleDistanceKNNList> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
DoubleDistanceKNNList |
getKNNForDBID(DBIDRef id,
int k)
Get the k nearest neighbors for a particular id.
|
DoubleDistanceKNNList |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
protected List<DoubleDistanceRStarTreeKNNQuery.DoubleDistanceEntry> |
getSortedEntries(AbstractRStarTreeNode<?,?> node,
DBIDs ids)
Sorts the entries of the specified node according to their minimum distance
to the specified objects.
|
getRelation
protected final AbstractRStarTree<?,?> tree
protected final SpatialPrimitiveDoubleDistanceFunction<? super O extends SpatialComparable> distanceFunction
public DoubleDistanceRStarTreeKNNQuery(AbstractRStarTree<?,?> tree, DistanceQuery<O,DoubleDistance> distanceQuery, SpatialPrimitiveDoubleDistanceFunction<? super O> distanceFunction)
tree
- Index to usedistanceQuery
- Distance query to usedistanceFunction
- Distance functionprotected void doKNNQuery(O object, DoubleDistanceKNNHeap knnList)
object
- the query objectknnList
- the knn list containing the resultprivate double expandNode(O object, DoubleDistanceKNNHeap knnList, Heap<DoubleDistanceSearchCandidate> pq, double maxDist, int nodeID)
protected void batchNN(AbstractRStarTreeNode<?,?> node, Map<DBID,DoubleDistanceKNNHeap> knnLists)
node
- the node for which the query should be performedknnLists
- a map containing the knn lists for each query objectsprotected List<DoubleDistanceRStarTreeKNNQuery.DoubleDistanceEntry> getSortedEntries(AbstractRStarTreeNode<?,?> node, DBIDs ids)
node
- the nodeids
- the id of the objectspublic DoubleDistanceKNNList getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O extends SpatialComparable,DoubleDistance>
getKNNForObject
in class AbstractDistanceKNNQuery<O extends SpatialComparable,DoubleDistance>
obj
- Query objectk
- Number of neighbors requestedpublic DoubleDistanceKNNList getKNNForDBID(DBIDRef id, int k)
KNNQuery
getKNNForDBID
in interface KNNQuery<O extends SpatialComparable,DoubleDistance>
getKNNForDBID
in class AbstractDistanceKNNQuery<O extends SpatialComparable,DoubleDistance>
id
- query object IDk
- Number of neighbors requestedpublic List<DoubleDistanceKNNList> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
ids
- query object IDsk
- Number of neighbors requested