lower_upper{l:str, u:str}
A relation generator. Can convert string l into upper case (u) and vice-versa.
Examples
lower to upper
lower_upper(l:="hello world")
| u |
|---|
| HELLO WORLD |
upper to lower
lower_upper(u:="HELLO WORLD")
| l |
|---|
| hello world |
bulk operation
$S{*, l:=SNAME} & lower_upper
| SNO | l | STATUS | CITY | u |
|---|---|---|---|---|
| S1 | Smith | 20 | London | SMITH |
| S2 | Jones | 10 | Paris | JONES |
| S3 | Blake | 30 | Paris | BLAKE |
| S4 | Clark | 20 | London | CLARK |
| S5 | Adams | 30 | Athens | ADAMS |
Joining with a relation with either l or u causes the operation to apply to every tuple.
bulk operation - composed
$S{*, l:=SNAME}(lower_upper){*, SNAME:=u}
| SNO | STATUS | CITY | SNAME |
|---|---|---|---|
| S1 | 20 | London | SMITH |
| S2 | 10 | Paris | JONES |
| S3 | 30 | Paris | BLAKE |
| S4 | 20 | London | CLARK |
| S5 | 30 | Athens | ADAMS |
Note: this first renames SNAME to l to match the lower_upper{l}, then it composes that with lower_upper (which removes the common l attribute) and then it finally renames the added u back to SNAME, effectively replacing the original SNAME with an uppercased version.