Creating Distributed Social Networks with FOAF+SSL
[or “What’s your favourite cheese?”]
Toby Inkster BSc (Hons) ARCS <http://tobyinkster.co.uk/>March 2009
The #swig Cheese Lovers' Group has decided to set up its own web site, allowing people to join the group and to share information about their favourite cheeses.
Despite all sharing a passion for cheeses, the cheese lovers are all very busy people, so don't have time to type in their favourite cheeses. Therefore they want to hook into the growing collection of linked open data, and simply select cheeses from DBpedia, the semantic web version of Wikipedia.
Also, despite all being very clever, the cheese lovers are very forgetful people, and don't like having to set up new user names and passwords for every online service they use. Therefore, they want to use an emerging technology, FOAF+SSL for identification.
The Database
Rather than use a traditional, relational database management system, the group opt to use a triple store for their information. As only a few people will be expected to visit the web site each day, it is decided that a flat N-Triples file will be adequate storage. If site traffic exceeds expectations there is a clear route to scale up to a bigger system, such as Seseme, Jena or OpenLink Virtuoso. As well as powering the web site, the group can directly expose the N-Triples file to the web, allowing it to act as the web site's (read-only) API.
The organisation itself can be represented in the database as a foaf:Group resource with foaf:member links to foaf:Person resources for each group member.
A person's cheese preferences will be represented by a foaf:topic_interest link to a cheese. (Technically this doesn't say that a person likes a cheese, but just that the person has expressed an interest in a cheese. That is close enough for the purposes of an example, but in real life, we'd probably want to define a more specific predicate.)
Authentication
FOAF+SSL is a simple semantic-web-based authentication system. There are no user names and passwords to remember. You obtain a FOAF+SSL client certificate, install it into your browser, and then any FOAF+SSL-enabled site can identify you. Enabling FOAF+SSL for an HTTPS web site using Perl is a doddle. Simply install the CGI::Auth::FOAF_SSL
module from CPAN and follow the instructions.
As soon as someone visits the group's home page, we know who they are and we can check our database to see if they're a member. Members get to explore the site; non-members are given the opportunity to join.
Joining the Group
When someone opts to join, there are no forms to fill out. Thanks to the FOAF+SSL authentication system, the site already knows who they are. It can determine their name, homepage, photograph and so forth from their FOAF file.
The sign-up process is as simple as clicking "Join". Once members, they can get straight to filling in site-specific information, such as a list of their favourite cheeses!
Links
FOAF+SSL
- Obtain a FOAF+SSL Certificate
- FOAF+SSL Wiki
CGI::Auth::FOAF_SSL
Perl module- foaf-protocols mailing list for FOAF+SSL discussion