Part I — Preparing the ground

01 · Concepts: the names of things

Before touching the tree, learn the name of each of its parts. In Baobáxia the concepts have Portuguese names, and the code respects those names.

Everything is a Saber

The most important idea in the project: there is only one entity, the Saber ("knowledge", baobaxia/core/saber.py). A photo, an article, a person, a community, a whole collection — everything is a Saber with a different nature field.

natureWhat it representsWhere it lives on disk
galaxiaa collection (the git repository)the root of the galaxy
mucuaa community's machine, with Baobáxia installed (see below)mucuas/<slug>+<uuid8>/
territoriothe ground, geographic and symbolicterritorios/
mocambolaa personmucuas/…/mocambolas/
grupoa set of mocambolasmucuas/…/grupos/
midia, artigo, evento, colecaothe published collectionmucuas/…/saberes/<folder>/
relacaoa link between two saberesmucuas/…/saberes/relacao/
pedido, rotathe network machinery (store-and-forward)mucuas/…/pedidos/, …/rotas/

Why "mucua" and not "server". Elsewhere, the machine that keeps and hands out data is called a server. We don't like that name: it carries the idea of a machine that serves, put to work without end — a relationship of exploitation. We prefer a relationship of care: the mucua is the baobab's fruit, which keeps the seed and feeds; whoever keeps it running cares for it (the PAJÉ). The word shows up in code and in other tools' docs ("XMPP server", hooks.server.ts); in Baobáxia, it's mucua.

Natures live in a registry (baobaxia/natures/__init__.py), and each one has a pydantic validation schema (natures/schemas.py). Communities can create new natures through the API (POST /natures, services/nature_defs.py).

classDiagram
    direction LR
    class Saber {
        +str uuid
        +str nature
        +str slug
        +str|dict name
        +str galaxia
        +str mucua
        +str creator
        +datetime created
        +datetime updated
        +str signature
        +list~str~ applications
        +str visibility
        +dict data
        +list~ContentRef~ content
        +to_metadata() dict
        +to_index_metadata() dict
        +to_public_dict(lang) dict
    }
    class ContentRef {
        +str filename
        +str mimetype
        +int size
        +str hash  «git-annex key»
        +bool is_local  «index only»
        +float duracao
    }
    class NatureSpec {
        +str name
        +str folder
        +bool structural
        +list indexes
        +list default_applications
    }
    class Ref {
        +str galaxia
        +str mucua
        +str saber
    }
    Saber "1" *-- "0..*" ContentRef : attachments
    Saber ..> NatureSpec : nature
    Saber ..> Ref : relations and collection members

The words of the network

  • Mucua — the baobab fruit. Each installation is a mucua, with its own UUID stored in ~/.baobaxia/mucua.yaml (infra/mucua_local.py). The mucua owns a home territory and a default galaxy.
  • Galaxy (galaxia) — a collection, which is a git + git-annex repository. A mucua keeps several galaxies; the same galaxy lives in several mucuas.
  • Mocambola — the person (from mocambo, a quilombo). They have the same UUID and the same key across the whole network; the role is per galaxy.
  • Territory (territorio) — the ground the mucua anchors. Saberes inherit the mucua's territory unless they say otherwise.
  • Link / route — the way a galaxy synchronizes: a git remote (link) or a sneakernet path (route, rota).
  • Request (pedido) — "I want a copy of this file": it travels through the network to someone who has the file and brings it back.
  • Lens / application — a way of looking at the same saberes: collection, blog, map, calendar, timeline, stories (applications/).

Roles

USER ⊂ PAJÉ ⊂ OXALÁ (constants.ROLE_LEVEL). USER looks after their own saberes; PAJÉ looks after everything in their mucua; OXALÁ administers the galaxies where they hold that role. Module 05 goes into detail.

Visibility and protection

Two axes that add up:

  • visibility: public | mucua | private (a field of the saber);
  • data.protecao: publico | acl (only the leitores, the readers) | cifrado (only the readers, with real cryptography).

And the galaxy can have acesso: membros — a door before all the others.

Practice

  1. Open natures/schemas.py and find the schema for evento. Which fields are required? Create an event through the /docs API and watch validation reject a wrong field.
  2. In core/saber.py, compare to_metadata() and to_index_metadata(). Why can't is_local go into the file?
  3. List the relations in natures/relacoes.py. Which are symmetric? What is the inverse of e_copia_de?

To talk about

  • Why does "everything is a Saber" help a community create new things (a receita (recipe), cantiga (song), planta (plant) nature) without needing a programmer?
  • Who decides what is public? The person, the mucua, the galaxy?

vedi questo capitolo come sapere