logoalt Hacker News

CQL: Categorical Databases

85 pointsby noworriesnatelast Saturday at 11:18 AM30 commentsview on HN

Comments

bob1029today at 8:34 AM

> CQL is not a database management system: it neither stores nor updates data.

The same could be said for SQL. How does CQL differ from SQL? If I squint my eyes just a tiny amount, these ideas become really difficult to separate. I was always under the impression that the relational model is based upon many concepts studied in category theory. To my mind, all of the following things are overlapping parts of the exact same monster:

  Set theory
  Category theory
  Graph theory
  Type theory
  Discrete mathematics 
  Relational algebra
  Relational calculus
  Relational modeling
  An actual sql schema
show 5 replies
sreantoday at 8:15 AM

There was a good blog post on how the category theoretic ideas behind this applies to data frames

What Category Theory Teaches Us About DataFrames https://mchav.github.io/what-category-theory-teaches-us-abou...

Discussed on HN at (67 comments)

https://news.ycombinator.com/item?id=47561426

mattstirtoday at 1:15 PM

> Reduce risk of failure through artificial intelligence. CQL contains an embedded automated theorem prover that guarantees the correctness of CQL programs.

Man, it's a rough environment right now marketing-wise. I don't know if they're contractually obligated to say the funny magic words, but the term AI is nearly entirely meaningless at this point. Akin to saying "behold my mighty calculator app: it prevents divisions by zero through artificial intelligence!"

show 2 replies
iron_fevertoday at 1:35 PM

I know very little about databases, but I work heavily with category theory, so fwiw: I think the main benefit is composition. The edge over SQL shows up when you combine schema mappings - a mapping is a functor, so when you migrate data along it the constraints come with it by construction, and you don't end up writing ETL and hoping integrity held.

As best as I can tell (but i really dont know much about databases) it's probably a narrow advantage - storage and everyday queries still go to Codd's model - but for stitching schemas together it seems like it could work.

I'm using similar math for automated formal verification, where this approach is what makes it tractable.

Syzygiestoday at 2:48 PM

We have not yet converged on a best (or even adequate) way to present a structured mountain of information to AI, not already in its training corpus.

AI agents fielded by major AI players still fail at the basic task of providing immediate and correct support for use of the current versions of their products. If a programming language is too new to have adequate representation in the training corpus, there isn't an accepted standard way to provide a reference manual targeting AI agents. Even the best way to include documentation in a large project so new AI agents can take over is controversial. A pile of linked markdown files really isn't an answer, less structured than a codebase itself, that AI is good at navigating.

Other HN posts have discussed using SQL as a backbone for the AI "mind mapping" support we need for AI more critically than for ourselves.

I was hoping that CQL could be an answer to this. Perhaps, but not its current primary goal.

randomNumber7today at 8:19 AM

Since Codd's paper showed that the relational model dominates other approaches (for data storage) I would expect a paper that shows categorical database are not affected by this and what benefit they have.

show 1 reply
flying_sheeptoday at 8:04 AM

Thanks for the sharing. It looks interesting but I did not dive deep into it. Just wonder how is it different from SQL trigger which can also ensure integrities?

show 1 reply
mattsouthtoday at 9:21 AM

Not to be confused with https://cql.hl7.org/ which is the CQL I know of.

show 1 reply