User Tools

Site Tools


notes:internals:db

This is an old revision of the document!


Database

Folk's database stores all Wishes, Claims, Whens, and Holds. Essentially, it stores everything that happens in Folk. The database works with Statements, either inserting or removing them. All those verbs I mentioned— Wish, When, etc—are functions that insert a Statement into the database. We'll cover removal later.

So, what is a Statement? A Statement consists of three parts: the Clause, the child matches, and metadata. Let's start with the Clause: a Clause is an array of words, with each word known as a Term. An example Clause, “the sky is blue”, would become [“the”, “sky”, “is”, “blue”]. We'll cover child matches and metadata in a bit.

Let's see what happens when we run Claim.

Claim the sky is blue

The Statement's Clause would become “current-file.folk claims the sky is blue”. Notice there's a part that was prepended to the beginning, “current-file.folk claims”. This is what 1. tells us what file this Claim came from, and 2. tells us that it's a Claim, not a Wish.

notes/internals/db.1757198259.txt.gz · Last modified: 2025/09/06 22:37 by smj-edison

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki