Tutorial 1: Introducing Graph Data

Next: Introducing RDF

The semantic web can seem unfamiliar and daunting territory at first. If you're eager to understand what the semantic web is and how it works, you must first understand how it stores data. We start from the ground up by outlining the graph database - the data storage model used by the semantic web.

After this tutorial, you should be able to:

  • Describe in basic terms what the semantic web is.
  • Experience the paradigm-shift of storing information as a graph database, rather than a hierarchical or relational database.
  • Understand that the semantic web of data is defined using Resource Description Framework (RDF).
  • Understand the basic principles of RDF statements and how they can define data graphs.

Estimated time: 5 minutes

graph data concept

If you come from a traditional IT background and are used to the idea of storing data either in a hierarchy (for example XML) or in a relational database (for example MySQL, MS SQL), you may not yet have come across Resource Description Framework, or RDF.

RDF is a common acronym within the semantic web community because it forms one of the basic building blocks for forming the web of semantic data. What it defines is a type of database which you may not be immediately familar with: something called a graph database.

Although it might not be familiar to you, it is the type of database that builds the semantic web, globally. We will learn why in these tutorials.

During this lesson, you will learn what a graph database is, how RDF defines one, and visualise graph data so you can get a feel of what it looks like. We will begin by comparing hierarchical, relational, and graph databases to see how they are different.

1.1 Introducing The Graph Database

Relational database vs graph database

For most types of data storage, there is the concept of some elements of data (whether they be for example data nodes or data tables) having more precedence, or importance, over other elements.

For example, take an XML document. An XML document typically contains nodes of information each with a parent node. At the root of the document is the highest level node, which has no parent.

Take a look at the illustration above. In a data graph, there is no concept of roots (or a hierarchy). A graph consists of resources related to other resources, with no single resource having any particular intrinsic importance over another.

An Example Of A Data Graph

It's easiest first to look at a series of statements about how things relate to each other and to visualize these as a graph before looking at how these relationships might be expressed in RDF. Look at the following statements describing the relationship between a dog (called Bengie) and a cat (called Bonnie):

Bengie is a dog.
Bonnie is a cat.
Bengie and Bonnie are friends.

Using these three simple statements, let's turn this into a data graph:

The relationships implied by this graph are fairly intuitive but to be thorough let's review them. We can can see that our two things - identified by "Thing 1" and "Thing 2" - have the properties name, animalType and friendsWith.

From this, we can see that "Thing 1"'s name is Bengie, and "Thing 2"'s name is Bonnie. "Thing 1" is a dog, and "Thing 2" is a cat. And finally, both are friends with each other (implied by the friendsWith property pointing in both directions).

Important Point The arrows in the above diagram are properties, sometimes in RDF terminology called predicates. Remember for now that the terms property and predicate are interchangable, and that it is the arrows that describe the properties in the graph.

Before formally introducing simple RDF, let's give a quick example to give you a flavor of what it looks like.

Semantic Web Primer e-Book

NEW! Semantic Web Primer e-Book (First Edition)

Includes all our primer tutorials. Plus two exclusive new tutorials on RDF syntaxes, and NoSQL databases found only in the e-Book.

1.2 A Starting Example Of RDF

<?xml version="1.0" encoding="UTF-8"?>


	<rdf:Description rdf:about="http://en.wikipedia.org/wiki/Oxford">
		<region:principaltown rdf:resource="http://www.country-regions.fake/oxford"/>


Don't worry about the details for now, we will review these later. For now, know that this is RDF/XML - the XML form of RDF. There are other ways of recording RDF, but we will look only at RDF/XML in these starting tutorials.

1.3 The RDF Statement (Triple)

The RDF/XML above (between the <rdf:Description> tags inclusive) is called an RDF statement, or sometimes called an RDF triple. Of the two, triple is the most helpful term as it describes the breaking of the statement into its three constituent parts: the subject, predicate, and object of the statement.

It is easiest first to illustrate these terms in the form of a simple graph. Look at the following graph of data describing the color of a T-shirt:

Example graph showing color property of a T-shirt

In terms of the simple graph above, the:

  • Subject is the T-shirt
  • Predicate (property) is the color
  • Object is white

Important Point RDF, whilst the foundation of defining data structures for the semantic web, does not in itself describe the semantics, or meaning, behind the data. This will come later when we introduce RDFS (RDF Schema) and OWL (Web Ontology Language). Don't worry about these for now. First, we need to learn how RDF structures data and relationships and how that differs from the more familiar ways of storing data - we need to paradigm shift from the relational or hierarchical means of modelling data to a graph model.

Let's look at this in terms of a simple RDF/XML statement:

<?xml version="1.0" encoding="UTF-8"?>


	<rdf:Description rdf:about="http://www.linkeddatatools.com/clothes#t-shirt">

		<feature:color rdf:resource="http://www.linkeddatatools.com/colors#white"/>



We will formally break this statement down in the next lesson, but before moving on, see if you can get a feel of how the RDF above describes the subject, predicate, and object.

Semantic Web Primer e-Book

NEW! Semantic Web Primer e-Book (First Edition)

Includes all our primer tutorials. Plus two exclusive new tutorials on RDF syntaxes, and NoSQL databases found only in the e-Book.

You have completed this lesson. You should now understand the following:

  • What a data graph is.
  • That the semantic web is a giant, global data graph defined in RDF (Resource Description Framework).
  • The all-important shift in thinking from storing data in relational, or hierarchical models to a storing in graph models.
  • The subject, predicate and object in terms of basic data graphs and RDF statements.
  • A basic familiarity with the layout of an RDF document.

You should now be able to start the following tutorial:



#23 2016-04-22 11:02
Any reason why Bengie and Bonnie were represented with rectangles while others Cat,Dog, Thing1 and Thing2 with ovals?
#22 2014-03-26 12:00
superb!! really fantastic site for semantic seekers.
#21 2013-12-09 05:03
Excellent tutorial
#20 2013-04-02 14:42
it is really a wonderful site for semantic web worriers
#19 2013-02-19 17:09
excellent content with a good take off
#18 2013-01-25 17:11
Simple and easy to understand.Thanks for being a good teacher.
#17 2012-10-21 02:51
#16 2012-09-28 00:41
It is so easy to understand OWL with this material
#15 2012-09-26 18:29
Very clear!!!, it has been a great help for me.
Thank you
#14 2012-09-14 06:15
Really Helpful Good work !!

Add comment

Security code


Register to download software from our site and interact with other users as you learn semantic web.

NEW! The Semantic Web Primer e-Book (First Edition) includes all our primer tutorials

Semantic Web Primer e-Book

Plus two exclusive new tutorials on RDF syntaxes, and NoSQL databases found only in the e-Book.

Get Your Copy >>