Builtin

lower_upper

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
SNOlSTATUSCITYu
S1Smith20LondonSMITH
S2Jones10ParisJONES
S3Blake30ParisBLAKE
S4Clark20LondonCLARK
S5Adams30AthensADAMS

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}
SNOSTATUSCITYSNAME
S120LondonSMITH
S210ParisJONES
S330ParisBLAKE
S420LondonCLARK
S530AthensADAMS

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.