Absolutely, and I would encourage you to contact us offline first to discuss related work in this space - there is indeed a lot, because the category of CQL schemas forms a BCCC and for each schema S, the category of S-databases forms a topos, briefly described here: https://www.categoricaldata.net/cql/haskell.pdf. So CQL is expressive enough to interpret the STLC and higher-order logic in a few different ways.