Exclusive disjunction: xor
Syntax
op1 xor op2
Input parameters
op1 |
the first operand |
op2 |
the second operand |
Examples of valid syntaxes
DS_1 xor DS_2
Semantics for scalar operations
The xor operator returns TRUE if only one of the operand is TRUE (but not both), FALSE otherwise.
The two operands must be of boolean type.
For example:
| FALSE xor FALSE
gives FALSE
| FALSE xor TRUE
gives TRUE
| FALSE xor NULL
gives NULL
| TRUE xor FALSE
gives TRUE
| TRUE xor TRUE
gives FALSE
| TRUE xor NULL
gives NULL
| NULL xor NULL
gives NULL
Input parameters type
op1, op2
dataset {measure<boolean> _ }
| component<boolean>
| boolean
Result type
result
dataset {measure<boolean> _ }
| component<boolean>
| boolean
Additional Constraints
None.
Behaviour
The operator has the typical behaviour of the “Behaviour of Boolean operators” (see the section “Typical behaviours of the ML Operators”).
Examples
Given the operand datasets DS_1 and DS_2:
Input DS_1 (see structure)
Id_1 |
Id_2 |
Id_3 |
Id_4 |
Me_1 |
---|---|---|---|---|
M |
15 |
B |
2013 |
True |
M |
64 |
B |
2013 |
False |
M |
65 |
B |
2013 |
True |
F |
15 |
U |
2013 |
False |
F |
64 |
U |
2013 |
False |
F |
65 |
U |
2013 |
True |
Input DS_2 (see structure)
Id_1 |
Id_2 |
Id_3 |
Id_4 |
Me_1 |
---|---|---|---|---|
M |
15 |
B |
2013 |
False |
M |
64 |
B |
2013 |
True |
M |
65 |
B |
2013 |
True |
F |
15 |
U |
2013 |
True |
F |
64 |
U |
2013 |
False |
F |
65 |
U |
2013 |
False |
Example 1
DS_r:=DS_1 xor DS_2;
results in (see structure):
Id_1 |
Id_2 |
Id_3 |
Id_4 |
Me_1 |
---|---|---|---|---|
M |
15 |
B |
2013 |
True |
M |
64 |
B |
2013 |
True |
M |
65 |
B |
2013 |
False |
F |
15 |
U |
2013 |
True |
F |
64 |
U |
2013 |
False |
F |
65 |
U |
2013 |
True |
Example 2
DS_r:= DS_1 [ calc Me_2:= Me_1 xor true ];
results in (see structure):
Id_1 |
Id_2 |
Id_3 |
Id_4 |
Me_1 |
Me_2 |
---|---|---|---|---|---|
M |
15 |
B |
2013 |
True |
False |
M |
64 |
B |
2013 |
False |
True |
M |
65 |
B |
2013 |
True |
False |
F |
15 |
U |
2013 |
False |
True |
F |
64 |
U |
2013 |
False |
True |
F |
65 |
U |
2013 |
True |
False |