interface of a generic constraint in the attribute-based data model. More...
#include <attributes.h>
Public Member Functions | |
virtual | ~Constraint () |
virtual destructor | |
virtual OperatorId | op () const =0 |
returns the operator defined for this constraint. | |
virtual bool | covers (const Attribute &a) const |
applies this constraint to an attribute. More... | |
Public Member Functions inherited from siena::Attribute | |
virtual | ~Attribute () |
virtual destructor | |
virtual String | name () const =0 |
returns the name of this attribute. | |
Public Member Functions inherited from siena::Value | |
virtual | ~Value () |
virtual destructor | |
virtual TypeId | type () const =0 |
returns the actual type of this value. | |
virtual Int | int_value () const =0 |
returns this value as an integer. More... | |
virtual String | string_value () const =0 |
returns this value as a string. More... | |
virtual Bool | bool_value () const =0 |
returns this value as a boolean. More... | |
virtual Double | double_value () const =0 |
returns this value as a double. More... | |
interface of a generic constraint in the attribute-based data model.
A constraint is defined by a name, an operator, and a value. A constraint expresses the condition that must be matched by a message. Specifically, a constraint defined by name N, operator Op, and value V is matched by a message M if M contains an attribute named N and value X and any of the following conditions applies:
Op == ANY and V.type() == ANYTYPE
Op == ANY and V.type() == X.type()
value X and value V (in this order) are in the relation defined by operator Op. In general, this happens in the following cases:
same type, matching values: X.type() == V.type() and the two values satisfy the semantics of the Op condition as defined intuitively. For example, if Op is LT and X.type() == V.type() == STRING, then the constraint is satisfied if X.string_value() is less than V.string_value(), which means that X.string_value() precedes V.string_value() in lexicographical order.
compatible types, matching values: X.type() == INT and V.type() == DOUBLE (or vice versa) and X.int_value() Op V.double_value().
Notice that some operators are type-specific (e.g., SF, PF, SS are defined for strings only).
|
virtual |
applies this constraint to an attribute.