From keys to URIs
Why codes break when they leave their table, and how a URI carries its meaning with it.
What you’ll learn
By the end of this module you’ll be able to:
- explain why a key stops working once it leaves its table
- rewrite identifier columns and classification columns as URIs
- follow a URI to find out what it identifies
Joining tables on a key
Water quality monitoring produces three kinds of record. A sampling point is a place where water is collected. A sample is the water collected there on one occasion. An observation is one thing measured in that sample, such as its temperature.
This course follows one real sampling point, AN-CORBY: the final effluent from Corby sewage treatment works, where treated water leaves the works.
Each kind of record usually lives in its own table, and the tables are joined on keys.
| Sample | Sampling point | Sampled on |
|---|---|---|
1959114 | AN-CORBY | 31 January 2020 |
2119744 | AN-CORBY | 15 November 2025 |
3000117 | EX-0002 | 2 March 2026 |
| Sample | Determinand | Result | Unit |
|---|---|---|---|
1959114 | 0076 | 13.1 | °C |
2119744 | 0111 | <0.132 | mg/l |
3000117 | 0061 | 7.6 | pH units |
A determinand is the thing being measured. The determinand column holds a code, and a separate lookup list says what each code means.
| Code | Determinand |
|---|---|
0061 | pH |
0076 | Temperature of water |
0111 | Ammoniacal nitrogen as N |
Follow the keys
This activity’s URI: #activity-1Using the three tables above, find where and when sample 2119744 was collected, what was measured in it, and the result.
Show the answer
The effluent was collected at AN-CORBY on 15 November 2025 and measured for ammoniacal nitrogen as N. The result was less than 0.132 mg/l: the < means the amount was too small to measure more precisely than that. To get there you made two joins:
- In Samples, sample
2119744was taken atAN-CORBYon 15 November 2025. - In Observations, sample
2119744has determinand0111, and the Determinand lookup says0111is ammoniacal nitrogen as N.
Each join worked because you knew which table each code belonged to. That knowledge lived in your head, not in the data.
Where keys break
Inside one set of tables, keys work well. They start to fail as soon as data from somewhere else joins in, or the people who understood the codes move on.
The same key, a different thing
The Environment Agency isn’t the only organisation watching this effluent. The water company that runs Corby sewage treatment works keeps track of what leaves the works too. It takes its own samples of the final effluent, and its laboratory system numbers them its own way. One of its records also has the number 2119744.
| Sample | Site | Sampled on |
|---|---|---|
2119744 | Corby STW final effluent | 3 March 2026 |
Join this table to the observations on the number, and the company’s March sample picks up the Environment Agency’s November ammonia result. Both records describe the same effluent from the same works, so nothing looks wrong, and nothing in 2119744 says which numbering system it came from.
A key that needs a lookup
The code 0111 means nothing without the determinand lookup. The lookup travels separately from the data, as a spreadsheet, an appendix or a page on a website. When it goes missing or out of date, every table that uses the code loses its meaning with it.
A label instead of a key
Classifications are often typed in by hand. Here is how three sampling points have had their type recorded.
| Sampling point | Type |
|---|---|
EX-0002 | River |
EX-0003 | river |
EX-0004 | Rivers |
A person reads River, river and Rivers as the same thing. A computer grouping by that column sees three different types, each with one sampling point.
Count the rivers
This activity’s URI: #activity-2A colleague adds a fourth sampling point with the type Freshwater river. How many river sampling points are there now? Give the answer a person would give, then the answer a spreadsheet would give if you counted rows by type.
Show the answer
A person says 4. A count by type gives four types with 1 each: River, river, Rivers and Freshwater river.
You could tidy the labels, but the next person to type one will undo your work. The fix is to stop joining on what people type, which this module comes to in Classifications are keys too.
A key the whole web can use
All three problems have the same cause: the key only makes sense inside the table it came from. A URI (uniform resource identifier) is a key whose scope is the whole web. It carries its context with it.
Here is the sampling point AN-CORBY as a URI:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY
Each part of it does a job.
https://- How to look it up: with a web request, like any web address.
environment.data.gov.uk- Who is responsible for it. Only the owner of this domain can publish URIs under it. Module 2 is about this.
/water-quality/sampling-point/ - What kind of thing it is, and which collection it belongs to.
AN-CORBY- The sampling point’s notation: the original key, kept exactly as the data provider wrote it.
The original key is still there. The URI adds the context that used to live in your head: who issued the key and what kind of thing it identifies.
Notation: the key a thing’s owner gives it
The key at the end of the URI has a name. It’s the thing’s notation: a code that the organisation responsible for something uses to identify it. AN-CORBY is the notation of the sampling point, and 0111 is the notation of the determinand ammoniacal nitrogen as N.
A notation is different from a label. The label is the name a person reads; the notation is the code a system matches on. The Environment Agency publishes both for this sampling point:
- Notation
AN-CORBY- Label
- CORBY STW FINAL EFFLUENT
Labels get reworded, corrected and translated. A notation is assigned once and kept, which is why the URI is built from the notation. Linked Data records a thing’s notation and its label as separate statements, and Module 3 shows how.
The Environment Agency’s samples and observations get URIs in the same way, built on top of the sampling point’s URI:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY/sample/2119744
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY/sample/2119744/observation/0111
A sample is always taken at exactly one sampling point, so its URI carries on from the sampling point’s URI. An observation is always made on exactly one sample, and a sample has one observation per determinand, so the determinand code finishes the observation’s URI. Module 2 looks at this pattern more closely.
That also fixes the clash. The water company mints URIs for its own samples under its own domain, so the two samples of the same effluent can share the number 2119744 and still be told apart:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY/sample/2119744
https://water-company.example/corby-stw/final-effluent/sample/2119744
The Environment Agency publishes AN-CORBY and its samples and observations. URIs with a domain ending .example are made up for this course: that ending is reserved for examples and documentation.
And any two datasets that use the same URI join correctly, whoever made them, without either side knowing about the other.
Write a URI
This activity’s URI: #activity-3Sample 1959114 was also taken at AN-CORBY. Write the URI for its observation of determinand 0076, temperature of water.
Show the answer
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY/sample/1959114/observation/0076
Start from the sampling point, add the sample, then add the determinand. Each step is a key you already had in the tables, which is what makes the pattern predictable enough to write by hand.
Classifications are keys too
Columns like determinand and type classify a record. They deserve URIs as much as the records do. Each value becomes a concept: a thing in its own right, with one URI and one place where its label is kept.
https://data.example/determinands/Concept/0111
https://data.example/sampling-point-types/Concept/river
Each concept’s URI is made from the name of its group of concepts, the word Concept, and the concept’s notation. These two use a made-up domain.
Now the data stores the concept’s URI, and the concept holds its label. Every sampling point on a river points at the same URI, so a filter or a count matches exactly. River, river and Rivers become one concept with one label.
The label is also free to change. If the determinand is renamed, or given a Welsh label alongside the English one, the concept changes in one place and every observation that uses its URI stays as it is.
A group of related concepts, such as every determinand or every sampling point type, is called a concept scheme. Module 3 covers how to describe one.
Following a URI
A URI is also a web address. People care about the things the data describes, so a URI should tell anyone who looks it up what it identifies. The lookup list that used to travel separately is now one request away.
Looking up a URI is called dereferencing it.
Look up a sampling point
This activity’s URI: #activity-4Open the URI for AN-CORBY (opens in new tab) in your browser. Write down two facts about the sampling point that the tables in this module leave out.
What this shows
The sampling point page tells you, among other things, that AN-CORBY is Corby STW final effluent, that it’s a sewage discharge of treated effluent from a water company, and that it’s in the Environment Agency’s Anglian region.
Everything you found came from the key itself. The URI did the job of the lookup file, and of the colleague who knew what the codes meant.
Your browser asked for a web page, so that’s what came back. A program asking for the same URI can get data instead. Module 4 shows how.
Check your understanding
Choose an answer to see whether it’s right. You can change your answer as often as you like.
You’ve answered of 5 questions and got right.
Module 1 complete
You answered every question correctly
Summary
In this module you learned that:
- a key only makes sense inside the table it came from, and the knowledge needed to join on it lives outside the data
- a URI is a key whose scope is the whole web: it names who is responsible, what kind of thing it is, and keeps the original key
- classifications become concepts with URIs of their own, so filters match exactly and labels can change in one place
- a URI can be looked up, and looking it up tells you what it identifies
Module 2 picks up the domain in the URI: who gets to mint URIs, how to design them, and why they should only change when the thing they identify does.