Querying Images

November 29th, 2004 11:16 PM

I had intended to write a short bit about why you wouldn’t be able to browse pictures on this site by location for a long time, and in fact had most of the post written. But two days of solid hacking on an good-enough solution using RDQL has gotten me so much closer than I would have thought possible just a few days ago.

I am no longer waiting on features in SPARQL. I went back and implemented the solution entirely in RDQL, but in doing so, uncovered a few bugs in the Rasqal library. Timely help from Dave Beckett on irc solved one of the problems, but another remained, and either way I haven’t installed this evenings snapshot. So workarounds were the strategy of the day, and they seems they have paid off.

One workaround was necessary to combat a bug in the RDQL lexer that won’t accept negative numbers. Another dealt with a strange bug that would only return numeric literals if they were integers (which most geographic coordinates are not).

Christopher Schmidt provided some very helpful thoughts on modifying and re-ordering the RDQL triple patterns, leading to quite significant speedups. And in working around the integer problem, I discovered that it’s faster to let RDQL filter the latitude, give me back a set of Redland::Node objects, and to filter the longitude in Perl myself.

So, I’m not making the work public just yet, lest the webserver here fall over under the load (I’ve made tremendous progress with the speed of queries, but it’s still pretty slow and CPU intensive). However, here’s what will be coming soon: A clickable map, search by place name or GPS coordinates, and user-definable search radius.