URIs and Prefixes

How things are identified and how prefixes keep URIs readable.

Every thing in the graph has a URI (Uniform Resource Identifier). A URI is a globally unique name. If two people use the same URI, they're talking about the same thing.

URIs

A URI looks like a URL:

https://example.org/people/alice

This identifies a specific person. Another URI identifies a specific property:

https://example.org/vocab/email

Put them together in a triple:

<https://example.org/people/alice> <https://example.org/vocab/email> "alice@example.com" .

Angle brackets < > wrap full URIs in Turtle files.

URIs don't need to point to a real web page. They're names, not addresses. https://example.org/people/alice is an identifier, not a link you can click. You pick URIs that are descriptive and under a domain you control.

Namespaces

A namespace is the shared prefix of related URIs. All your people might live under https://example.org/people/, and all your vocabulary terms under https://example.org/vocab/:

https://example.org/people/alice
https://example.org/people/bob
https://example.org/vocab/email
https://example.org/vocab/name

The namespace groups related things together, like a package or module in a programming language.

Some namespaces use # instead of / as the separator:

https://example.org/spec/tasks#Task
https://example.org/spec/tasks#title
https://example.org/spec/tasks#status

The # convention means the namespace is https://example.org/spec/tasks# and the local names are Task, title, status.

Prefixes

Writing full URIs everywhere is unreadable. Prefixes map a short label to a namespace:

@prefix people: <https://example.org/people/> .
@prefix vocab:  <https://example.org/vocab/> .

Now you can write:

people:alice vocab:email "alice@example.com" .

Instead of:

<https://example.org/people/alice> <https://example.org/vocab/email> "alice@example.com" .

people:alice expands to https://example.org/people/alice. The prefix replaces the namespace.

Standard Prefixes

Some prefixes are used so widely that they're effectively universal:

PrefixNamespaceWhat it contains
rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#Core RDF terms (rdf:type, rdf:Property)
rdfs:http://www.w3.org/2000/01/rdf-schema#Classes, labels, comments, hierarchies
xsd:http://www.w3.org/2001/XMLSchema#Data types (string, integer, date)

You'll see these in every .ttl file. They're part of the RDF standard.

Why Global Identifiers Matter

Because URIs are global, independent systems can describe the same things without coordination. If two files both use https://example.org/people/alice, they're both talking about the same Alice. This is how separate datasets connect into a single graph.

It also means URIs are a commitment. Once you publish a URI, changing it breaks anything that references it. Pick URIs that are stable and descriptive.

See Also

  • Triples: how URIs are used as subjects, predicates, and objects
  • Turtle Syntax: how prefixes are declared in files

On this page