Home · All Classes · Functions · Building · Tuning 

QeQuery Class Reference

Store the description of a query, including constraints, aggreagation and grouping. More...

#include <QeQuery.hpp>

List of all members.

Classes

struct  AggregateOption
 Contain the parameters defining a aggregate strategy for one field. More...
struct  GroupingOption
 Contain the parameters defining a grouping strategy for one field. More...

Public Types

enum  GroupingOperation {
  GROUP_ALL, EQUAL, MULTI_EQUAL, SPATIAL_SIMPLE_OVERLAP,
  SPATIAL_FASTMATCH_BOUNDINGCAP, INVALID_GROUPING_OPERATION
}
enum  AggregateOperation {
  VALUE_ONE, VALUE_ALL, COUNT, VALUE_AND_COUNT,
  MULTIVALUE_AND_COUNT, VALUE_N, NUMBER_SUM, NUMBER_HISTOGRAM,
  NUMBER_MINMAX, NUMBER_MAP_SUM, SPATIAL_UNION, SPATIAL_INTERSECTION,
  SPATIAL_BALKANIZATION, SPATIAL_UNION_AREA, SPATIAL_BOUNDINGCAP_ONE, INVALID_OPERATION
}

Public Member Functions

bool operator== (const QeQuery &other) const
QString toJson () const

Static Public Member Functions

static QMap
< QeQuery::GroupingOperation,
QByteArray > 
initGroupingOperationToStringMap ()
static QByteArray groupingOperationToString (GroupingOperation)
static GroupingOperation stringToGroupingOperation (const QByteArray &)
static QMap
< QeQuery::AggregateOperation,
QByteArray > 
initAggregateOperationToStringMap ()
static QByteArray aggregateOperationToString (AggregateOperation)
static AggregateOperation stringToAggregateOperation (const QByteArray &)
static QeQuery fromJson (const QString &json)
static QVariantList groupedQueryResultToJson (const QList< QVariantList > &rows)

Public Attributes

ConstraintsSet constraints
QList< AggregateOptionaggregateOptions
QList< GroupingOptiongroupingOptions

Static Public Attributes

static QMap
< QeQuery::GroupingOperation,
QByteArray > 
groupingOperationToStringMap
static QMap
< QeQuery::AggregateOperation,
QByteArray > 
aggregateOperationToStringMap

Detailed Description

Store the description of a query, including constraints, aggreagation and grouping.


Member Enumeration Documentation

Define the possible types of aggregation operation.

Enumerator:
VALUE_ONE 

return the value of the field for one element picked from the group.

VALUE_ALL 

return a list of all the values of the field for the elements of the group.

E.g. return

 {["val1", "val2", "val3"]}
COUNT 

return the number of elements of the group (fieldName is unused).

VALUE_AND_COUNT 

return a map of the different values of the field and the number of counts for each.

If the field had no value the special SVMTN/A map element is incremented. E.g. return

 {"red": 12, "blue": 5, "SVMTN/A": 125}
MULTIVALUE_AND_COUNT 

like VALUE_AND_COUNT for fields which can take more than one value (in a list) in which case the item can be counted more than once.

VALUE_N 

return the values of the field for the first N elements from the group and set a flag hasMore to true if there are more than N elements.

The result has the following format:

 {"values": ["hello", "world", "coucou"], "hasMore": false}
NUMBER_SUM 

return the sum of the values of the field of each elements.

NUMBER_HISTOGRAM 

return an histogram of the (numerical) values of the field.

Currently the number of bin is set to 10 but this could be a parameter in future versions. The format of the returned histogram is the following:

 {"histo": [5, 0, 12, 58, 125, 45, 63, 11, 5, 2], "min": 12, "max": 57}

The column range can be derived by diving max-min by the number of column results (4.5 in this example).

NUMBER_MINMAX 

return the min and max of the values of the field with the following format:

 {[0.12, 5.36]}

.

NUMBER_MAP_SUM 

return a map with the sum of each element of a list of map<string, number>.

The field content must be a map<string, number>, e.g.

 {"X": 12.5, "Y": 5.3, "Z": 3.2}

and

 {"X": 2, "W": 56.45}

. In this case the returned result would be the sum for each letter:

 {"X": 14.5, "Y": 5.3, "Z": 3.2, "W": 56.45}

.

SPATIAL_UNION 

for spatial regions, return the union of all the regions.

SPATIAL_INTERSECTION 

for spatial regions, return the intersection of all the regions.

SPATIAL_BALKANIZATION 

for spatial regions, return the balkanization of all the regions for each group.

The parameter given in the expression is the name of a numerical field to sum and assign to each subregion.

SPATIAL_UNION_AREA 

for spatial regions, return the area of the union of all the regions.

SPATIAL_BOUNDINGCAP_ONE 

for spatial regions, return the bounding cap of the first element of the group.

The format is the following:

 {["CAP", [ra,dec], ap]}

, i.e a spherical cap centered on ra/dec with aperture radius ap in degrees.

Define the possible types of grouping operations.

Enumerator:
GROUP_ALL 

all the elements are assumed in the same group (fieldName is unused).

EQUAL 

the field must have the same value in each group.

MULTI_EQUAL 

like EQUAL for fields which can take more than one value (in a list), in which case the item will belong to more than 1 group.

SPATIAL_SIMPLE_OVERLAP 

for spatial regions, all element of the group must overlap.

SPATIAL_FASTMATCH_BOUNDINGCAP 

special fast spatial matching based on bounding caps overlap.

All element of the group must have bounding caps overlapping more than the threshold given in the expression (nember between 0 and 1). The grouping result depends on the order of processing and is therefore not always predictable.

Generated on Fri Sep 10 15:36:04 2010 for SVMT by  doxygen 1.6.3