ER 2026 · St. John's · Tutorial · Wed 7 Oct
We model a real palm oil supply chain, from Indonesian districts and mills to EU importers, directly as a TypeDB schema, then load and query it. Everything you need to follow along is on this page.
You need a TypeDB server and a web browser.
http://localhost:8000, admin, password by defaultReady to go!
Reading the header and a first row, the easiest things to model are the places: the country, the province and the kabupaten (district) the palm oil comes from.
Presumably the places nest: a kabupaten lies in a province, which lies in a country.
The next columns are harder: the same names turn up as a mill's group, a refinery, an exporter and an importer. Is a refinery_group a different kind of thing from an exporter_group?
A few real rows (scroll sideways for more columns). Coloured: a name that appears more than once in the same row, each name in its own colour. NOT REFINED marks crude palm oil.
The data sheet says each *_group column "groups the [X] column into parent companies where applicable". So there are really only companies and facilities (mills and refineries), linked by ownership, and exporter is a role a company plays, not a kind of company.
In some rows LDC EAST INDONESIA is both the refinery and the exporter, and LOUIS DREYFUS is the refinery's group.
We read this as: the company LDC EAST INDONESIA owns the refinery of the same name and handles exports, and LOUIS DREYFUS is its parent company. So companies need to be ownable by other companies too.
The data has two commodities, PALM OIL and REFINED PALM OIL. How would you model them?
Each row of the data is one trade flow linking a district, a mill, sometimes a refinery (crude palm oil isn't refined), an exporter, an importer, a destination country and a commodity. How would you model the flow itself?
Snippets 1–6 combined into a single define query. Use this if you want a clean start.
The data comes from Trase's open supply-chain data: 81 real trade flows of palm oil from East Kalimantan, Indonesia, to EU countries in 2022.
Benedict, J. J., Biddle, H., Gollnow, F., Heilmayr, R., Mueller, C., Ribeiro, V., & Suavet, C. (2024). Indonesia palm oil supply chain (2018–2022) (Version 1.2) [Data set]. Trase. https://doi.org/10.48650/X83N-7M36. Licensed CC BY 4.0.
NOT REFINED means the flow has no refiner. When importer_group equals importer, no parent is recorded. A refinery that shares its name with an exporter is read as owned by that company.One insert query loads everything.
Results are for the demo data.
deforestation_ha) by importer.A facility can sit under several layers of companies. Can one query find all of a facility's owners?
These are meant to fail. The first two are rejected by the type checker before anything runs; the third breaks a schema constraint when it's committed.