semantique.processor.core.QueryProcessor#
- class semantique.processor.core.QueryProcessor(recipe, datacube, mapping, extent, custom_verbs=None, custom_operators=None, custom_reducers=None, track_types=True, preview=False, cache=None)[source]#
Worker that takes care of processing a semantic query.
- Parameters:
recipe (
QueryRecipe
) – The query recipe to be processed.datacube (
Datacube
) – The datacube instance to process the query against.mapping (
Mapping
) – The mapping instance to process the query against.extent (
xarray.DataArray
) – The spatio-temporal extent in which the query should be processed. Should be given as an array with a temporal dimension and two spatial dimensions such as returned byparse_extent
.custom_verbs (
dict
, optional) – User-defined verbs that may be used when executing the query recipe in addition to the built-in verbs in semantique.custom_operators (
dict
, optional) – User-defined operator functions that may be used when evaluating expressions with the evaluate verb in addition to the built-in operators in semantique. Built-in operators with the same name will be overwritten.custom_reducers (
dict
, optional) – User-defined reducer functions that may be used when reducing array dimensions with the reduce verb in addition to the built-in reducers in semantique. Built-in reducers with the same name will be overwritten.track_types (
bool
) – Should the query processor keep track of the value type of arrays when applying processes, and promote them if necessary? Keeping track of value types also means throwing errors whenever a value type is not supported by a specific process.preview (
bool
) – Run the query processor with reduced resolution to test the recipe execution. Preview-runs are necessary if cache should be used.cache (
Cache
) – The cache object that is used to store data layers.
- __init__(recipe, datacube, mapping, extent, custom_verbs=None, custom_operators=None, custom_reducers=None, track_types=True, preview=False, cache=None)[source]#
Methods
__init__
(recipe, datacube, mapping, extent)add_custom_operator
(name, function)Add a new operator to the set of user-defined operators.
add_custom_reducer
(name, function)Add a new reducer to the set of user-defined reducers.
add_custom_verb
(name, function)Add a new verb to the set of user-defined verbs.
call_handler
(block[, key])Call the handler for a specific building block.
call_verb
(name, params)Apply a verb to the active evaluation object.
execute
()Execute a semantic query.
get_operator
(name)Obtain a supported operator function.
get_reducer
(name)Obtain a supported reducer function.
handle_apply_custom
(block)Handler for the apply_custom verb.
handle_assign
(block)Handler for the assign verb.
handle_collection
(block)Handler for collection references.
handle_compose
(block)Handler for the compose verb.
handle_concatenate
(block)Handler for the concatenate verb.
handle_concept
(block)Handler for semantic concept references.
handle_delineate
(block)Handler for the delineate verb.
handle_evaluate
(block)Handler for the evaluate verb.
handle_extract
(block)Handler for the extract verb.
handle_fill
(block)Handler for the fill verb.
handle_filter
(block)Handler for the filter verb.
handle_geometry
(block)Handler for spatial vector geometries.
handle_groupby
(block)Handler for the groupby verb.
handle_interval
(block)Handler for value intervals.
handle_label
(block)Handler for value labels.
handle_layer
(block)Handler for data layer references.
handle_merge
(block)Handler for the merge verb.
handle_name
(block)Handler for the name verb.
handle_processing_chain
(block)Handler for processing chains.
handle_reduce
(block)Handler for the reduce verb.
handle_result
(block)Handler for result references.
handle_self
(block)Handler for self references.
handle_set
(block)Handler for value sets.
handle_shift
(block)Handler for the shift verb.
handle_smooth
(block)Handler for the smooth verb.
handle_time_instant
(block)Handler for time instants.
handle_time_interval
(block)Handler for time intervals.
handle_trim
(block)Handler for the trim verb.
handle_verb
(block)Handler for verbs.
optimize
()Optimize a semantic query.
parse
(recipe, datacube, mapping, space, ...)Parse a semantic query.
Attributes
Cache of data layers for the query execution.
Spatial coordinate reference system in which the query should be processed.
User-defined operator functions for the evaluate verb.
User-defined reducer functions for the reduce verb.
User-defined verbs for query execution.
The datacube instance to process the query against.
The spatio-temporal extent in which the query should be processed.
The mapping instance to process the query against.
Is the query being processed in preview mode.
The query recipe to be processed.
Response of semantic query execution.
Spatial resolution in which the query should be processed.
Does the processor keep track of value types.
Time zone in which the query should be processed.