Today I’m going to share a little python script, mostly because I’ve been looking for examples on how to do this, and surprise surprise I have found none.
What this script does is to first fetch all foaf:name relations from a list of FOAF cards, and then to display these relations in a friendly manner (e.g. “John Doe knows Jane Doe.”). To do so, the script takes advantage of python’s multiprocessing libraries (Pool, to be more precise), as well as a neat little library called RDFlib. In order to perform SPARQL queries, you need to install the companion rdfextras package which includes a SPARQL plugin implementation:
$ sudo easy_install rdfextras
WebID Test Suite