RDF export of Flickr profiles with FOAF and SIOC
I really think that the Semantic Web, and especially FOAF and SIOC can be an answer to the social graph and distributed social networks, as explained (and drawn) there: do not rely on proprietary APIs, but provide data in a way that can be universally linked and understood by software agents.
There are already RDF exporters for Twitter or Facebook, and here’s my contribution to the Giant Global Graph: a Flickr exporter, exporting accounts and groups - if you want some data about your pictures, check flickurl.
It uses the phpFlickr API and exports only publicly available data, to be compliant with Flickr privacy settings (i.e. if you setup your account so that not connected users cannot see it in any contact list, it won’t appear in those contact lists RDF exports).
Basically, it exports one RDF file per user, including one foaf:Person and a related sioc:User - with basic properties (sioc:name, sioc:avatar) as well as a link to his image gallery using the SIOC types ImageGalery class -, and exports the relationships (foaf:knows) with other users, and groups he’s member of (sioc:member_of). Groups are exported is another file, with related informations (dc:description, foaf:depiction …). Files are related with seeAlso links.
In order to be compliant with the Linked Data principles, the script also defines a URI for each foaf:Person, so that anyone can link to it from his FOAF profile, using this pattern within his own foaf:Person description:
<owl:sameAs rdf:resource="http://apassant.net/home/2007/12/flickrdf/people/flickr_id"/>
It also defines an URI for each sioc:User and sioc:UserGroup. I could have used the Flickr account URL, but I think that’s better to make the difference between the account itself, and the homepage of this account, same for the groups.
URIs are defined as follows:
- People: http://apassant.net/home/2007/12/flickrdf/people/user_id
- User: http://apassant.net/home/2007/12/flickrdf/user/user_id
- Group: http://apassant.net/home/2007/12/flickrdf/groups/user_id
While data is available at:
- People / User: http://apassant.net/home/2007/12/flickrdf/data/people/user_id
- Group: http://apassant.net/home/2007/12/flickrdf/data/groups/user_id
Eg with my profile:
- foaf:Person URI: http://apassant.net/home/2007/12/flickrdf/people/33669349@N00
- siocUser: http://apassant.net/home/2007/12/flickrdf/user/33669349@N00
- Related RDF file: http://apassant.net/home/2007/12/flickrdf/data/people/33669349@N00
- sioc:UserGroup URI example: http://apassant.net/home/2007/12/flickrdf/groups/23989049@N00
- Related RDF file: http://apassant.net/home/2007/12/flickrdf/data/groups/23989049@N00
It uses content-negociation and 303 redirections to the RDF file or to Flickr.com, depending if you access the page with an RDF-compliant browser or not.
Finally, profiles are also linked to existing URIs thanks to:
- the dcterms:language property for any group, by using lingvoj URIs
- the geonames:locatedIn property for each user, reusing geonames.org RDF data. The script uses the first item returned by the geonames.org search web service for the location setup in the flickr profile, so I hope they’re won’t be too much mistakes (it should work fine if you mention “city, (state,) country”).
Please note that each created page is kept on the server. If you want to rebuild one, go to the service homepage and create a profile (you’ll see it also work with user names if you don’t know user id but be careful the user name is not the screen name). A dataset of created profiles should be available soon.
Edit 22/12/2006: Check this post for more details on issues with how to deal with user name / user ID.
Tags: flickr, foaf, geolocation, linkeddata, phpflickr, rdf, sioc
Comments
10 Responses to “RDF export of Flickr profiles with FOAF and SIOC”
Leave a Reply
You must be logged in to post a comment.

Nice work!
A few comments:
- You need to prepend “mailto:” before computing the mbox_sha1sum.
- The admin:generatorAgent should be changed.
I’ll be adding a link from my FOAF file…
BTW: What do you mean by “A dataset of created profiles should be available soon.”? Since I will add a link to my FOAF file, a semantic crawler should create the entire network quite soon because of the seeAlso’s, right?
Thanks for your feedback (and for using OpenID to connect, so I can retrieve your FOAF profile !)
- The mbox_sha1 value is the one returned by the flickr API, so I can’t do anything for that :/ Do you have any reference teling that mailto: should be added before computing it so that I can submit a bug ?
- generatorAgent have been changed, I’ll recreate existing files
- By dataset, I mean providing a .tgz with existing files, for those who want to do SNA, statistics … But indeed, a crawler should create this network if it goes thru the seeAlso links (yet, I think you have to set the crawler timeout as it may take some time to create the files)
Ah, didn’t realize that the mbox_sha1sum comes precomputed from flickr. Smart — if it’s correct…
As for a reference, see the term documentation for mbox_sha1sum: http://xmlns.com/foaf/spec/#term_mbox_sha1sum — it even includes a reminder for this case.
This is great. I wonder how connected the graph is, whether a crawl will pull in vast amounts of flickr or whether it is in little islands.
So, now, people can effectively use flickr to host their FOAF page?
(I’m partly leaving hte comment to see whether you pick up my FOAF info … that is net too)
I wonder what it would take to persuade flikr to host it themselves.
FOAF : le réseau social garanti sans pub !…
Vous en avez marre des pubs
intempestives de Facebook, vous n’arrivez plus à gérer
à la fois vos profils sur Linked in et Viadeo, vous vous dites
que Google a suffisamment d’informations sur vous pour ouvrir un
compte sur Orkut et vous voulez gard…
Morten> Thanks for the link, I mailed it to the API list and flickr staff fixed the bug really quickly. I’ll try to re-generate already created files so that they’ll contain the good sha1
Tim> Indeed people can have a URI - and a basic profile - thanks to flickr with the exporter. Regarding the networks, I currently have about 2000 created profiles, so it would be time to check that. Also, I think that a next interesting step would be to mash up those profiles with FOAF data from facebook, twitter … to see if those distributed graphs share common paths between users and their relationships.
And well, maybe your www08 keynote could be a way to convice flickr and other “social graph providers” to open their data
Good job, it looks good now!
Thank you so very much for the script that writes a foaf file from your flickr profile.
[…] combining some rewrite rules that Ivan Herman defined for the SW Faq and the .htaccess used for the Flickr wrapper. My old foaf.rdf file is also now redirected to this extracted profile, and I’m using an […]
[…] The Linking Open Data dataset cloud - with new additions from AudioScrobbler/Last.FM, QDOS, Flickr exporter and an major update for […]