WordPress, Tagging, and a Critique of Hierarchy
We spent a while exploring the issue of controlled vocabularies for topical information in the context of both protest.net and indymedia.org. One of the conclusions we came up with was that complex hierarchies of information suffer from many of the same problems that hierarchies in general suffer from. In particular they’re brittle. They adapt poorly as your domain/interests evolves and shifts, and lack the flexibility to deal with decision making/knowledge creation in diverse environments. Some of these ideas were captured in a proposal to build an “open editing system” (seems to be offline currently), to complement IMC’s open publishing.
Tags
And one of the core ideas was to build something which looked a lot like del.icio.us (just one of the many reasons that I think del.icio.us is so damn cool) Whether it is easier or harder for an individual to maintain their personal information systems as opposed to organizations/networks really depends on the individual. Email is going to have to wait (unless I start using Gmail wholesale), but I thought I’d experiment with what would be involved with tag enabling a piece of blogging software.
Buzz
There has been a ton of buzz about “folksonomies” from the internet chattering classes of late (peterme has a good roundup), but I’m personally not as interested in social aspect that has everyone hot under the collar, as the conceptual step forward to using tags and sets instead of categories and hierarchies.
Tags and Blogging
Scanning my projects scatchpad, I see that last Fall I jotted down notes on adding this functionality to Movable Type. Well that never happened, but I spent a couple of hours tonight hacking it into WordPress, plus yanking in some javascript from Yoz’s avar.icio.us to add auto-completion, and prompting of related categories.
An Aside On Architecture and Open Source
I remember reading Karl Fogel’s “Open Source Development with CVS, 1st ed” a number of years ago (still waiting for that back Josh), and among the many excellent points he made was that systems which are a little bit dodgy often attract more developers because its easier to get started, and you don’t feel like you’re screwing up someone’s immaculate architecture. Hacking this stuff low and lateral into WordPress was a good case in point for me.
WordPress’ed
Here is the patch, I built it against nightly-2004-08-30. There are 2 new options to enable categories as tags, use_category_tagging
, and use_category_tagging_autocomplete
, you’ll need to add these directly to MySQL. Btw the auto-completion works in Firefox, but not in Safari.
And this is “only the brave and resourceful” territory, you should feel comfortable applying a patch, and inserting new options manually. Feedback on how to organize the code to make it a better WP citizen would be great, though it is unlikely to produce short term results.
(And yes this is apropos of an eventual shift to WordPress, just as soon as I have some free time [plus I want to do a re-design as part of the move])
Next Steps
Being able to add and edit tags does not a tag enabled system make. There is a whole another round of modifications enabling people to browse sets of related tags, and compose on the fly logical constructs. And I’ve got some ideas about rich and flexible category archives. But that is all going to have to wait for some future date.
Some SQL
And I used my first multi-table self join in order to count up the related tags. Not sure how well that will scale to hundreds of categories and thousands of entries (or thousands of categories and hundreds of entries), but it’s suprisingly zippy on a small data set.
SELECT
c1.cat<em>name, c1.cat</em>ID, c2.cat<em>ID as related</em>id,
c2.cat<em>name as related</em>cat, COUNT(w2.post<em>id) as weight
FROM wp</em>post2cat w1, wp<em>post2cat w2,
wp</em>categories as c1, wp<em>categories as c2
WHERE
w1.post</em>id = w2.post<em>id and w1.category</em>id <> w2.category<em>id and
c1.cat</em>ID = w1.category<em>id and c2.cat</em>ID = w2.category<em>id
GROUP BY related</em>id, c1.cat<em>ID
ORDER BY c1.cat</em>name, weight