Upto: Table of Contents of full book

Friend of a Friend

Friend of a Friend (FOAF) is one of the early vocabularies building in (also early) ideas of the Semantic Web. While the Semantic Web has gone beyond FOAF, it still plays a major use in Linked Data.

Resources

FOAF

FOAF was created as a description language for people and their relationships with documents and with other people. Thuis can be written in RDF format, published on the web and can interoperate with other RDF languages. While it claims to the part of the Semantic Web there are really very little deductive concepts in FOAF to justify this.

FOAF consists of a core set of relationships. As such, it can be used to link URIs. In this it is similar to the Dublin Core, but uses a different vocabulary to describe an additional set of predicates.

The namespace for FOAF is http://xmlns.com/foaf/0.1/. Thus the URI for, say, the FOAF title predicate is http://xmlns.com/foaf/0.1/title. This is distinct from the Dublin Core predicate http://purl.org/dc/elements/1.1/title and so it should be: the FOAF title belongs to a person as 'Mr', 'Dr', 'Lord', etc, quite distinct from the title of a publication!

FOAF Core

The FOAF Core consists of the elements

This link also gives the "Social web " elements.

Example

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:foaf="http://xmlns.com/foaf/0.1/"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

<foaf:Person>
   <foaf:name>Jan Newmarch</foaf:name>
   <foaf:gender>Male</foaf:gender>
   <foaf:title>Dr</foaf:title>
   <foaf:givenName>Jan</foaf:givenname>
   <foaf:familyName>Newmarch</foaf:family_name>
   <foaf:mbox rdf:resource="mailto:jan@newmarch.name"/>
   <foaf:homepage rdf:resource="http://jan.newmarch.name"/>
   <foaf:weblog rdf:resource="http://jannewmarch.blogspot.com/"/>       
   <foaf:depicts rdf:resource="http://jan.newmarch.name/jan-medium-2010.jpg"/>
 </foaf:Person>
      

The knows predicate

FOAF wouldn't really do much if all it did was to describe one person: screen-scraping from a person's home page would be almost as good if it was just extracting information about the person. No, the key to FOAF is that it describes links to other people.

There are two predicates for this: the first is knows, and this can be applied to RDF descriptions of a Person in the same document or - much more interestingly - to the URIs of other FOAF descriptions. The second predicate that is of value in this case is seeAlso: the URI of another FOAF document. The following illustrates this:

<foaf:Person>
   <foaf:name>Peter Parker</foaf:name>
   
   <foaf:knows rdf:nodeID="harry"/>
   
   <foaf:knows>
       <foaf:Person>
         <foaf:name>Harry Osborn</foaf:name>
         <rdfs:seeAlso rdf:resource="http://www.osborn.com/harry.rdf"/>
       </foaf:Person>   
   </foaf:knows>
 </foaf:Person>
      

The seeAlso predicate is the FOAF equivalent of the href in HTML: it allows a Web of acquaintancies to be built up.

What does it mean to "know" somebody? FOAF is deliberately vague about this, because it does not want to get involved in the intricacies of human (or animal) behaviour: is it "knows" in the Biblical sense, through to seeing a picture on a billboard, or anything in between.

Including FOAF links in HTML

A link to a FOAf document can be placed in the HEAD section of an HTML document as META data:

<link rel="meta" type="application/rdf+xml" title="FOAF" href="JanNewmarch.rdf" />
      
This allows an HTML/HTTPD user agent to find and follow FOAF links given an initial URI to an HTML document.

	
      

Copyright © Jan Newmarch, jan@newmarch.name

If you like this book, please contribute using Flattr
or donate using PayPal