Authority, minting and persistence
Who is responsible for a URI, how to mint one, and why identifiers should only change when the thing they identify does.
What you’ll learn
By the end of this module you’ll be able to:
- decide which organisation should mint the URI for a thing
- choose between reusing an existing URI and minting a new one
- design a URI pattern built from stable facts about the thing
- shorten URIs with prefixes, and read prefixed names back
- name the parts of a thing with nested paths and hash URIs
- recognise which changes should leave a URI alone
The Environment Agency publishes AN-CORBY and its samples and observations, and QUDT publishes the unit of measure in Minting a URI. URIs with a domain ending .example are made up for this course: that ending is reserved for examples and documentation.
Who a URI belongs to
In Module 1 the domain in a URI told you who was responsible for it. That responsibility comes from owning the domain. An organisation registers a domain such as environment.data.gov.uk, and from then on it alone decides what the addresses under it mean.
Anyone can write any URI into their own data. Only the owner of the domain can make it work: answer when someone looks it up, and say what it identifies. That is what authority means for a URI.
So the right place for a URI is the domain of the organisation responsible for the thing. The Environment Agency is responsible for the sampling point AN-CORBY, so its URI lives under the Environment Agency’s domain:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY
A council that runs an air quality sensor is responsible for that sensor, so its URI belongs under the council’s domain, even though the data is environmental too:
https://council.example/air-quality/sensor/AQ-017
Putting the sensor under environment.data.gov.uk would hand the job of keeping it working to an organisation that has no say over the sensor.
Minting a URI
Creating a new URI for a thing is called minting it. Before you mint one, check whether the thing already has a URI from the organisation responsible for it.
Mint when you are responsible
When the thing is yours, mint its URI from the key that its owners already use. The sampling point’s notation AN-CORBY is what the Environment Agency, which monitors it, already calls it, so it goes into the URI. Samples and observations follow the same rule: sample 2119744 keeps its number, and the observation keeps its determinand code, 0111.
Databases usually give each row a number of their own as well. That number belongs to the database: it identifies a row in one table, in one system. It stays inside the database.
| Row | Notation |
|---|---|
| 48213 | AN-CORBY |
Reuse when someone else is responsible
Plenty of what you describe belongs to someone else. Units of measure are a good example: they’re published as concepts with their own URIs, and a result in milligrams per litre can point at the published unit:
http://qudt.org/vocab/unit/MilliGM-PER-L
Every dataset that reuses that URI agrees, exactly, on what mg/l means, and they all join on it. The same goes for anything another organisation runs. If your data mentions a council’s air quality sensor, it points at the council’s URI for that sensor.
Who mints it?
This activity’s URI: #activity-1You publish water quality data for the Environment Agency. For each of these, decide whether you mint a URI or reuse one, and under which domain it lives.
- The sampling point
AN-CORBY - Sample
2119744, taken atAN-CORBY - The unit milligrams per litre
- A council’s air quality sensor next to the works
Show the answer
- Mint it under your own domain, from the notation
AN-CORBY. - Mint it under your own domain too, built on the sampling point’s URI. The sample is your record.
- Reuse the published unit URI. Units are shared by everyone.
- Reuse the council’s URI, under the council’s domain. The sensor is theirs.
URIs people can read
A good URI names the thing directly, in words a person recognises:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY
Someone reading it can tell what it identifies before they look it up. And the path works as a way round the service. Take the determinand off the end of an observation’s URI and you have its sample. Take the sample off and you have the sampling point it came from:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY/sample/2119744/observation/0111
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY/sample/2119744
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY
A person can find their way round by editing the address, the same way they would on any website. The URI is the interface.
A good pattern is built only from stable facts about the thing:
- a domain the responsible organisation intends to keep
- the kind of thing, in plain words, such as
sampling-point - the key the thing’s owners already use, such as
AN-CORBY
What makes a URI fragile
A URI is fragile when it contains something that changes on its own schedule, faster than the thing it identifies. Watch for:
- software versions and product names, such as
api/v2, which change whenever the software is upgraded or replaced - system names, such as a database or laboratory system in the domain, which go when the system is retired
- organisation structure, such as a team or department name, which changes with every reorganisation
- database row numbers, which can be renumbered in a migration and mean nothing outside the database
- plumbing words, such as
/api/or/id/, which tell a person nothing about the thing and make the URI look less useful and more imposing than it is
The first four will change while the sampling point stays exactly where it is, and each change breaks the URI for everyone who joined on it. Plumbing words make the URI harder to use from the day it’s published.
Spot the fragile parts
This activity’s URI: #activity-2Each of these URIs identifies the same sampling point. Using the list above, find the fragile part of each one.
https://data.example/api/ v2/ sampling-point?row=48213 https://lims-prod.example/sampling-point/ AN-CORBY https://data.example/anglian-region-team/ sampling-point/ AN-CORBY https://data.example/id/ sampling-point/ AN-CORBY
Show the answer
api/v2ties the URI to one version of one piece of software, androw=48213is a database number that means nothing outside that database. The next version or the next migration breaks it.lims-prodnames a system. When the system is replaced, the domain goes with it.anglian-region-teamrecords an organisation chart. Teams are renamed and merged far more often than sampling points move.idtells a person nothing about the thing. Likeapi, it’s plumbing on show, and it makes the URI look less useful and more imposing than it is.
Prefixes
Full URIs are long to read and easy to mistype. A prefix is a short name that stands for the start of a URI, so the rest can be written after a colon.
- Prefix
sampling-point:- Stands for
https://environment.data.gov.uk/water-quality/ sampling-point/ - Prefixed name
sampling-point:AN-CORBY- Full URI
https://environment.data.gov.uk/water-quality/ sampling-point/ AN-CORBY
A prefix is only shorthand. The data still means the full URI, and a prefix only makes sense alongside the line that declares what it stands for. This page uses one: its source declares dct: as shorthand for the Dublin Core terms, then uses dct:modified to say when the page last changed.
Shorten and expand
This activity’s URI: #activity-3The prefix corby-sample: stands for https://environment.data.gov.uk/.
- Write the prefixed name for
https://environment.data.gov.uk/.water-quality/ sampling-point/ AN-CORBY/ sample/ 2119744 - Write the full URI for
corby-sample:1959114.
Show the answer
corby-sample:2119744https://environment.data.gov.uk/water-quality/ sampling-point/ AN-CORBY/ sample/ 1959114
Swap the prefix for the URI it stands for, or the other way round. Nothing else changes.
Naming the parts of a thing
Some things belong to something else. A sample belongs to the sampling point it was taken at, and an observation belongs to the sample it was made on. Giving a part a name built from its parent’s name is a useful idea, and there are two common ways to write it.
Nested paths, for parts with one parent
Water quality nests each part’s URI under its parent’s:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY/sample/2119744/observation/0111
The nesting is a promise about cardinality, meaning how many of one thing go with another:
- every sample is taken at exactly one sampling point
- every observation is made on exactly one sample
- a sample has one observation per determinand, so the determinand code is enough to pick out the observation
Because the promise holds, the URI states where the part belongs, and walking back up the path takes you to its parent. Nest only where the parent can never change. AN-CORBY sits in the area Anglian – Lincs and Northants, and areas can be redrawn, so the sampling point links to its area and keeps a URI of its own.
Hash URIs, for parts that travel with their parent
The web has always named parts of a page with a # on the end of the address. A hash URI uses the same idea to name a part of a resource that is always delivered together with it.
When you ask for AN-CORBY, you also get its location: a point on the British National Grid. The location only ever comes with the sampling point, so it’s named with a hash URI on the end of the sampling point’s:
https://environment.data.gov.uk/water-quality/sampling-point/AN-CORBY#Geometry
This course does the same for its own activities: Shorten and expand has the URI #activity-3 on the end of this page’s address, so a teacher can link straight to it.
Nested paths and hash URIs are a matter of style. The idea underneath is the same: a part gets a name that tells you what it belongs to.
Cool URIs don’t change
“Cool URIs don’t change” is the title of a short note Tim Berners-Lee wrote in 1998. The argument is about discipline: change an identifier only when the thing it identifies has changed.
Country codes show how this works. Under the ISO 3166 standard, GB has identified the United Kingdom since the standard was first published. Passport systems, shipping forms, postal services and countless datasets depend on it, so it stays put. Changing it would break all of them at once, for no gain.
URIs deserve the same treatment. Once a URI is published, other people’s data starts joining on it, and you can’t see who they are. Every change breaks joins you don’t know about.
So a URI should outlive the things around it:
- a renamed team or a reorganisation
- a new database or a data migration
- a rebuilt website or a new software platform
- a record being deleted and reloaded with corrected details
In each case the sampling point is exactly where it was, so its URI stays the same. When a sampling point’s record is replaced with a fresh one, its URI carries over to the new record, and everything that joined on it keeps working.
A URI changes when the thing changes. If effluent is collected from a different outfall, that’s a different place: it gets a new notation and a new URI. The old URI keeps describing the old place, so the results recorded against it still mean what they meant.
What changes the URI?
This activity’s URI: #activity-4Over five years, all of these happen to the sampling point AN-CORBY. Which of them should give it a new URI?
- The team that runs it is renamed.
- Its data moves from one database to another.
- It’s moved into a different sub-area after a boundary review.
- The website that publishes it is rebuilt.
- The works is rebuilt, and the final effluent now leaves through a new outfall 2 kilometres away.
Show the answer
Only the last one. A new outfall means collecting effluent from a different place, so it’s a new sampling point with a new URI. The old URI keeps describing the old outfall.
The sub-area change alters what is said about the sampling point. It’s still the same place, so it keeps its URI and its description is updated.
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 2 complete
You answered every question correctly
Summary
In this module you learned that:
- authority over a URI comes from owning its domain, so a URI belongs under the domain of whoever is responsible for the thing
- you reuse a URI when someone else is responsible for the thing, and mint one when you are
- a good URI pattern uses a lasting domain, the kind of thing in plain words, and the key its owners already use
- a prefix is shorthand for the start of a URI, and the data always means the full URI
- a part with exactly one parent can be named with a nested path, and a part delivered with its parent with a hash URI
- a URI changes only when the thing it identifies changes, just as
GBhas stayedGB
Module 3 starts making statements with these URIs: what a sampling point is, which samples were taken there, and what was observed in them.