Class DataServiceBBoxCache<C,T>
java.lang.Object
org.aksw.jena_sparql_api.sparql.ext.geosparql.DataServiceBBoxCache<C,T>
Adds a quad tree cache to the lookup service.
If there are only few items, then the 'global' workflow fetches them all.
The 'tiled' workflow starts from the current viewport.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected CompletableFuture<Boolean>Future whether there are few enough items to fetch them all at onceprotected io.reactivex.rxjava3.core.Single<Boolean>protected longprotected longprotected LooseQuadTree<T>protected Map<Object,io.reactivex.rxjava3.core.Single<QuadTreeNode<T>>> -
Constructor Summary
ConstructorsConstructorDescriptionDataServiceBBoxCache(org.aksw.commons.rx.lookup.MapService<org.locationtech.jts.geom.Envelope, T, T> listServiceBBox, long maxGlobalItemCount, long maxItemsPerTileCount, int acquireDepth) -
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Single<QuadTreeNode<T>>createCountTask(QuadTreeNode<T> node) For a given node, this method returns a single that upon completion has the item count setio.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.Resource>fetchData(org.locationtech.jts.geom.Envelope bounds) finalizeLoading(Collection<QuadTreeNode<T>> leafNodes) TODO tryMergeNode is not yet implemented! This method checks whether there are leafNodes that can be merged into their parents.booleanisCountingNeeded(QuadTreeNode<T> node) If either the minimum number of items in the node is above the threshold or all children have been counted, then there is NO need for countingbooleanisTooManyGeoms(QuadTreeNode<T> node) voidloadTaskAction(QuadTreeNode<T> node, Map<T, T> items) Sets the node's state to loaded, attaches the geomToFeatureCount to it.protected voidSets checkedGlobalCount to a fresh cold single that upon subscription counts itemsio.reactivex.rxjava3.core.Single<QuadTreeNode<T>>runGlobalWorkflow(QuadTreeNode<T> node) io.reactivex.rxjava3.core.Flowable<QuadTreeNode<T>>runTiledWorkflow(org.locationtech.jts.geom.Envelope bounds) This method implements the primary workflow for tile-based fetching data.io.reactivex.rxjava3.core.Flowable<QuadTreeNode<T>>runWorkflow(org.locationtech.jts.geom.Envelope bounds) booleantryMergeNode(QuadTreeNode<T> node) If all child nodes are loaded and the num of all items is less than the threshold then copy all items to this node and remove the children.
-
Field Details
-
listServiceBBox
-
quadTree
-
checkedGlobalCount
-
maxGlobalItemCount
protected long maxGlobalItemCount -
maxItemsPerTileCount
protected long maxItemsPerTileCount -
acquireDepth
protected int acquireDepth -
runningTasks
-
checkedFetchAllAtOnce
Future whether there are few enough items to fetch them all at once
-
-
Constructor Details
-
DataServiceBBoxCache
-
-
Method Details
-
resetGlobalCount
protected void resetGlobalCount()Sets checkedGlobalCount to a fresh cold single that upon subscription counts items -
fetchData
public io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.Resource> fetchData(org.locationtech.jts.geom.Envelope bounds) -
runWorkflow
public io.reactivex.rxjava3.core.Flowable<QuadTreeNode<T>> runWorkflow(org.locationtech.jts.geom.Envelope bounds) -
runGlobalWorkflow
-
runTiledWorkflow
public io.reactivex.rxjava3.core.Flowable<QuadTreeNode<T>> runTiledWorkflow(org.locationtech.jts.geom.Envelope bounds) This method implements the primary workflow for tile-based fetching data. globalGeomCount = number of geoms - facets enabled, bounds disabled. if(globalGeomCount > threshold) { nodes = aquire nodes. foreach(node in nodes) { fetchGeomCount in the node - facets TODO enabled or disabled? nonFullNodes = nodes where geomCount < threshold foreach(node in nonFullNodes) { fetch geomToFeatureCount - facets enabled fetch all positions of geometries in that area -- Optionally: fetchGeomToFeatureCount - facets disabled - this can be cached per type of interest!! } } } -
createCountTask
For a given node, this method returns a single that upon completion has the item count set -
isCountingNeeded
If either the minimum number of items in the node is above the threshold or all children have been counted, then there is NO need for counting -
isTooManyGeoms
-
loadTaskAction
Sets the node's state to loaded, attaches the geomToFeatureCount to it. -
finalizeLoading
TODO tryMergeNode is not yet implemented! This method checks whether there are leafNodes that can be merged into their parents. The collection passed as the argument is left unchanged, however the nodes in it may become detached. -
tryMergeNode
If all child nodes are loaded and the num of all items is less than the threshold then copy all items to this node and remove the children.
-