Linked Data Bootcamp

BetaThis is a new course. Quizzes are marked in your browser as you answer.

Module 3 of 9

Triples and vocabularies

Statements as triples, and the vocabularies that describe catalogues, concepts and observations: DCAT, SKOS and SOSA.

What you’ll learn

By the end of this module you’ll be able to:

  • read and write statements as subject, predicate and object
  • explain how triples that share a URI join into a graph
  • give a literal value the right datatype or language
  • recognise a value with structure and no name of its own
  • say which vocabulary a statement comes from, and why

Everything about AN-CORBY on this page comes from the Environment Agency’s Water Quality service. The concept URIs use domains ending .example and are made up for this course, following the same pattern as the rest of the course. The vocabularies are the ones the DSP Application Profile sets out for environmental data on environment.data.gov.uk.

A statement in three parts

Linked Data says things one small statement at a time. Each statement has three parts, so it’s called a triple:

Subject
The thing the statement is about. Always a URI.
Predicate
What is being said about it. Also a URI, taken from a shared vocabulary.
Object
The value: either another thing’s URI, or a plain value such as a name, a number or a date.

Here are three triples about the sampling point. Each row is one statement.

Triples about AN-CORBY
SubjectPredicateObject
<sampling-point/AN-CORBY>skos:notation"AN-CORBY"
<sampling-point/AN-CORBY>skos:prefLabel"CORBY STW FINAL EFFLUENT"
<sampling-point/AN-CORBY>skos:altLabel"CORBY STW F/E"

These are the notation and label you met in Module 1, now as statements of their own. skos:prefLabel is the preferred label, the name to show a person, and skos:altLabel is another name the same thing goes by.

Two kinds of shorthand keep the tables readable. A URI in angle brackets, such as <sampling-point/AN-CORBY>, is relative to the Water Quality service’s address, https://environment.data.gov.uk/water-quality/, in the same way a link on a web page can be relative to its site. Where a URI is long, … stands for the start of its path, so <…/observation/0111> is the observation of determinand 0111 in sample 2119744. Names such as skos:prefLabel are prefixed names, which you met in Module 2.

Prefixes used on this page
skos:
http://www.w3.org/2004/02/skos/core#
sosa:
http://www.w3.org/ns/sosa/
qudt:
http://qudt.org/schema/qudt/
unit:
http://qudt.org/vocab/unit/
geo:
http://www.opengis.net/ont/geosparql#
dcat:
http://www.w3.org/ns/dcat#
dct:
http://purl.org/dc/terms/
defra-core:
http://environment.data.gov.uk/ontology/core/
xsd:
http://www.w3.org/2001/XMLSchema#
rdf:
http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs:
http://www.w3.org/2000/01/rdf-schema#
owl:
http://www.w3.org/2002/07/owl#
ex:
http://www.example.org/
dataset:
https://data.example/
determinand:
https://data.example/determinands/Concept/
area:
https://data.example/areas/Concept/
sampling-point-type:
https://data.example/sampling-point-types/Concept/

A row becomes several triples

A row in a table packs several facts together. In triples, each fact is stated on its own, and sometimes a row turns out to describe more than one thing.

Activity 1

Turn a row into triples

This activity’s URI: #activity-1

Module 1’s Samples table had this row:

SampleSampling pointSampled on
2119744AN-CORBY15 November 2025, 08:43

Write it as triples. You’ll need three predicates:

  • sosa:isSampleOf, from a sample to what it was taken from
  • sosa:isResultOf, from a sample to the sampling, the act of collecting it
  • sosa:startTime, from a sampling to when it started

The sampling has the URI <sampling-point/AN-CORBY/sampling/2119744>.

Show the answer
SubjectPredicateObject
<…/sample/2119744>sosa:isSampleOf<sampling-point/AN-CORBY>
<…/sample/2119744>sosa:isResultOf<…/sampling/2119744>
<…/sampling/2119744>sosa:startTime"2025-11-15T08:43:00"^^xsd:dateTime

One row became three triples about two things. The date belongs to the sampling, not the sample: the sample is the water, and the sampling is the act of collecting it. The table had been holding both in one row. You’ll meet the ^^xsd:dateTime on the end of the date in Literals: values with a type.

Triples join into a graph

Here are the observation of ammoniacal nitrogen in sample 2119744 and the triples around it:

Triples about the observation, and what it points to
SubjectPredicateObject
<…/observation/0111>sosa:hasSample<…/sample/2119744>
<…/observation/0111>sosa:observedPropertydeterminand:0111
<…/observation/0111>sosa:phenomenonTime"2025-11-15T08:43:00"^^xsd:dateTime
<…/sample/2119744>sosa:isSampleOf<sampling-point/AN-CORBY>
<sampling-point/AN-CORBY>skos:prefLabel"CORBY STW FINAL EFFLUENT"
determinand:0111skos:prefLabel"Ammoniacal Nitrogen as N"

Wherever the same URI appears in two triples, the two statements are about the same thing, so they connect. Draw each URI once and each triple as an arrow, and the statements become a graph:

The observation of ammoniacal nitrogen as a graph The observation links by sosa:hasSample to sample 2119744, which links by sosa:isSampleOf to the sampling point AN-CORBY, whose skos:prefLabel is CORBY STW FINAL EFFLUENT. The observation also links by sosa:observedProperty to determinand 0111, labelled Ammoniacal Nitrogen as N, and by sosa:hasResult to an unnamed result, which has qudt:upperBound 0.132 and qudt:hasUnit milligrams per litre. sosa:observedProperty skos:prefLabel sosa:hasSample sosa:hasResult qudt:upperBound qudt:hasUnit sosa:isSampleOf skos:prefLabel …/observation/0111 determinand:0111 "Ammoniacal Nitrogen as N" …/sample/2119744 [ ] 0.132 unit:MilliGM-PER-L …/AN-CORBY "CORBY STW FINAL EFFLUENT"
The observation’s triples drawn as a graph. Each URI appears once, however many triples mention it.
  • A thing with a URI
  • A literal value
  • A thing with no URI of its own

This is the join from Module 1, done without a lookup. There, you matched codes across three tables and needed to know which table each code came from. Here, the URIs carry that knowledge, so following an arrow is the join.

Graphs from different places combine the same way. Put the triples from two sources together and any URI they share becomes a single point where the two graphs meet. That’s why the Environment Agency’s observations, a council’s sensors and a water company’s samples can be combined without a mapping table, as long as they use the same URIs for the things they share.

Activity 2

Follow the graph

This activity’s URI: #activity-2

Start at the observation. Which predicates do you follow, in order, to find the name of the place the effluent was collected?

Show the answer

sosa:hasSample to the sample, sosa:isSampleOf to the sampling point, then skos:prefLabel to its name, CORBY STW FINAL EFFLUENT.

Three hops, three triples, and no lookup file. In Module 9 you’ll ask exactly this question in SPARQL.

Literals: values with a type

An object is either a URI, which links to another thing, or a literal: a plain value. A literal can carry a datatype, written after ^^, which says what kind of value it is.

Literals from the Water Quality data
LiteralWhat it is
"AN-CORBY"A string: the sampling point’s notation
"2025-11-15T08:43:00"^^xsd:dateTimeA date and time: when the sampling started
"2025-12-24"^^xsd:dateA date: when the sampling’s result became available
"0.132"^^xsd:decimalA decimal number: the upper bound of a result

The datatype is what makes a value behave. As a date, "2025-12-24" sorts, compares and falls inside a date range correctly. As a number, "0.132" can be checked against a limit. Without the datatype, both are just characters, and characters sort in the wrong order: as text, “10” comes before “9”.

Labels in more than one language

A string meant for people can carry a language tag after @, so the same thing can be labelled in each language its readers use. The application profile’s own example labels Wales in English and Welsh:

SubjectPredicateObject
ex:W92000004skos:prefLabel"Wales"@en
ex:W92000004skos:prefLabel"Cymru"@cy
ex:W92000004skos:notation"W92000004"

The labels carry language tags; the notation carries none. A notation is a code, the same in every language, which is the difference between a notation and a label from Module 1.

Activity 3

Literal or link?

This activity’s URI: #activity-3

For each of these objects, say whether it’s a literal or a link to another thing. For each literal, say what kind of value it is.

  1. "CORBY STW F/E"
  2. <sampling-point/AN-CORBY>
  3. "2025-12-24"^^xsd:date
  4. unit:MilliGM-PER-L
  5. "Cymru"@cy
Show the answer
  1. A literal: a string, the sampling point’s alternative label.
  2. A link, to the sampling point.
  3. A literal: a date.
  4. A link, to the published unit milligrams per litre. A prefixed name is a URI written short, so it’s a link too.
  5. A literal: a string in Welsh.

Values with structure

The ammoniacal nitrogen result is <0.132 mg/l. That short value says three things: there is a result, it’s at most 0.132, and it’s measured in milligrams per litre. The < means the amount was too small to measure more precisely than that.

The observation states the result twice: once as the text a person reads, and once with its parts separated so a program can work with them.

The observation’s result
SubjectPredicateObject
<…/observation/0111>sosa:hasSimpleResult"<0.132"
<…/observation/0111>sosa:hasResult_:result
_:resultaqudt:QuantityValue
_:resultqudt:upperBound"0.132"^^xsd:decimal
_:resultqudt:hasUnitunit:MilliGM-PER-L

The result is a thing in its own right, with a value and a unit, but it’s only ever reached through its observation. It has no URI of its own. A thing like this is called a blank node, and _:result is a label for it that only means something inside this set of triples. In the graph above, it’s the dashed circle.

Compare AN-CORBY#Geometry from Module 2. The location gets a hash URI because people link to it directly. The result goes with its observation, which already has a URI.

Vocabularies

Every predicate on this page comes from a published vocabulary: a set of predicates and classes that an organisation has defined, published under its own domain and promised to keep. Reusing them is the same decision as reusing a unit URI in Module 2. When everyone says “preferred label” with skos:prefLabel, everyone’s labels can be found the same way.

Each vocabulary answers one kind of question.

The vocabularies used for environmental data
VocabularyPrefixAnswers
SKOSskos:What is this called, what is its code, and how do concepts relate?
SOSA/SSNsosa:What was sampled, what was observed, and what was found?
QUDTqudt: unit:What quantity, in which unit?
GeoSPARQLgeo:Where is it, and what is it within?
DCATdcat:Which datasets exist, and in which catalogue?
Dublin Coredct:Who published it, and on what terms?
RDFS and OWLrdfs: owl:Which classes and predicates exist?
Defra coredefra-core:Which kind of this thing is it?

SKOS: concepts and their codes

SKOS (Simple Knowledge Organization System) describes concepts: the determinands, sampling point types and areas from Module 1. Each concept has a notation and a preferred label, and belongs to a concept scheme, the group it comes from. Concepts can be arranged into a hierarchy with skos:broader and skos:narrower.

The determinand 0111
SubjectPredicateObject
determinand:0111skos:notation"0111"
determinand:0111skos:prefLabel"Ammoniacal Nitrogen as N"
determinand:0111skos:altLabel"Ammonia(N)"
determinand:0111skos:inSchemedataset:determinands

This is the determinand lookup from Module 1, published once as data, where every observation can point at it.

SOSA/SSN: sampling and observing

SOSA (Sensor, Observation, Sample and Actuator) describes the chain you’ve followed all along. The sampling point is the feature of interest, the thing being studied. A sampling collects a sample from it, and an observation measures a property of the sample and records a result.

QUDT: quantities and units

QUDT (Quantities, Units, Dimensions and Types) describes numbers with units: the qudt:QuantityValue holding the result, its qudt:upperBound, and the unit it’s measured in.

GeoSPARQL: places and shapes

GeoSPARQL describes where things are. The sampling point has a geometry, a point on the British National Grid, and sits within an area:

SubjectPredicateObject
<sampling-point/AN-CORBY>geo:hasGeometry<sampling-point/AN-CORBY#Geometry>
<sampling-point/AN-CORBY>geo:sfWithinarea:M
area:Mskos:prefLabel"ANGLIAN - LINCS AND NORTHANTS"

This is the link from Module 2: the sampling point keeps its own URI and points at its area, which can be redrawn. A later module covers GeoSPARQL in depth.

DCAT: catalogues and datasets

DCAT (Data Catalog Vocabulary) describes what is published. Each service has a catalogue that lists its datasets. A concept scheme, such as the determinands, is a dataset too, so it’s listed in the catalogue alongside the observations. A dataset of observations declares which concept schemes classify its members:

SubjectPredicateObject
dataset:observationsdcat:themeTaxonomydataset:determinands

That one triple tells a program, before it reads a single observation, that observations in this dataset can be filtered by determinand.

Dublin Core: who published it, and on what terms

Dublin Core provides general-purpose predicates for describing published things, such as dct:title, dct:publisher and dct:license. Every dataset in a catalogue carries them:

SubjectPredicateObject
dataset:observationsdct:title"Water quality observations"@en
dataset:observationsdct:publisher<https://environment.data.gov.uk/>
dataset:observationsdct:license<https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/>

A licence that is a URI can be followed and checked by a program, the same as any other link.

RDFS and OWL: when nothing fits

Sometimes no published vocabulary has the predicate or class you need. Then you define your own with RDFS and OWL, under a domain you control, giving each one a label and a comment that says when to use it. Defra’s domain model does this for regulatory and water terms, under the prefix defra-core:. Check the vocabularies above first: a predicate someone else already publishes is one every reader already understands. One of Defra’s own predicates, defra-core:hasClassification, is covered in Classifications.

Activity 4

Which vocabulary?

This activity’s URI: #activity-4

Which vocabulary does each predicate come from, and what question does it answer?

  1. skos:notation
  2. sosa:observedProperty
  3. qudt:hasUnit
  4. geo:sfWithin
  5. dcat:themeTaxonomy
  6. dct:license
Show the answer
  1. SKOS: what is this thing’s code?
  2. SOSA/SSN: what property did this observation measure?
  3. QUDT: which unit is this value in?
  4. GeoSPARQL: what is this thing within?
  5. DCAT: which concept schemes classify this dataset’s members?
  6. Dublin Core: on what terms can this be used?

The prefix tells you the vocabulary, as long as you know what the prefix stands for.

Classes and classifications

One predicate says what kind of thing something is: rdf:type, usually written as just a. Its object is a class, and a thing can belong to more than one:

SubjectPredicateObject
<sampling-point/AN-CORBY>asosa:FeatureOfInterest
<sampling-point/AN-CORBY>ageo:Feature
<sampling-point/AN-CORBY/sample/2119744>asosa:Sample
<…/observation/0111>asosa:Observation

AN-CORBY is both a feature of interest, something observed, and a feature, something with a place on a map. Each class brings its own vocabulary’s predicates with it, which is how one sampling point can have SOSA observations and a GeoSPARQL geometry at the same time.

Classifications: a finer kind without a new class

A class says what something fundamentally is. Often you also need to say which kind of that thing it is. You could make a class for every kind, such as River, Lake and Canal, but then every new kind means changing the vocabulary itself.

Defra’s domain model keeps the class general and adds a classification: a concept from a concept scheme, attached with defra-core:hasClassification. The River Irwell is a water body, and its classification says which kind of water body:

SubjectPredicateObject
ex:irwellaex:WaterBody
ex:irwelldefra-core:hasClassificationex:river
ex:riveraskos:Concept

A sampling point is classified the same way, by its sampling point type:

SubjectPredicateObject
<sampling-point/AN-CORBY>defra-core:hasClassificationsampling-point-type:SA
sampling-point-type:SAskos:notation"SA"
sampling-point-type:SAskos:prefLabel"SEWAGE DISCHARGES - FINAL/TREATED EFFLUENT - WATER COMPANY"

A new kind of sampling point is a new concept in the scheme, which can be added without touching any class. Because each classification is a concept, it has a notation and a label like any other, and a dataset can declare the scheme with dcat:themeTaxonomy so programs know they can filter by it.

The predicate’s range is what makes it fit. The range of a predicate says what its object should be. defra-core:hasClassification has the range skos:Concept, so its object is always a concept with a notation and a label. Dublin Core’s dct:type has the range rdfs:Class, so it suits pointing at a class.

Check your understanding

Choose an answer to see whether it’s right. You can change your answer as often as you like.

Question 1 of 5In the triple <…/sample/2119744> sosa:isSampleOf <sampling-point/AN-CORBY>, which part is the predicate?

Correct

Not quite

Question 2 of 5Two publishers each send you triples that mention <sampling-point/AN-CORBY>. What happens when you put their triples together?

Correct

Not quite

Question 3 of 5Why does the sampling’s start time carry the datatype xsd:dateTime?

Correct

Not quite

Question 4 of 5The result <0.132 mg/l is held in a blank node. Why is that a good fit?

Correct

Not quite

Question 5 of 5Which vocabulary would you use to publish the notation and label of a determinand?

Correct

Not quite

You’ve answered of 5 questions and got right.

Module 3 complete

You answered every question correctly

Summary

In this module you learned that:

  • a triple is one statement: a subject, a predicate and an object
  • triples that share a URI join into a graph, and graphs from different places combine the same way
  • an object is a link to another thing or a literal, and a literal can carry a datatype or a language tag
  • a value with structure that is only reached through its parent can be a blank node
  • predicates and classes come from published vocabularies, each answering one kind of question
  • a says what class a thing belongs to, a thing can belong to several, and defra-core:hasClassification adds a finer kind as a concept

Module 4 writes these same triples in the formats you’ll meet: Turtle, N-Triples, RDF/XML, JSON-LD and RDFa, and asks one URI for different formats.