@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
|
distanceQuery
relation
HINT_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.
|
private D |
expandNode(O object,
KNNHeap<D> knnList,
ComparableMinHeap<GenericDistanceSearchCandidate<D>> pq,
D maxDist,
int nodeID) |
List<KNNList<D>> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
KNNList<D> |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
protected List<FCPair<D,SpatialEntry>> |
getSortedEntries(AbstractRStarTreeNode<?,?> node,
DBIDs ids)
Sorts the entries of the specified node according to their minimum distance
to the specified objects.
|
getKNNForDBID
getRelation
protected 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 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 objectsprotected List<FCPair<D,SpatialEntry>> getSortedEntries(AbstractRStarTreeNode<?,?> node, DBIDs ids)
node
- the nodeids
- the id of the objectspublic KNNList<D> getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
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 requestedprivate D expandNode(O object, KNNHeap<D> knnList, ComparableMinHeap<GenericDistanceSearchCandidate<D>> pq, D maxDist, int nodeID)
public List<KNNList<D>> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
getKNNForBulkDBIDs
in interface KNNQuery<O extends SpatialComparable,D extends Distance<D>>
getKNNForBulkDBIDs
in class AbstractDistanceKNNQuery<O extends SpatialComparable,D extends Distance<D>>
ids
- query object IDsk
- Number of neighbors requested