RDF Triples

RDF data define a graph, composed by vertices and edges. This graph is directed, because edges point from one vertex to another, and it is labeled, as those edges have a name. The unit of data in RDF is a triple of the form:

1
subject  predicate  object

Or expressed visually:

Subject and object are 2 graph vertices and the predicate is the edge, the accumulation of those triples form the full graph. For example, the following triples:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<a> a nfo:FileDataObject .
<a> a nmm:MusicPiece .
<a> nie:title "Images" .
<a> nmm:musicAlbum <b> .
<a> nmm:albumArtist <c> .
<a> nmm:albumArtist <d> .
<a> nmm:performer <e> .
<b> a nmm:MusicAlbum .
<b> nie:title "Go Off!" .
<c> a nmm:Artist .
<c> nmm:artistName "Jason Becker" .
<d> a nmm:Artist .
<d> nmm:artistName "Marty Friedman" .
<e> a nmm:Artist .
<e> nmm:artistName "Cacophony" .

Would visually generate the following graph:

The dot after each triple is not (just) there for legibility, but is part of the syntax. The RDF triples in full length are quite repetitive and cumbersome to write, luckily they can be shortened by providing multiple objects (with , separator) or multiple predicate/object pairs (with ; separator), the previous RDF could be transformed into:

1
2
3
4
5
6
7
8
9
10
11
12
13
<a> a nfo:FileDataObject, nmm:MusicPiece .
<a> nie:title "Images" .
<a> nmm:musicAlbum <b> .
<a> nmm:albumArtist <c> , <d> .
<a> nmm:performer <e> .
<b> a nmm:MusicAlbum .
<b> nie:title "Go Off!" .
<c> a nmm:Artist .
<c> nmm:artistName "Jason Becker" .
<d> a nmm:Artist .
<d> nmm:artistName "Marty Friedman" .
<e> a nmm:Artist .
<e> nmm:artistName "Cacophony" .

And further into:

1
2
3
4
5
6
7
8
9
10
11
12
13
<a> a nfo:FileDataObject, nmm:MusicPiece ;
    nie:title "Images" ;
    nmm:musicAlbum <b> ;
    nmm:albumArtist <c>, <d> ;
    nmm:performer <e> .
<b> a nmm:MusicAlbum ;
    nie:title "Go Off!" .
<c> a nmm:Artist ;
    nmm:artistName "Jason Becker" .
<d> a nmm:Artist ;
    nmm:artistName "Marty Friedman" .
<e> a nmm:Artist ;
    nmm:artistName "Cacophony" .