An RDF file should parse down to a list of triples.
A triple consists of a subject, a predicate, and an object. But what do these actually mean?
The subject is, well, the subject. It identifies what object the triple is describing.
The predicate defines the piece of data in the object we are giving a value to.
The object is the actual value.
Let’s take a quick look at my FOAF file to get an example triple.
I know Cal Henderson, and this is represented in my FOAF file as…
Using the RDF validator we can get a the list of triples represented in this piece of RDF.
But what does this actually mean? Lets go through it line by line.
Triple 1 – This has a subject of genid:ARP40722. You would have noticed that this didn’t appear in our original RDF, so where did it come from? It’s actually a bnode, and the value is generated by the RDF Validator. It’s purpose is to make sure we can identify the subject where it hasn’t been specifically named. In this case, we look to triple 6 and see that it has been generated there as the value of that object. The predicate of line 1 is the rdf:type, and the object is foaf:Person. This all corresponds to the code in
<foaf:Person> in our FOAF extract.
Triple 2 – You’ll notice this has the same subject as triple 1. This isn’t a coincidence as the triple is part of the same foaf:Person. The predicate says we are defining the foaf:nick property, and the object is Cal. So we know that this foaf:Person has a nickname of Cal. This all corresponds to the line
<foaf:nick>Cal</foaf:nick> in our FOAF extract.
Triple 3 – Yet again the subject is the same as triple 1. The predicate is foaf:name, and the object is Cal Henderson. So we know the name of the person in this foaf:Person is Cal Henderson. This represents the line
Triple 4 – Yet again the subject is the same as triple 1. The predicate is foaf:mbox_sha1sum and the object is the SHA1 sum relating to Cal’s email address. This represents the line
Triple 5 – Yet again the subject is the same. The predicate is rdfs:seeAlso and the object is http://www.iamcal.com/foaf.xml. We now know that if we want more information on Cal, we can see his FOAF file at that URL. This represents the line
Triple 6 – Here the subject is genid:me. This is because at the start of my FOAF file, in an area not show above I defined the id as me. The predicate is foaf:knows and the object is genid:ARP40722. This is saying that I know the person defined by the subject genid:ARP40722. In this case, it’s Cal, and his details have been shown in the previous 5 triples. This relates to the <foaf:knows> block.
Hopefully this has shown how the RDF has been parsed into triples, and how they relate to each other.
- Each RDF triple is made up of subject, predicate and object.
- Each RDF triple is a complete and unique fact.
- An RDF triple is a 3-tuple, which is made up of a subject, predicate and object – which are respectively a uriref or bnode; a uriref; and a uriref, bnode or literal.
- Each RDF triple can be joined with other RDF triples, but it still retains its own unique meaning, regardless of the complexity of the models in which it is included.