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.
I agree with you.
Note that you should accept FOAF files defined in link/meta too (like mine: ), I was a bit surprised that it doesn’t work with my twitter ID :)
Sorry about that. There are different ways of expressing a FOAF value in a home page, and this looks for explicit triples that say that a subject who has this homepage also has a particular FOAF file.
No problem about that, it was more a suggestion than a feature request.
Great post! Very interesting stuff. Managing your friends in a decentralized way would be very cool. You already hinted at subsequent steps.
I was thinking how to “FOAF friend” someone via Twitter. Let’s say we write a twitter app. Do you agree that: 1) both parties should have installed the app. 2) Their FOAF files should be writable on their servers. I don’t see another way of doing this. The app itself could use a technology like SPARQL Push.
Am very eager to hear your thoughts!
1) I think that’s asking too much. It should be driven by a protocol that can have multiple implementations.
2) I’ve been thinking about this and here’s my idea: allowing write access to our individual FOAF files on our individual servers is a tall order, although as I mentioned FOAF+SSL might help. Something easier would be FOAF storage services that understood the request and probably still needed FOAF+SSL to know when there was permission to write to your data.
What keeps a given service from becoming the new Facebook, with too much centralized control over everyone’s data, is that you should be able to download your FOAF file from them and upload it to and use it on another hosting service with minimal trouble. The file on your server would just redirect to the URL used by the service as its identifier for your information.
It’s easy to download everything you’ve entered into del.icio.us; imagine if that was in a standardized format that you could upload that to a new service and use the same way. I picture FOAF file hosting service working like that.
I think that’s
ligament vCard + XFN (in RDF format) are better as FOAF.
OpenSocial not support FOAF.