[rdfweb-dev] FOAF Query Service

Sean B. Palmer sean at mysterylights.com
Fri Aug 8 22:36:28 UTC 2003

Hi everyone,

Using Libby Miller's SquishQL interface to her FOAF database [1], I've
come up with a very friendly human interface that lets you do simple
queries such as "homepage and mbox of danbri" via either a web form:-

   - FOAFQ: FOAF Query Service

or on the command line using Python:-

   - FOAFQ Source

The code is released under GPL 2. The syntax is pretty simple:
something along the lines of "<foafprop> (and <foafprop>) of <id>"
where foafprop can be any FOAF property "label" (i.e. after the
http://xmlns.com/foaf/0.1/ bit), and id can be one of the following:
an email address, defined as something with a "@" in it; a name,
defined as something with a space " " in it; or a nickname.

FOAF interface activies have recently been focussed on providing a
brosable space for people to look through, find new relationships that
they didn't know existed, and basically explore the social network
that all of its participants have been working so hard to export the
semantics of in RDF. But the other obvious use for FOAF that hasn't,
to my satisfaction, been exploited enough is that of the simple query:
it's commonplace to come across a new person and wonder what their
homepage is, or weblog, or PGP key, or whatever.

Even amongst people who've known each other for quite some time, there
can be surprises. For example, danbri asked me today if I have a
weblog. Now he can just go to:-


In fact, I didn't know that danbri had a weblog (well, actually, I
forgot); but in my random perusals of results whilst testing this
script, I found that he does indeed have one:-


I'd like to thank Libby Miller very much for letting me use her
SquishQL service, and note to anyone using this interface that the
service could fold at any time due to her box being a bit creaky. Hey,
there are 200000 triples in there (though I've found the CGI to be
suitably fast for this purpose). The script obeys robots.txt, so the
plug can be pulled on it, the poor thing.

The script does have some limitations. Firstly, it's limited to only
those properties that are in the FOAF namespace. In fact, Libby's
service poses no such limitations, but I've been too lazy to add the
functionality since I don't think that anyone will really require
it--if someone really wants this, they should try to cajole me into
adding it. Secondly, there are various little oddities from the FOAF
world, e.g. if you query for Aaron Swartz's homepage:-


you'll find that there are results with a trailing slash and without.
Duplicate names are another annoyance, too. Some people have been
deliberately using a non-canonical version of my name just to irk me:-


please don't forget the middle initial! :-)

I hope that this script inspires people to do a better job than I've
done. I'd like to see a ranking of the largest FOAF triple stores on
the Web at the moment. I'd like each of the largest ones to have
decent interfaces to them.

Anyway, enjoy.


Sean B. Palmer, <http://purl.org/net/sbp/>
"phenomicity by the bucketful" - http://miscoranda.com/

More information about the foaf-dev mailing list