If we replaced Facebook with a decentralized collection of cooperating services that provide a similar collection of features, obvious candidates for some of these services are FOAF files, twitter, and flickr, but what would coordinate those services? Some have APIs and can store information that lets you make connections between the different services, so I wrote something to make one of those connections.
Twitter and related services such as identi.ca do an excellent job of replacing Facebook's status updates. FOAF files were supposed to be the RDF geek's ideal way to track friend networks, and while FOAF is probably the most popular vocabulary outside of Dublin Core, actual FOAF files have been used for little more than demos. If we could integrate them into this Facebook-like collection of services that I've been thinking about, they could become more practically useful, so I came up with a way to find someone's FOAF file based on their twitter ID.
Looking up a FOAF file using a twitter ID
Twitter lets you specify a home page address as part of your profile, and twitter's API can easily find out someone's home page URL. A little RDFa in your home page can point to your FOAF file, and then a short script can take someone's twitter ID, find out their home page URL, and then find out the FOAF file URL from the RDFa in that home page. I wrote a service that takes a twitter ID and returns the FOAF file URL, which you can try yourself with the URL http://www.rdfdata.org/cgi/twitterName2FOAFFilename.cgi?twitterID=bobdc.
Step one is adding the following RDFa to the body your home page, substituting your own home page and FOAF file URLs:
<div xmlns:foaf="http://xmlns.com/foaf/0.1/" typeof="foaf:Person"> <span rel="foaf:homepage" href="http://www.snee.com/bob"></span> <span rel="foaf:page" href="http://www.snee.com/bob/foaf.rdf"></span> </div>
It basically says "the Person with the following home page (which should be the same one named as your home page in your twitter profile) has the following FOAF file". There's nothing twitter-specific here, so the small number of triples that this embeds in your home page could serve many other uses, and of course you can add other information about the home page owner being described.
Once you've done this, you should be able to substitute your twitter account name for bobdc in the rdfdata.org URL above and see it return your FOAF file. (If you decide to revise the home page value in your twitter account before testing this, I've found that the data used by their API is not as recent as you would hope, so testing this with a revised home page value may require some patience.)
You can try the relevant twitter API call users show with The Onion twitter account using the URL http://api.twitter.com/1/users/show/theOnion.xml. In the returned XML, the
url element holds the user's home page URL. To parse and query the triples in the RDFa, I used the technique described in my last blog posting, except that this time I used the excellent http://www.dotnetrdf.org/demos/leviathan/ service to both parse the RDFa and query the triples, because sparql.org was down for much of this week.
If you do add this RDFa to your home page and the service works for you, let others know by tweeting "I've connected my twitter account to my FOAF file #twitter2foaf".
Adding more Facebook-like features
Flickr lets you specify a home page as part of your profile, but I didn't see a way to find this value using flickr's API, which is about as simple and straightforward as twitter's. Theoretically, the same idea should work with Facebook itself, because they have an API, but their API looks like a real pain compared to the others, and they don't have a dedicated profile field to let a user name a home page outside of Facebook—funny thing!
If we can use tweets to send money to each other, it shouldn't be that difficult to establish a twitter convention to "foaf:friend" someone—that is, to tweet "I'll add you to my FOAF file at http://my/path/foaf.rdf if you'll add me to yours at http://your/path/foaf.rdf". Automating the addition would be a bit more work, but it's not insurmountable.
A Google search for "the next facebook" gets hundreds of thousands of hits. I'd love to see people worry less about replacing Facebook services and more about developing technology to connect existing services into something that can substitute for Facebook. It's great to see how people like Henry Story, with his FOAF+SSL work, are doing just that, and building on semantic web standards to make it possible.