Learning, knowledge graphs, and building a tool

It started with my daughter going to university this year.

Like every student, she suddenly had a lot of information coming her way. Lectures, tutorials, books, articles, presentations, assignments, and conversations. One subject refers to another subject, an author refers to another author, a theory builds on an earlier theory, and something mentioned briefly in a lecture suddenly turns out to be important three weeks later.

Watching this happen made me think about the way we humans learn.

We are given information mostly in a linear form.

A lecture has a beginning and an end. A book has chapters. An article has paragraphs. Notes usually become pages in a notebook or documents in a folder.

But knowledge itself isn’t really linear.

One concept is related to another concept. A researcher developed a theory. That theory influenced another researcher. An event happened at a certain place. An argument contradicts another argument. A course covers several subjects, and those subjects connect to things you have already learned somewhere else.

The more you learn, the more these connections matter.

And that gave me an idea.

What if you could see the connections?

I was raised working with mind maps, visual representations of things I learned, so I have many of them on different subjects. So I started wondering what it would look like if, instead of only writing notes or mind maps underneath or next to each other, you could also describe the relationships between the things you learn.

Something simple like:

Edward Hall
    |
    +-- ASSOCIATED_WITH --> High-context communication
    |
    +-- WORKED_WITH ------> Navajo and Hopi tribes

Or:

Culture
    |
    +-- INFLUENCES -------> Communication
    +-- SHAPED_BY --------> Lived experiences
    +-- IS_SHARED_BY -----> Groups of people

Suddenly you are not only storing facts.

You are building a map of what you know.

This is, of course, not a new concept. Knowledge graphs have been around for quite some time. There are very powerful graph databases and graph visualisation tools available.

But that was also where I ran into the next question…

Why should somebody who simply wants to organise knowledge have to install and maintain a database?

I wanted something simpler

I wasn’t looking for an enterprise graph platform.

I wanted something closer to a document editor.

Open a file.

Look at the knowledge.

Add something.

Change something.

Create a relationship.

Save the file.

Send it to somebody else.

Done.

No database server. No account. No cloud environment. No query language required just to get started.

The graph itself should simply be the document.

So I started building a small Knowledge Graph Viewer.

The data format was deliberately simple. A relationship is described with five fields:

{
  "head": "Culture",
  "head_type": "Concept",
  "relation": "INFLUENCES",
  "tail": "Communication",
  "tail_type": "Concept"
}

That is almost readable without knowing anything about knowledge graphs.

Culture, which is a Concept, INFLUENCES Communication, which is also a Concept.

A collection of those statements becomes a graph.

From viewer to editor

The first version was just that: a viewer.

You could load a JSON file, see the nodes and relationships, and navigate through them.

But once you can see a graph, the obvious next question is:

Why can’t I edit it?

So the viewer gradually became an editor.

Nodes can now be created, changed, and deleted.

Relationships can be created, changed, and deleted.

Node types and relationship types can be managed.

You can click directly on a node to edit it, click a relationship to edit that, or create a relationship visually between two nodes.

There is undo and redo.

There is validation.

There are warnings for things such as duplicate relationships, isolated nodes, and unused relation types.

And because I still wanted the original format to stay simple, there are now two different concepts.

Save Project stores everything needed to continue editing, including things such as node positions and editor information.

Export Viewer JSON produces the simple five-field format again.

That separation turned out to be important.

The project file is for working.

The Viewer JSON is for sharing the knowledge.

Knowledge graphs that work like documents

While working on it, I slowly realised that this was probably the most important idea behind the project.

I don’t want to build another graph database.

There are already excellent graph databases.

I don’t want to build another general-purpose diagram editor either.

There are excellent tools for that too.

What interests me is the space in between.

A knowledge graph editor that creates, inspects, validates, and shares structured knowledge visually, like a document editor, without a database.

That means the workflow should feel familiar:

Open
  ↓
Read
  ↓
Edit
  ↓
Validate
  ↓
Save
  ↓
Share

The application itself is also deliberately simple.

It is one HTML file.

You can open it in a browser.

It works locally.

The knowledge doesn’t have to be uploaded somewhere first.

That also means it works perfectly well on Linux, Windows, or macOS as long as there is a modern browser available.

Validation became more important than I expected

While building the editor, I discovered something else.

Creating a graph is easy.

Creating a good graph is harder.

For example, you can easily end up with:

Person
person
Persons

as three different node types.

Or:

Geert Hofstede
Hofstede
Hofsteed

as three different nodes while they may actually refer to the same person.

You can create the same relationship twice.

You can create a node and forget to connect it to anything.

You can define a relationship type and never use it.

A database will happily store most of this.

But storing something isn’t the same as having good structured knowledge.

So validation became an increasingly important part of the editor.

The editor now tries to point out these kinds of structural problems before you share the graph.

I think this could eventually become one of the more interesting parts of the project.

Not only:

Here is your graph.

But also:

Here are some things in your graph you may want to look at.

The graph as a learning tool

Coming back to where this started, I think this way of representing information could be useful while learning.

Imagine following a course for several months.

After each lecture, you add the concepts that seem important.

While reading an article, you add the authors, theories, and arguments.

While reading a book, you connect new concepts to things you already know.

Over time, instead of having twenty disconnected documents, you get something that starts to resemble a map of the subject.

You may even start seeing connections that weren’t obvious when you first encountered the information.

And perhaps that is one of the interesting things about knowledge graphs.

They don’t necessarily contain more information than your notes.

They represent the information differently.

The relationships become visible.

And then I did what I usually do

At some point I had a working tool.

So naturally I started changing it.

Then improving it.

Then finding another thing that could be better.

Then breaking something that worked perfectly well before.

Then fixing that.

Then adding validation.

Then adding project files.

Then adding SVG export (you know me ;-).

Then adding context menus.

And eventually I thought:

Perhaps this is useful to somebody other than me.

So I decided to turn it into an open-source project.

The intention is to keep the basic principles intact:

  • the graph should remain understandable;
  • the data should remain portable;
  • you shouldn’t need a database to use it;
  • it should work offline;
  • the application should remain easy to share;
  • and the simple JSON format should stay simple.

There are many things that could still be added.

Properties on nodes and relationships.

Sources and provenance.

Graph comparison.

Duplicate detection and merging.

Different layouts.

Better support for larger graphs.

Import and export formats such as GraphML and CSV.

But I don’t want the project to become complicated simply because it can.

The interesting challenge will be adding capability without losing the simplicity that made me start building it in the first place.

From learning to structured knowledge

What started with watching my daughter learn new things at university turned into a question about how we store knowledge.

And that question turned into a small piece of software.

That happens quite often with projects like this.

You notice something.

You start wondering.

You build a small experiment.

And then the experiment starts asking new questions.

For now, the idea is simple:

Knowledge graphs that work like documents.

Create structured knowledge visually.

See how things are connected.

Validate what you have created.

Save it locally.

And share it without requiring the person on the other side to first install a graph database.

Let’s see where it goes.


Knowledge Graph Editor is open source and available on GitHub.

https://github.com/WinkoErades/knowledge-graph-editor

The editor runs locally in a modern browser and does not require a database or installation.

Installation and configuration of ThunderAI on Ubuntu 24.04

ThunderAI is a powerful Thunderbird extension that leverages the advanced capabilities of AI to revolutionize email management. By integrating with ChatGPT, OpenAI and Ollama ThunderAI empowers users to:

  • Craft compelling emails: Define custom prompts to generate email drafts, refine existing messages, and ensure professional tone and style.
  • Gain deeper insights: Analyze emails using additional data provided by the user, such as context files or previous communications.
  • Enhance productivity: Automate tasks like email tagging and categorization, freeing up time for more important matters.
  • Improve communication quality: Leverage ChatGPT’s language expertise to identify and correct grammatical errors, enhance clarity, and optimize email content for maximum impact.

And of course, you want that AI running on your own computer. Luckily that is not that difficult… The installation and configuration of ThunderAI on Ubuntu 24.04 consists of 4 easy steps:

  • Install Ollama on Ubuntu
  • Configure Ollama service on Ubuntu
  • Install ThunderAI in Thunderbird
  • Configure ThunderAI in Thunderbird

Install Ollama on Ubuntu

  • Go to the Ollama website.
  • Follow the installation steps for Linux:
  • Open a terminal
  • Run the following command: curl -fsSL https://ollama.com/install.sh | sh
  • Download and run an LLM model.
  • For example by typing: ollama run zephyr:7b-beta-q8_0
  • After downloading the LMM it will start Ollama running the zephyr:7b-beta-q8_0 LLM.
  • You can exit Ollama by entering: /bye

Configure Ollama service on Ubuntu

  • Open a terminal and type: sudo nano /etc/systemd/system/ollama.service
  • In the file, you will see a line starting with Environment
  • Add the following sentence just beneath it: Environment="OLLAMA_ORIGINS=moz-extension://*"
  • Save and exit the file
  • Restart your computer

Install ThunderAI in Thunderbird

  • Open Thunderbird and go to Tools, Add-ons and Themes.
  • Search the ThunderAI extension by typing ThunderAI in Find more add-ons, and install it.

Configure ThunderAI in Thunderbird

  • Open Thunderbird and go to Tools, Add-ons and Themes.
  • Search the ThunderAI Extension.
  • Click the wrench Icon.
  • Select Ollama API (Local LLM) as the Connection Type.
  • Fill in http://127.0.0.1:11434/ as the Host Address.
  • Choose your favorite Ollama Model, and you can use AI in your favorite email client ;-).

Now you should be ready to run your own LLM as a useful assistant on your favorite email client.

Suggestions for improving this article are welcome, please let me know and drop me a line.

Copy the programming of an ESP WROOM 32 to another ESP WROOM 32

How to back up and restore the programming of an ESP WROOM 32 to Another ESP WROOM 32

Step 1: Preparation

  1. Install Python and pip (if they are not already installed): sudo apt update sudo apt install python3 python3-pip
  2. Install the latest version of esptool: First, remove any old versions of esptool: sudo pip3 uninstall esptool sudo apt remove python3-esptool Then, install the newest version via pip: pip3 install esptool

Step 2: Reading the Firmware from the Original ESP WROOM 32

  1. Connect the original ESP WROOM 32 to your computer via USB.
  2. Identify the serial port:
    Run the following command to find the serial ports: ls /dev/ttyUSB* Note the serial port that appears, for example, /dev/ttyUSB0.
  3. Read the firmware:
    Use esptool to read the firmware. Replace /dev/ttyUSB0 with the correct serial port if needed:
    bash esptool.py --chip esp32 --port /dev/ttyUSB0 read_flash 0x00000 0x400000 firmware_backup.bin
    This command reads 4MB (0x400000 bytes) of flash memory and saves it to the file firmware_backup.bin.

Step 3: Flashing the Firmware to the New ESP WROOM 32

Flash the firmware to the new ESP WROOM 32:
Use esptool to flash the firmware to the new ESP. Replace /dev/ttyUSB0 with the correct serial port if needed:
bash esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x00000 firmware_backup.bin

Connect the new ESP WROOM 32 to your computer via USB.

Identify the serial port:
Repeat the command: ls /dev/ttyUSB* Note the serial port that appears for the new ESP WROOM 32.

Using an ESP32 and PCM5102 as a Bluetooth audio receiver

I wanted to upgrade my built-in car stereo with a bluetooth receiver, for streaming audio from my mobile phone. So I built one myself using the line-in port on my stereo that’s normally used for the CD-changer. In this case, I am using the ESP32 as a Bluetooth receiver and the PCM5102 as a DAC module for converting digital audio to an analog stereo signal. Advanced Audio Distribution Profile (A2DP) is a Bluetooth profile that allows hi-fi sound to be transmitted over a wireless Bluetooth connection. The connection between the ESP32 and the PCM5102 is based upon I2S (Inter-IC Sound) an electrical serial bus interface standard used for connecting digital audio devices together.

Continue reading “Using an ESP32 and PCM5102 as a Bluetooth audio receiver”

Joplin note taking templates

I love Joplin as a note-taking and to-do application! So I created several Joplin note-taking templates, which I would like to share with you! Joplin can handle large numbers of notes organized into notebooks. Joplin is a great, free, and easy to use open-source note taking and to-do application. Created notes can be synchronized with multi-platform clients across various cloud services. Joplin templates make it even easier for you to quickly create new notes within the Joplin desktop app. You can also insert templates into existing notes.

Continue reading “Joplin note taking templates”