DesCOTS-QM 3.0 Definition of Formulas

 

 

Quality Entities

Quality Entities can be referenced within a formula by means of their name in the QM.

OPERATOR

DESCRIPTION

EXAMPLE

Domain Of

Returns the Domain of Values in which the Entity will be evaluated, as a Set of Strings.

DomainOf “Domain Entity”

Tuple access

An element of the tuple is accessed by means of its name written within double quotes and surrounded by brackets after the entity name.

“Tuple Entity” [ “elementName” ]

Function access

Returns the return value of the Function (given certain values). Function parameters are separated by commas and typed after the entity, surrounded by parentheses.

“Function Entity” ( 5, 0.95, ”Int Entity” )

 

Constant values

Constant values can be of one of these types :

TYPE

DESCRIPTION

EXAMPLE

Boolean

Keywords true and false represent boolean constants

True

Integer, Real

Any numeric character sequence, signed if negative. Reals' floating point decimals come after a dot.

- 4.5 , 0.5223

String

Any single-quoted character sequence. Single quotes within the constant must be escaped (have a backslash before them). Strings are case insensible.

'constant'

Range

Defines a range of values bounded by two constants. Constants are separated by two dots

0..1.0 , 'a'..'z'

Set

Set elements are sequentially entered, separated by commas and surrounded by curly braces “{“

{ 'constant1', 'constant2', 'constant3' }

Tuple

Tuple elements are sequentially entered, separated by commas and surrounded by brackets “[“

[ 'constant1', 'constant2', 'constant3' ]

 

Unary Operators

 

OPERATOR

DESCRIPTION

SYNTAX

RETURN TYPE

NOT

Logical negation

  • NOT boolean

boolean

MINUS

Returns a number's negative value.

  • - ( integer | real )

( integer | real )

ABS

Returns a number's absolute value

  • ABS ( integer | real )

( integer | real )

ROUND

Rounds a number to the nearest integer. (round-down if in middle)

  • ROUND ( integer | real )

integer

TRUNC

Truncates a number to the nearest integer (round-down)

  • TRUNC ( integer | real )

integer

SIZE

Returns the cardinality (number of elements) in a Set or Range.

  • SIZE ( set | range )

integer

EMPTY

Returns a boolean telling if a set (or a range) is empty

  • EMPTY ( set | range )

boolean

DOMAIN OF

Returns the Domain of Values available to an Entity with Domain Metrics

  • DOMAINOF ( domain )

set of string

 

 

Binary Operators

 

OPERATOR

DESCRIPTION

SYNTAX

RETURN TYPE

AND

OR

Logical AND, OR

  • boolean AND | OR boolean

boolean

EQUAL

NOT EQUAL

True if first operand is equal to second operand.

For non-equality type an exclamation sign ! Before the equality sign.

It is important for set and tuple operands to have compatible types.

  • ( integer | real ) != | = ( integer | real )

  • boolean != | = boolean

  • ( string | domain ) != | = ( string | domain )

  • set != | = set

  • tuple != | = tuple

boolean

GREATER

GREATER OR EQUAL

LOWER

LOWER OR EQUAL

True if first operandr is greater (or lesser) compared to the second operand.

To test for equality type an equality sign = after the comparation sign.

  • ( integer | real ) > | >= ( integer | real )

  • ( integer | real ) < | <= ( integer | real )

  • ( string | domain ) < | <= ( string | domain )

  • ( string | domain ) > | >= ( string | domain )

boolean

PLUS, MINUS,

MULTIPLICATION, DIVISION

Arithmetic addition (+), substraction (-), multiplication (*) and division (/).

  • ( integer | real ) + | - | * | / ( integer | real )

( integer | real )

STRING CONCATENATION

Puts together two Strings in a new one. The arithmetic addition symbol is used to identify this operator. A domain operand has the selected value in the domain.

  • ( string | domain ) + ( string | domain )

string

INTEGER DIVISION

Returns the integer part of the division between operands.

  • ( integer | real ) DIVINT ( integer | real )

integer

MODULE

Arithmetic module.

  • integer MOD integer

integer

IN

True if the first operand is an element that appears in the given set.

  • ( boolean | integer | real | string | domain ) IN ( set | range )

boolean

UNION

INTERSECTION

Returns the union (or intersection) of the two Sets in a new Set.

  • ( set | range ) UNION, INTERSECTION ( set | range )

set

 

 

Quantifiers

QUANTIFIER

DESCRIPTION

Return Value

Forall / Exists

Tests if every / at least one element in the Set satisfies a given condition.

boolean

Max / Min / Sum

Returns the maximum / minimum / sum of the elements in the Set (which satisfy a given condition)

integer / real

Any

Returns a random element in the Set that satisfies a given condition.

Type of the elements in the Set.

 

 

Conditional Clause

 

General Considerations