Fri 27 May 2005

Another ruinous addition to Wilbur

Wilbur won't let you query for literals. This, for example, won't work:

(query nil nil "Richard")

The reason why, of course, is that the triple index for objects is a Lisp hash table. This has four options for comparison: EQ, EQL, EQUAL, and EQUALP. None of these will successfully compare a wilbur::literal with a string with the same value, and Wilbur makes EQ hash tables anyway.

What we really want is a hash table with a smarter equality function; not even literal=, but one that also compares nodes and strings. Thankfully, Ingvar Mattsson has his genhash library, which allows hash tables with custom hash/equality functions.

70 lines of Common Lisp later and we have this file, which sets things up to allow queries over literals.

(setf *db* (make-instance 'db))
#<DB size 78 {99D7B19}>
* (db-add-triple *db* (triple !rdf:type !rdfs:label (db-make-literal *db* "type")))
#<TRIPLE !rdf:type !rdfs:label #<LITERAL "type" {9A0B5B9}> {9A0B631}>
T
* (query nil nil "type")
(#<TRIPLE !rdf:type !rdfs:label #<LITERAL "type" {9A0B5B9}> {9A0B631}>)

Now I await the inevitable backlash!

Posted at 2005-05-27 14:43:03 by RichardLink to Another ruinous ad…
Comments, trackbacks.

Blasted languages

I can't believe that after years of practice I got bitten by this old chestnut:

if ($flavFilter = 'atom') { …

This was the reason for my archive page coming out as Atom! This was a rather bizarre bug, at least until I realised what was going on and set out to find the point at which it decided it was to serve Atom stories, not HTML.

You can't go wrong with (string= flavFilter "atom") in my book.

Now, for a brief afternoon of making the archive more manageable — the page is 100KB!

Thanks to Tom for spotting my cryptic debug messages.

Posted at 2005-05-27 06:08:24 by RichardLink to Blasted languages
Comments, trackbacks.

Google
Web holygoat.co.uk
  • richard is: