Data Structures and Tagging
By stern on Feb 12, 2006
He always made the joke, and I always laughed at it. Of course, he was paying, so I found immense humor in data structure misuse. Until I started thinking about the problem, and realized that Ken was right. I've been thinking about relational databases, and not arrays of fruits, but the problem remains about just desserts.
Why do we insist on cramming nearly everything into a relationship database? Relations are fair data structures for data that fits neatly into rows, and can be reduced into tables such that no information is lost. Tags, however, scream for something more hierarchical, more capable of expressing one-to-many relationships and many-to-many relationships between tags and tag clouds. Directories may be a better fit, as they resemble a hierarchical data store more than a relationship database.
A complicating factor is SQL. Part of the popularity of PHP, I believe, is that it makes talking to SQL databases significantly simpler for the coder who wasn't Hectored into understanding relational algebra.
What if SQL and RDBMS should be (partially) replaced in our Web 2.0 acronym vernacular with LDAP, ATOM and RDF? That's the question I asked some of my favorite architects as I was getting snowed on last night. Interesting answers to follow.