---
title: Linked data
url: https://docs.triply.cc/concepts/linked-data/
description: 'What linked data is: every fact as a triple, the three kinds of term, and why you would
  publish this way rather than in a relational database.'
---

# Linked data

Linked data is a way of publishing information so that systems that have never
been connected before can read it and combine it. Instead of tables with fixed
columns, linked data records every fact as a small, self-contained statement.
This page explains what those statements look like, how they are named, and why
you would choose this over a conventional database.

## Every fact is a triple

A **triple** is the smallest possible statement about the world. It has three
parts: a **subject**, a **predicate**, and an **object**.

- *Pikachu* — *knows* — *Mew*
- *Pikachu* — *weight* — *60*

The subject is what the statement is about. The predicate is the property being
stated. The object is the value. Nothing else is needed, and nothing else is
allowed.

A **quad** adds a fourth part: the **graph** the statement belongs to. Graphs let
you keep track of where a statement came from, so you can update or remove one
source without touching the rest.

Written in Turtle, one of the standard text formats for linked data, the two
statements above look like this:

```turtle
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix id:   <https://triplydb.com/academy/pokemon/id/pokemon/>
prefix vocab: <https://triplydb.com/academy/pokemon/vocab/>

id:pikachu
  foaf:knows id:mew;
  vocab:weight 60.
```

Because every fact stands on its own, adding a new kind of fact means adding a
new predicate. It does not mean changing a schema.

## Three kinds of term

Each position in a triple holds a term, and there are three kinds.

**IRIs** identify things. An IRI (Internationalized Resource Identifier) is a web
address that names a resource: a product, a person, a concept, a relationship.
Subjects are IRIs. Predicates are always IRIs. Objects can be IRIs. Because IRIs
are globally unique, two organisations that use the same IRI are provably talking
about the same thing.

**Literals** hold values: text, numbers, dates. A literal carries a **datatype**
that says how to read it — `xsd:integer`, `xsd:date`, `xsd:string`. A text
literal can instead carry a **language tag**, so `"ピカチュウ"@ja` and
`"Pikachu"@en` are two labels for one resource rather than two conflicting
values. Literals only ever appear in the object position.

**Blank nodes** stand for something that exists but has no name yet — an address
that is only meaningful as part of a person's record, for example. Blank nodes
are convenient while modelling, but they cannot be linked to from outside the
dataset. Give anything you expect others to refer to a real IRI.

## Namespaces and prefixes

Full IRIs are long. In practice you declare a **namespace** once and abbreviate
it with a **prefix**, so
`<http://xmlns.com/foaf/0.1/knows>` becomes `foaf:knows`. This is shorthand only:
the two are the same IRI.

Prefixes matter more than they look. They make data readable, they keep
namespace changes to a single line, and they are what turns a wall of IRIs into
something a domain expert can review.

## Graphs group statements

A dataset is a collection of triples. Within a dataset, **named graphs** group
statements that belong together — one graph per source file, per import run, or
per data model. In TriplyDB you can see this directly: the linked data table
shows the subject, predicate and object of every triple, and a fourth column for
the graph it belongs to.

![The linked data table in TriplyDB, showing subject, predicate, object and graph columns](https://docs.triply.cc/assets/linked-data-table.png)

The same data can also be read one resource at a time. The linked data browser
shows a single node with its properties, and you follow a property to move to the
next node.

![The linked data browser in TriplyDB](https://docs.triply.cc/assets/ld-browser.png)

## Why not a relational database?

A relational database is built around a fixed schema. It performs well when you
know what your data looks like and that shape rarely changes. Linked data is the
better fit when:

- **The structure keeps changing.** A new kind of fact needs a new predicate, not
  a migration.
- **The data comes from several sources.** Datasets from different organisations
  merge by loading them into the same store and querying across them.
- **The data is uneven.** Not every instance needs the same properties. That is
  awkward in a relational model and normal in linked data.
- **Other systems need to read it.** A system that has never talked to yours can
  consume your data, because the standards and the identifiers are public.

This is also the reason linked data is the usual answer to the **FAIR**
principles for research and government data. Two of the four FAIR requirements —
that data carry globally unique, persistent identifiers, and that they use shared
vocabularies — are properties linked data has by construction rather than by
policy.

The cost is real too. You have to decide on IRIs before you publish, agree on
vocabularies with the people you exchange data with, and accept that a triple
store is not the right place for high-volume transactional writes.

## Where this appears in Triply products

- **TriplyDB** stores your data as triples and shows them in the linked data
  table and the linked data browser.
  See [Data views](https://docs.triply.cc/reference/data-views/).
- **SPARQL** queries these triples by matching patterns against them.
  See [SPARQL](https://docs.triply.cc/concepts/sparql-basics/).
- Terms used on this page are defined in the [Glossary](https://docs.triply.cc/reference/glossary/).

## Where to next

- [Knowledge graphs](https://docs.triply.cc/concepts/knowledge-graphs/) — what happens when connected data grows
  past a single dataset
- [OWL and ontologies](https://docs.triply.cc/concepts/owl-and-ontologies/) — agreeing on what your terms mean
- [SPARQL](https://docs.triply.cc/concepts/sparql-basics/) — asking questions of the triples you have just met
- [Glossary](https://docs.triply.cc/reference/glossary/) — every term on this page, in one place
