LogikalDB: Reactive logical database layer

I’m happy to announce LogikalDB, which is an open source reactive logical database layer built on top of FoundationDB.

It’s basically an experimental querying and data layer for FoundationDB, where the querying engine is a microKanren based micro embedded logic programming language. It’s experimental, because it’s not released as an official maven package yet and also because we are looking for some early feedback about the layer.

The main design goal of the project was to find and create a foundational query layer that is easy to use and extend. We came up with this main goal, because we wanted to know if it’s even possible to find such a basic building block for querying engines or not.
Another interesting design goal that we came up with is the unified query and data model, which means that from a user perspective they behave the same way. For example this also means that you can even store your queries in the database itself.

We plan to improve and extend this layer and hopefully build up an ecosystem around it, so let me know what do you think about it.

If you are interested then you can find more information about the layer in the repository’s readme or in the examples folder if you like to read code more than documentation.

8 Likes

Hello Robert and welcome :slight_smile:

I did some experiments with microkaren. Can you explain how the data is stored in FDB? Possibly indicating the code that translate a dataset into data inside FDB.

Also, why is it called reactive?

Thanks in advance, and thanks for sharing!

Hi and thanks for the welcome and interest,

Data is stored based on the entities that you can find in the GoalEntity.kt file. It’s just a bunch of data classes that represents the different Goals that you can find in this microKanren based system.

LogikalDB uses CBOR to convert these data structures to binary, so it can be stored in FDB.

The interaction with FDB is handled by the DatabaseHandler class.

The main LogikalDB interface connects these pieces together, so there is no magic in storing these kind of data.
The real magic happens when we need to evaluate this data representation by converting it into the typical microKanren functional representation. :slight_smile:

LogikalDB is reactive, because it uses Kotlin Flow(Reactive Stream) to represent the “state stream” that microKanren systems are built on. You can think of Flow as kind of like a lazy stream that only gets evaluated when a terminal operation is run on it.