I’ve been trying to use FOAF to get profile and friendship/contact information
across social networks. I’ve done the “friend” part, I just need to fill in the profile information.
Now, getting this information out of FOAF is problematic at best. Using Python, the rdflib
library, and SPARQL I’ve managed to coax data out one painful step at a
time. For example, here’s my “friend-getter” code:
SELECT ?bfoaf ?bname ?bnick ?bmbox_sha1sum ?bimage ?bweblog
WHERE {
?a foaf:knows ?b .
?b rdfs:seeAlso ?bfoaf .
OPTIONAL { ?b foaf:name ?bname } .
OPTIONAL { ?b foaf:nick ?bnick } .
OPTIONAL { ?b foaf:mbox_sha1sum ?bmbox_sha1sum } .
OPTIONAL { ?b foaf:image ?bimage } .
OPTIONAL { ?b foaf:weblog ?bweblog } .}
Clear enough, I guess. Unfortunately, I just can’t go look at bnick and stuff it into my results because bnick might be some sort of “resource” which then has to programmatically traversed also (see http://api.hi5.com/rest/profile/foaf/208329359). I admit that this might – maybe even probably – is a problem with me, maybe I don’t understand SPARQL well enough.
But that’s old business. The way I’ve been doing this is CURLing down the FOAF file, manually inspecting it, writing some
Python/rdflib/SPARQL code and seeing what happens.
This morning I decided to try a new approach: look for a SPARQL and/or RDF browser and figure out the correct queries online,
then just write the code once, correctly. In my mind, this way all very sweet: an INPUT field for the FOAF/RDF URI, a TEXTAREA
for the SPARQL query, a TABLE for the SPARQL results, and a TABLE showing all the RDF triples, since it’s triples “all the way
down”.
Here’s what I did find:
- Google rdf browser
- Check out Brown Sauce; have to install a local massive development environment – remember now, I’m trying to save time, not lose it
- Check out http://browserdf.org/: “Faceted Navigation for arbitrary Semantic Web data”. Very promising. Unfortunately, “arbitrary” seems to mean three different data sets
- Check out Stefano’s Linotype -- a high quality information source usually; find out about Welkin
- Try Welkin
- Find out Welkin doesn’t browse the web
- Download the FOAF file from http://kitschbitch.vox.com/profile/foaf.rdf into test.foaf.
- Discover that Welkin doesn’t like “*.foaf”
- Try again with “*.xml”
- Try again with “*.rdf”
- Success, except no results. Why? Oppps … I was downloading the wrong URI
- Try again with the correct URI
- Verify that it’s a FOAF file
- Stare at nothingness coming out Welkin
- Write a blog post about it; partially regret losing 50 minutes of my morning
The problem – a problem – with FOAF and RDF is quite simple. People don’t want formats that can do anything, they want formats that can do something. I got a Flickr API downloader going in about 30 minutes, taking my time. I’ve put hours into FOAF and still am unhappy.

