Ok. I have some idea I think of where you are at, so I will give it a shot. I think this sort of thing is an emergent property in the design of APL applications, and so there's nothing to "see" in terms of an example unless you can see that design process.
But first, "database" here is just the list of global variables. If that wasn't obvious, it is important.
My application processes weblogs, and "clicks" is the bit-array of which event was a click (redirect), as opposed to having a variable called "weblog" which contains a list of records each possibly having an event-type field.
Normalizing them that acknowledges that the weblog (input) probably looked like the latter, but it's easier to do work on the former. APL makes that transformation very easy: Just rotate the table. In k this is flip. Simples.
Those "domain semantics" are simply the thing I want to do with "clicks" which in my application comes from the business (users), so I want them to provide a bunch of rules to do that.
Now with that in mind, take a look here:
https://code.jsoftware.com/wiki/Vocabulary/bdot#bitwise
and here:
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec...
Look carefully at the tables, because they're given in a slightly different way, but they are the same. And these are all of them, so it should be obvious at this point you can represent any boolean operation against any matrix of variables with a matrix of these numbers.
For example, you might have a sql-like expression (from a user of your application) of x=y, and x<y and so on that you want to use to filter some data set.
Now if you are to think about how you might do this in Javascript (for example; probably in scheme too) you would probably organise such a table as a chain of closures. And I think if you look at any ORM in just about any language you'll see this kind of pattern (maybe they use classes or use a tree, but these are obviously the same as closures), but such a tree can only be traversed, and the closure can only be called. Maybe you can batch or shard, but that's it, and since I would bet there are a lot of dependant loads/branching in this tree of closures, it is slow.
But if you understand that this tree is also a matrix of boolean operators, it is obviously parallelisable. And each operation is simple/cache-friendly and so therefore fast. This leads to your "queries" being a set of projected indexes or bitmaps (whichever is convenient), which you probably also store in global variables someplace (because that is convenient) while you're doing what you need to do (make xml, json, bar charts, run programs, whatever)