~/lib/xsl/jpegrdf/prepare.sh
#!/bin/sh # currently requires the saxon:distinct() # function- I gather the xsltsl libraries # define similar hooks but I haven't tested # them yet # I know this isn't how you're supposed to # load java thingies : me.the.java.way.can.Bite() EXEC_SAXON='javavm -jar /usr/local/share/java/classes/saxon.jar' # XSL_EXPAND inherits : # /home/asc/lib/xsl/rdf/expand-resources.xsl # base class/framework for expanding resources # /home/asc/lib/xsl/rdf/expand-wordnet.xsl # the rdf wordnet output is especially verbose # so we perform some additional hoop-jumping # /home/asc/lib/xsl/rdf/expand-asc-knows.xsl # glue to expand x-urn:aaronstraupcope:* resources XSL_PRUNE='/home/asc/lib/xsl/jpegrdf/prune-exif.xsl' XSL_EXPAND='/home/asc/lib/xsl/jpegrdf/expand-resources.xsl' # dump.rdf is the output created by # jpegrdf -s ~/photos/*/*/*/*.jpg PHOTOS='/home/asc/photos' DUMP=${PHOTOS}/dump.rdf FINAL=${PHOTOS}/final.rdf # see below TMP1=${PHOTOS}/tmp1.rdf TMP2=${PHOTOS}/tmp2.rdf TMP3=${PHOTOS}/tmp3.rdf # first remove all the exif properties # except dateTime; further munge dateTime # into a resource ${EXEC_SAXON} ${DUMP} ${XSL_PRUNE} > ${TMP1} # do a first pass and try to expand # all the foreign resources in the # document - at a minimum this will # expand x-urn:asc:knows:where# / vcard # locality resources. think : # <rdf:Description rdf:about = "some-picture.jpg"> # <dc:coverage rdf:resource = "x-urn:asc:knows:where#montreal" /> # </rdf:Description> # <rdf:Description rdf:about = "x-urn:asc:knows:where#montreal"> # <rdf:type rdf:resource = "http://www.w3.org/2001/vcard-rdf/3.0#Locality" /> # <dc:title>Montréal</dc:title> # <vcard:Region rdf:resource = "x-urn:asc:knows:where#qc" /> # </rdf:Description> # <!-- and so on --> ${EXEC_SAXON} ${TMP1} ${XSL_EXPAND} > ${TMP2} # this is a pretty clunky approach but # it works as a proof of concept: do another # two passes over the output in order to # expand vcard locality/region and then # region/country resources. # a better way to do this would be to create # separate stylesheets to expand only regions # or countries since there may be other second # or third level resources that you don't care # about expanding. # at a minimum there are hooks to prevent the # same resource from being expanded twice in # the output document ${EXEC_SAXON} ${TMP2} ${XSL_EXPAND} > ${TMP3} ${EXEC_SAXON} ${TMP3} ${XSL_EXPAND} > ${FINAL} # clean up rm ${TMP1} rm ${TMP2} rm ${TMP3}
I will post these stylesheets in the next day or so...