Help with algorithms/datastructures/libraries for 3 dimensional data

Owl is an option, but what it provides are n-dimensional arrays, so you only get numerical data, and you would have to translate queries into array operations. You wouldn’t get the sort of type safety you want, since a number is a number–and not a number representing particular sorts of info.

There has been discussion of adding dataframes with labeled columns, etc.

I’m not sure how much of Owl can run in browsers at this point, but it’s one goal of the project.

Also: I’m pretty sure I remember reading about an in-memory SQL library for OCaml a while ago. If that does exist, type safe queries are possible, too: What is a good and maintained SQL toolkit for ocaml?
(Maybe I’m thinking of a library for another language, though.)