Revision as of 01:43, 1 November 2007 by Admin (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UsingFoafWeblog

The FoafVocab includes a property 'foaf:weblog' which relates an Agent to a document that is their weblog.

Here is some example markup showing how to describe someone and their weblog (taken from Joshua's XML listing of Microsoft bloggers).

<?xml version="1.0"?>
<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#"
  xmlns:dc="http://purl.org/dc/elements/1.1/">
 
<foaf:Person>
  <foaf:name>Joshua Allen</foaf:name>
  <foaf:workplaceHomepage rdf:resource="http://www.microsoft.com/"/>
  <foaf:weblog 
    dc:title="Better Living Through Software" 
    dc:description=" Life at Microsoft, the software industry from a rational perspective"   
    rdf:resource="http://www.netcrucible.com/blog/"/>
  <rdfs:seeAlso rdf:resource="http://www.netcrucible.com/blog/rss.xml"/>
  <!-- this last property is a slight stretch since the referenced feed currently uses RSS2, but is imho ok... -->
</foaf:Person>

</rdf:RDF>
  

Since this is RDF, it could be decorated with further information, eg. an rdfs:seeAlso to a FOAF file for the blogger, etc. Here we show the use of the foaf:workplaceHomepage property which relates a Person to the homepage of somewhere they work.

Here is a graph of the data structure encoded in the RDF/XML markup shown above. It was generated using W3C's online parser, validator and visualisation service, and reveals the underlying "entities and relationships" graph structure that RDF uses. You can see nodes in the diagram that correspond to the things we're describing: Joshua, his Blog, and the homepage of a place he works.

http://rdfweb.org/images/foaf/foafweblog-ms-joshua.png

Generating the FOAF using XSLT

Here's a simple XSLT stylesheet that takes the XML listing of Microsoft bloggers and converts it into a FOAF document.

At the time of writing there's a slight issue with processing the XML listing as the encoding seems to be incorrect (should be iso-8859-1). If that were corrected then we could could perform the conversion automatically.