Accessing iPhoto photo rating via AppleScript

I cannot find a way to access a photo’s rating either with Applescript or the Automator. I assume that data is embedded within the XML file that iPhoto generates for the library. Has anyone played around with that, or know of a way to script access to that parameter?