Having discovered the RDF Vocabulary to describe countries one has visited that Morten had developed and integrated in a WordPress plug-in, and seeing the nice results it gives in the FOAF explorer, I decided I wanted to use it, too.
But I was kind of reluctant to use the WordPress plug-in for this: I don’t want to put too much in my wordpress set up, and generally speaking, I’d rather avoid using too much of the database infrastructure that comes with it. Plus, I already had a list of countries I visited in XHTML on my personal web site, and it didn’t look like a good practice to duplicate that.
The obvious solution was rather to GRDDL-ize my HTML page to have it generate the relevant RDF, and so I did.
- first, since the Semantic Visits schema is used in the context of FOAF, the GRDDL-izer had to be integrated somehow with the FOAF GRDDL-izer; to make that possible, I added a qualified-named template to the latter (
foafGrddlbound to the URI of the XSLT), which by default does nothing
- then, I created a new XSLT that imports the FOAF GRDDL-izer, and overrides the
foafGrddl:extendtemplate with one that scrapes XHTML mark up to extract the list of countries (the details of the mark up conventions are documented in the XSLT itself)
- adding a
<link rel='transformation' href='http://dev.w3.org/cvsweb/~checkout~/2004/grddl-transformers/foaf-visits.xsl?content-type=application/xml' />in my XHTML page, plus the GRDDL profile in the
headelement gave the expected reults in RDF (through the GRDDL demonstrator)
- … which I was able to verify in a more human-friendly way, using FOAF explorer
So, that makes a visual representation of the countries you visited almost directly available from a well-formatted XHTML page!
There a few issues that this raises, though:
- the mark up convention for identifying countries relies on having the
idattribute set to the relevant ISO country code; this obviously doesn’t scale well – e.g. you can’t have twice the same country in the same page, and isn’t really user-friendly for the user
- the extension mechanism for the FOAF GRDDLizer is really ad-hoc; i.e., having write access to the FOAF GRDDLizer, it was easy enough for me to add this extensibility point, but should GRDDLizers become more widely deployed, that’s not something you should rely on; of course, license permitting, there is always the possibility to copy the XSLT and extend it in a new version, but it has the usual drawbacks in terms of maintenance; I wonder if there is a way around this
- it would be much cooler if this didn’t have to go through the GRDDL demonstrator, i.e. if one could use the FOAF explorer directly on an XHTML page (esp. with the handy bookmarklet); I guess a patch to the getFoaF PHP module would be in order