Home · All Classes · Functions · Building · Tuning 

ConstraintsSet Class Reference

This class represents the set constraint which can be used for querying a QeStore. More...

#include <ConstraintsSet.hpp>

List of all members.

Classes

struct  ConstraintOption
 Contains the information about a condition in a query. More...

Public Types

enum  ConstraintOperation {
  STRING_EQUAL, STRING_INCLUDED, STRING_BEGINS, STRING_OR,
  STRING_OR_EQUAL, NUMBER_EQUAL, NUMBER_GREATER, NUMBER_GREATER_EQUAL,
  NUMBER_LESS, NUMBER_LESS_EQUAL, NUMBER_BETWEEN, SPATIAL_INTERSECT,
  SPATIAL_CONTAINED, SPATIAL_FASTMATCH_BOUNDINGCAPS, INVALID_OPERATION
}
enum  ConstraintOrdering { SORT_ASCENDING, SORT_DESCENDING, SORT_NONE }

Public Member Functions

 ConstraintsSet ()
void addConstraint (ConstraintOption cond)
void addConstraints (const ConstraintsSet &other)
void addConstraint (const QByteArray &fieldName, ConstraintOperation operation, const QVariant &expression, bool negate=false)
ConstraintOrdering getOrdering () const
bool isEmpty () const
const QByteArray & getOrderingFieldName () const
void setOrdering (ConstraintOrdering aordering, const QByteArray &fieldName)
const QList< ConstraintOption > & getConstraints () const
bool operator== (const ConstraintsSet &other) const
bool operator!= (const ConstraintsSet &other) const
QVariantList toQVariantList () const
QString toJson () const

Static Public Member Functions

static ConstraintsSet fromQVariantList (const QVariantList &l)
static ConstraintsSet fromJSON (const QString &queryJson)
static QByteArray replaceDots (const QByteArray &ar)
static QMap
< ConstraintOperation,
QByteArray > 
initConstraintOperationToStringMap ()
static QByteArray constraintOperationToString (ConstraintOperation)
static ConstraintOperation stringToConstraintOperation (const QByteArray &)
static QByteArray constraintOrderingToString (ConstraintOrdering)
static ConstraintOrdering stringToConstraintOrdering (const QByteArray &)

Static Public Attributes

static QMap
< ConstraintOperation,
QByteArray > 
constraintOperationToStringMap

Detailed Description

This class represents the set constraint which can be used for querying a QeStore.

The contraints are implicitely combined with an AND operator.


Member Enumeration Documentation

Define the possible types of operators in a constraint.

Remember that in a query, the ConstraintOperation should be compatible with the type of the elements of the matching field. E.g. you cannot use the SPATIAL_INTERSECT ConstraintOperation on a field containing a scalar number. Doing so will produce undefined results.

Enumerator:
STRING_EQUAL 

string which is equal to the expression.

STRING_INCLUDED 

string which includes all tokens in the expression. E.g. if the expression is "LL" it will match "HELLO".

STRING_BEGINS 

string which begins with the expression. E.g. if the expression is "HELL" is will match "HELLO".

STRING_OR 

string which includes at least one token in the expression.

The expression must be a list of string. E.g. if the expression is ["LL", "RLD"] it will match "HELLO" and "WORLD".

STRING_OR_EQUAL 

string which is equal to at least one token in the expression.

The expression must be a list of string. E.g. if the expression is ["HELLO", "WORLD"] it will match "HELLO" and "WORLD".

NUMBER_EQUAL 

number which is equal to the expression. The expression must be a number.

NUMBER_GREATER 

number which is greater than the expression.

NUMBER_GREATER_EQUAL 

number which is greater than or equal to the expression.

NUMBER_LESS 

number which is less than the expression.

NUMBER_LESS_EQUAL 

number which is less than or equal to the expression.

NUMBER_BETWEEN 

number which is between two tokens of the expression.

The expression must be a list of 2 numbers, e.g. [-125.3, 12].

SPATIAL_INTERSECT 

region which intersects the one given in the expression. The expression must be a region.

SPATIAL_CONTAINED 

region contained by the one given in the expression. The expression must be a region.

SPATIAL_FASTMATCH_BOUNDINGCAPS 

special fast spatial matching operator based on bounding caps.

The bounding cap of a region is the spherical "circle" containing the region. This operator takes in the expression a list of bounding caps, and use it to filter the regions which have a bounding cap overlaping more than minOverlap with at least one of them. (minOverlap ranging between 0 and 1). The expression has the following format {"minOverlap": 0.9, "caps": [cap1, cap2, ...]}

Define the possible type of sorting for a query.

Enumerator:
SORT_ASCENDING 

Sort the query results in ascending order.

SORT_DESCENDING 

Sort the query results in descending order.

SORT_NONE 

Don't sort the query results (default).


Member Function Documentation

void ConstraintsSet::addConstraint ( const QByteArray &  fieldName,
ConstraintOperation  operation,
const QVariant &  expression,
bool  negate = false 
)

Convenience function for adding a narrowing condition to a query object.

Parameters:
fieldName the name of the field to query.
operation operation type.
expression a single value which can be of type number (int or floating point) or string.
negate operations negation.
Returns:
the id of the newly created condition for later references.
void ConstraintsSet::addConstraint ( ConstraintOption  cond  ) 

Add a narrowing condition to a query object.

Parameters:
cond the condition to add.
Returns:
the id of the newly created condition for later references.
Generated on Fri Sep 10 15:36:04 2010 for SVMT by  doxygen 1.6.3