Siena Fast Forwarding Documentation (v. 2.0.1)
Public Member Functions | List of all members
siena::Constraint Class Referenceabstract

interface of a generic constraint in the attribute-based data model. More...

#include <attributes.h>

Inheritance diagram for siena::Constraint:
Inheritance graph
[legend]
Collaboration diagram for siena::Constraint:
Collaboration graph
[legend]

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...
 

Detailed Description

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:

  1. Op == ANY and V.type() == ANYTYPE

  2. Op == ANY and V.type() == X.type()

  3. 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).

See Also
OperatorId, Attribute, Value

Member Function Documentation

virtual bool siena::Constraint::covers ( const Attribute a) const
virtual

applies this constraint to an attribute.

Returns
true iff this constraint matches (i.e., covers) the given attribute.