About Me

My photo
Web person at the Imperial War Museum, just completed PhD about digital sustainability in museums (the original motivation for this blog was as my research diary). Posting occasionally, and usually museum tech stuff but prone to stray. I welcome comments if you want to take anything further. These are my opinions and should not be attributed to my employer or anyone else (unless they thought of them too). Twitter: @jottevanger

Friday, March 27, 2009

Evaluate this

Schmuck that I am, and despite the fact that I've been doing javascript for a decade now (though not all that much in recent years), I'd never really got how useful the eval() method is. Today, I found one of those points where I could not continue without it and thought I'd just post up where it helped me since there will be others after the same solution.
My problem: to create/declare javascript variable names dynamically. I have a loop in this little SVG experiment I'm doing with the Raphael javascript SVG library (another post to come on this) where I want to make a "set" of SVG elements out of each item in an array of unknown length. I also need to attach an onclick function to each set. For creating the set, putting items into it, and attaching the event handler I need a variable name to be made on the fly. This is how to declare it:
eval("var r" +i +" = dynamically named variable'");
If i is currently 2, this creates a string variable with the name r2 and the value "dynamically named variable". To get the variable value you have to use the eval() method again, thus:
alert(eval('r'+i));
Probably old hat, this stuff, but I'm not too proud to show my ignorance, at least when I've just reduced it slightly!

Wednesday, March 25, 2009

OT: Holy crap, it's the eefin' muppets

I'm new to eefin', or I thought I was till I read/watched/listened to this post from Woof-Moo's blog and the contents therein. I discovered that legendary Aussie roots troubadour Rolf Harris was following in a grand tradition of on-stage asthma attacks known as eefing (really). You gotta see it to believe it. And scroll down to see more eefin' Beakers than even I have worked with. That's a lot.

WFMU's Beware of the Blog: EEF BEAT MANIFESTO (MP3s)

Tuesday, March 24, 2009

Visualising SKOS

I got a crude navigator for the JSON coming out of Pipes here: http://www.ottevanger.plus.com/skos/skos_pipe.html. It doesn't work properly in Mozilla (which won't reload the script when you click a link) but hey, it's a start. There will be much cuter ways to navigate this info but that's not really the point of the test. I will, though, make a pipe that perhaps takes more parameters (e.g. choose to match part vs whole string, look for only broader/narrower/related terms).

Hmm, there are quite a few flaws with the SKOS too (but see above). I fixed some last night - I found that I needed to train Dapper differently for a couple of pages and there was no way of reconciling it without doing two separate dapps. I guess that's not too surprising considering the number and size of some pages, and the fact that there are over 2000 terms each with multiple relationships. It precludes Dapper from being part of a live service, but I already established that there wasn't much sense in that - better to use it as screen scraper and then move on.

Incidentally I, as a total JSON noob, had problems accessing what looked like arrays within the JSON array - for narrower and related terms. I couldn't treat them as arrays but finally, using a tip I found on the O'Reilly forums, took the element, did toString() and split it into a proper array at the commas (I'd tried split before, but it failed without toString()), then I could cycle through the terms. Perhaps repeating the problem here will help others with the same issue.

Monday, March 23, 2009

I'm a Dapper Dan man

Well, that's definitely overstating the case - I'm no whizz with Dapper, and not exactly the spit of Ulysses Everett McGill. However I am becoming rather a fan, somewhat belatedly (I think I first heard about it from Mike Ellis some time ago). Anyway, before my SKOS experiments I hade my first proper play with Dapper to give an API to the great geophys survey data that English Heritage have made available. One nice thing was that the results aren't paginated (I just twigged how lucky that was), so without much trouble (given I was learning the tool) I came up with a quick dapp for the search. You can search the DB via this dapp using any of the parameters on the original form, though I only built four into the dapp, which you see on the test box - the reason being I wanted to search geographically to integrate the XML that's returned with some MOLA site data. But that only gives the barest info, and I wanted the details too really, so I made another dapp for the details, which takes the ID, and hooked them together for seach results with details. Very gratifying!

Next step is KML for this lot, but I will talk to the content owners before doing anything like that, which might put a load on their servers were I to layer their content onto our maps. One helpful thing, though, is that their app takes a parameter for the size of square to return results for, which means you could write a map application that would only query for the area you're showing at the time.

Sunday, March 22, 2009

Playing with SKOS

Well Mia's interest in what thesauri, word-lists etc. are out there, or could be out there, in machine-friendly form chimed nicely with mine, and it had been grating at me for ages that, for example, the NMR object type thesaurus is only available as HTML, not as a web service. There are a bunch of other thesauri in HTML form on the Collections Trust (well, MDA), English Heritage, and FISH sites, so following Mia's recent attempts to prod some of us museum tech types to action on the API front I figured I may as well have a go at turning one of them into a web service. The long and short is I haven't managed, but I have made useful steps, I think, and learnt a fair bit about Dapper, Pipes, and SKOS along the way.

I took the British Museum's material thesaurus, which is hosted by CT here. I went to Dapper and tried to get it to learn well enough to go straight to nice XML with all the different relationships having their own elements. There were too many exceptions for that and it stopped learning them after a while and I was going in circles I'd never escape, so I made a simpler Dapp (here) which just puts out the term, the linked terms, and comments. I later had to retrain it to cope with the H page but since running that page correctly once it's refused to again: it shows the results to A instead. Not to worry, add a querystring and it thinks it's a new page.

Anyway, then I had XML but still wanted to get this into nice nodes for different relationship types between terms (though wasn't really thinking about SKOS at this point. Doh!). I had high hopes for Pipes. Another doh! Because I would need to go through each item multiple times, renaming each sub-element according to its contents (e.g. broader terms all start "BT ") and trimming the string contents, I was scuppered: you can't loop operator modules, which are the ones that would allow renaming. And you can't rename by a rule, or I couldn't find how and it would probably rely on an operator module anyway. So after a lot of time wasted I thought, sod this, I know how to do this in a minute using XSLT and how important is it to have this as a web service? Fact is, it's not, or at least not in the form of a simple list - I may as well jus have a static file.

So that's what I did. It took more than a minute, though the core code scarcely did. What took longer was digging into SKOS, once it had struck me that it would be the obvious (only) format of choice. It works in a pretty straightforward way, or at least it's easy to do the basics and I didn't need to do more than that. Finding out how to represent it as RDF/XML was not so easy, coz the W3C pages don't show any - they just show TURTLE which isn't that much use to me, really. I needed a full RDF document. XML.com came up with the goods - old, but hopefully valid. So I went ahead and knocked up SKOS RDF for all the letters of the alphabet (bar X - there's nothing in the list starts with X) and merged them into one RDF file, which I hope is valid. I actually have my doubts, but I do know that with this file I can navigate around terms in a way that would be useful to me so that's good enough for me. It's here. I think it would be useful to put a web service on top of this now (perhaps Pipes can come in useful at last) so that it's really an API. Feel free! Oh, go on then, here's a first pass. Won't render as RSS and (consequently?) the "Run Pipe" screen shows nowt, but in debug mode you see results, and as e.g. JSON and PHP.

Next up there are a bunch of thesauri on those sites that I'd like to do a similar thing with, though some are going to be more fiddly. Others may be easier to dapp, but actually I reckon going to SKOS is a better bet and take it from there, as long as the content owners aren't too pissy about me playing with their stuff. Actually what would be most useful is probably to play with some of the word/term lists e.g. the RCHME Archaeological Periods List.

I could get into this.

Tuesday, March 10, 2009

The Guardian's API arrives

Here's the blurb: http://www.guardian.co.uk/open-platform
Here's the documentation: http://api.guardianapis.com/docs/
And don't forget the various sets of data they've compiled (from government and other sources) for the mashing thereof: http://www.guardian.co.uk/data-store (pointing at Google spreadsheets)
Quite how we'd be able to use the Guardian API here will take a little consideration (and the answer may be "not at all"), but it's all good. It looks like newspapers will have to start tackling (or asking) their own version of the question that Richard Light recently posed and that Mia is chasing us museum tech types to answer: what can we standardise across the APIs that are starting to emerge from museums, and where do we start?

Monday, March 09, 2009

Shakespeare's first theatre

Here's the BBC story and video about a bit of news we'll probably see in a few other places soo, the discovery of what's thought to be the first theatre to show the work of William Shakespeare (and where he also worked as an actor). Though Museum of London Archaeology is going through a tough time at the moment they are, as ever, involved in some very exciting work. Maybe a little less romantic that Romeo and Juliet itself, but thrilling enough.

Thursday, March 05, 2009

Multi-sense VR helmet? Want one o' them!

Courtesy of El Reg: Multi-sense VR helmet in development

Hmm, actually maybe I definitely do NOT want one o' them. Not only do I dislike the idea of not being able to tell reality from virtuality (and no, I didn't think The Matrix was a docu-drama), but you'd look a bit of a knob in this. But it's still a pretty cool bit of vapour-ware.

Wednesday, March 04, 2009

Uncontroversial title

Well it's all going off on Mike's blog, and previously on the MCG list, plus other (much more) considered opinions on Tom's blog and hopefully elsewhere. The subject matter: Creative Spaces, at last. "At last" because it's not been discussed properly by our community since its launch. Actually that's not quite fair: Tom's first post went up yesterday, and it's a thorough review supplemented today, so good on him. I'd planned to write something but haven't (still) checked it out properly.
Frankie kicked things off today, and after a bumpy start the discussion on those various venues has been fruitful I think. My thoughts are scattered around the place but, as I say, precede any real knowledge. Basically I think it's an idea with plenty going for it and which is a necessary experiment that we'll all learn from which, at the very least, will hopefully leave a legacy of some infrastructure (technical and organisational/political) for the 9 partners. It may be that there's a lot more than that, and it will make a very interesting case study. In the meantime, genuine congratulations to Carolyn Royston and her team for battling through all the challenges and getting this far. It's humbling, when you produce the sort of modest stuff I do, to see what's possible (if you have some resources).