sparqling days / iphoto rdf export

funny slide from Tuscany
Sparqling days in Tuscany was excellent fun and seems to have spawned enough interest to create a small community of developers – ‘the Gargonza Experiment‘. More of that later, but if you’re interested, do mail us – the infrastructure’s not quite there yet but we want to make something that’s completely open and interesting to anyone who wants to play with some (non-commercial) cross-sparqling experiments.
In between all the lovely food and wine I started hacking on a converter from iPhoto data to RDF so we could easily create some data for querying with Sparql. I started using XSLT over AlbumData.xml – bleugh – what horrible XML! and then realised that comments were not exported to AlbumData.xml, so I switched to Applescript to grab out the fields, which more or less works ok but involves a bit of string munging that’s probably somewhat specific to the way I put my photos online. I want to look in more detail about using SKOS for the keywords, but not done that yet.
Finally, I wanted to use the comments field from iPhoto to parse out people depicts data using nicknames from my foaffile. So in a dc:description field (the comment field from iPhoto) you might find
<foaf:Image rdf:about=””&gt;

<dc:description>ericp and solid soup</dc:description>

The python script I created using Sean B. Palmer’s very cool Pyrple API checks each word in that dc:description field and matches it against the foaf:nicks in my foaffile. The we can find out other stuff about the person, such as their name and mbox_sha1sum, and then put that information back in the image description file, like this:
<foaf:Image rdf:about=””&gt;

<dc:description>ericp and solid soup</dc:description>
<foaf:name>Eric Prud’hommeaux</foaf:name>
I think Edd Dumbill used to do this for his photos but I’ve not found a writeup of it. Anyway, that’s where I got the idea from. I wonder if it might also work for places if we had some property like foaf:visited or somesuch.
It’s all been a bit of an education learning some bits of XSLT I didn’t know and learning applescript (this site was useful) and python (mostly using diveintopython).
All these experiments are available to play with (read the readme first), including the RDF output and my photos from the week. Also check out rdf4food wiki for better photos of that gorgeous part of Tuscany.
Update: Richard Newman reminded me of his iPhoto 4 plugin which is doing something similar. He’s doing a version for iPhoto 5 apparantly 🙂