Since Joshua, rightly so, doesn't let the source code of del.icio.us out and about, others wanting to implement tagging need to look elsewhere. Gordon Luk's FreeTag is a combo package of Php and MySQL code providing an API and schema for tagging. Don't know if it will scale to the levels of DIU, but it's a start.
Ad hoc tagging strikes me as one of those bits of functionality that has many obviously easy, yet monstrously broken implementations. Sort of like user, group, and permission management capabilities. The more open examples that are out there the better chance developers have of converging on a decent range of techniques.