Ravi Chandu Edru/ lab

Concept lab · 01

The knowledge graph, from zero

One idea, no product, about half an hour. Theory and practice together: each station first explains its idea in plain words, then you do it with your own hands. You start with twelve sentences and a question no single one of them answers. You watch a graph answer it in three hops, built step by step by you: the facts, the identities, the relations. And at the end you build a brand new knowledge graph of your own, about anything you like, and ask it your own question. No experience needed.

Station 01 / 07 · Why

A question you cannot answer yet

First, the idea in plain words

A knowledge graph is a way to store facts so that questions about connections become easy to answer. That is the whole idea. But a definition means nothing until you feel the problem it solves.

So we start with the problem. Below are some notes, the way real companies actually keep them: as plain text. Your job is to answer one question using only these notes, the normal way, by reading.

Here is everything a small food company wrote down over one week. Twelve notes, in no particular order. Read them. All of them.

  • Green Farms delivered a pallet of peanut paste, batch B-207, on March 3.
  • The March 5 granola bar run used peanut paste from batch B-207.
  • The March 5 run produced 240 granola bars.
  • Gift box GB-12 was packed with granola bars from the March 5 run.
  • Gift box GB-31 was packed with fruit bars from the March 6 run.
  • M. Chen ordered gift box GB-12 on March 8.
  • Maya Chen updated her delivery details on March 7. Phone on file ends in 4417.
  • David Miller ordered gift box GB-31 on March 9.
  • The March 6 fruit bar run used apricots from Sunrise Farm.
  • Sunrise Cafe placed a standing order for coffee beans in February.
  • The order form for GB-12 lists a contact phone ending in 4417.
  • A kitchen note flags 'batch B207' as smelling off on March 4.

The question

Batch B-207 just failed a safety test. Every product that contains it must be recalled. Who needs a phone call?

First, the idea in plain words

A fact is one small piece of knowledge with a fixed shape: a thing, a named connection, and another thing. Example: Maya ordered GB-12. Thing, connection, thing.

In graph work a fact written this way is called a triple. The word just means it has three parts. Nothing more. In this station you will turn sentences into triples, and you will see that the same sentence can be read in more than one way, so the reading you choose matters.

A sentence is a fact wrapped in extra words. Your job is to unwrap four of the notes: the three highlighted ones that carry the chain, plus the supplier's delivery, which impact questions will need later. The two phone notes wait for the next station. They are not a fact problem, they are an identity problem. Careful: each sentence offers you three readings, and two of them will quietly ruin the recall.

fact 1 / 4

Green Farms delivered a pallet of peanut paste, batch B-207, on March 3.

First, the idea in plain words

An entity is one real thing in the world: one person, one batch, one gift box. The word sounds formal, but that is all it means: one thing.

The problem: the same entity can appear under different names. M. Chen and Maya Chen might be one person. Deciding which names point to the same entity is called entity resolution. It sounds advanced. It is just careful matching, and you are about to do it by hand, three times.

Your facts mention M. Chen, Maya Chen, two businesses called Sunrise, and a batch spelled two ways. Before any of them can connect, someone has to decide what is one thing and what is two. That someone is you. You do it by hand on purpose, so you can feel how the decision is really made.

decision 1 / 3

The order says M. Chen. The address update says Maya Chen. One person or two?

M. Chen

ordered GB-12 · order form lists phone ending 4417

Maya Chen

updated delivery details March 7 · phone on file ends 4417

First, the idea in plain words

A graph is a picture of facts. Each thing becomes a node: a box in the picture. Each connection becomes an edge: a line between two boxes. The name written on the line is the relation.

That is the whole vocabulary: nodes, edges, relations. Your triples from station 2 already have this shape. Thing, connection, thing becomes node, edge, node. You are not building something new here. You are just letting your facts take their natural form.

You extracted the facts. You settled the identities. Nothing else is needed. Place your facts and watch what they were always trying to be.

Your four facts from the last two stations are about to become a structure. Place the first one.

0 / 4 facts placed

First, the idea in plain words

Walking through a graph, from node to node along the edges, is called traversal. One step is called a hop. When a question is answered by a chain of hops, the answer is a path.

This is the payoff station. The question that took you five notes and hard thinking in station 1 is about to become three simple hops.

Station 1 asked you a question and you paid for the answer in hard, slow reading. Ask it again. This time the connections are written down, so the question can do the traveling instead of you.

deliveredused inpacked intoordered bysuppliedpacked intoordered byGreen FarmsSupplierB-207BatchMarch 5 runProduction runGB-12Gift boxMaya ChenCustomer · ph …4417Sunrise FarmSupplierMarch 6 runProduction runGB-31Gift boxDavid MillerCustomer

The recall question again. Start where the trouble starts: batch B-207.

hop 0 / 3

First, the idea in plain words

Not every question needs a graph. Table questions (find one row, add up many rows) are answered best by normal tables. Graph questions (follow connections from thing to thing) are where a knowledge graph wins.

The last skill of this lab is telling those two apart, because building a graph costs real work: extracting facts, keeping identities clean. You should only pay that cost when your questions need it.

Six questions a business actually asks. For each one, decide: does the answer travel across connections, or does it sit in rows?

Which customers are affected by this recalled batch?

How many gift boxes did we sell in March?

Is this new supplier connected to any past quality incident?

What is Maya Chen's phone number?

If Green Farms fails an inspection, which products are exposed?

What was the average order value last week?

0 / 6 sorted

First, the idea in plain words

You have watched a knowledge graph get built. The real test of understanding is building one from nothing. That is this station: your facts, your graph, your question.

Pick any small world you know well: your family, your favorite films, your morning routine, your team at work. Write facts about it, three parts each. The graph will draw itself, and then you will ask it a question.

Step 1 · Write your facts

Thing, connection, thing. For example: Maya, works at, City Bakery. Up to 10 facts. Or load the example and build on top of it.

Step 2 · Your graph, drawn from your facts

Your graph will appear here after your first fact. Every thing you name becomes a node. Every connection becomes a labeled edge.

Step 3 · Ask your graph a question

Pick two things. The lab walks your connections and finds how they are related, exactly like the recall traversal in station 5, but on your data.

Finish this station to continue