Are you a web or application developer?

Introduction to RDF

Back to the guide

There are a couple of very good introductions to RDF on the web, but I will outline the most important things to know on this page.

RDF Data Model

RDF is actually a very simple data model:

  • Data always comes in triples
  • URIs are used as unique IDs

A triple always consists of a subject, a predicate and an object - just like a sentence in the natural language. Triples are also called statements.

Here is an example for a triple:

Subject Predicate Object
http://reegle.info/actors/2354 http://xmlns.com/foaf/0.1/name "Renewable Energy and Energy Efficiency Partnership"
  • The subject in this triple is a resource which is uniquely identified by its URI - in this case it's an actor.
  • The predicate is also a URI of a property used for describing names of people and organisations. Because properties in RDF are also URIs, you can easily re-use vocabularies for describing things instead of re-inventing your own schemas - which makes data more interoperable.
  • The object is a literal, a simple string.

Here is another example triple, stating that the same actor as above is active in a certain country:

Subject Predicate Object
http://reegle.info/actors/2354 http://reegle.info/schema#activeIn http://reegle.info/countries/AT

The object is the URI of another resource: Austria. As you can see, it is very simple to express n..m relationships between resources in RDF

Prefixes and Namespaces

The namespaces cause quite a bit of overhead, so often prefixes are used in serialized RDF data:

Prefix Namespace
foaf http://xmlns.com/foaf/0.1/
actors http://reegle.info/actors/
reegle http://reegle.info/schema#

Here are the two example triples from above - using prefixes in the URIs:

Subject Predicate Object
actors:2354 foaf:name "Renewable Energy and Energy Efficiency Partnership"
actors:2354 reegle:activeIn http://reegle.info/countries/AT

Further Links

That were the very basics of RDF. If you feel the need to dive deeper into RDF and especially linked data, check out one of these guides: