pblog database schema changes and trackback support

I spent some time today playing with the pblog SQL Server database schema because I have some new features in mind I want to introduce in the future. One of the things I changed was the use of primary keys in the tables. At first it seemed like a very simple decision. I used an autoincrementing integer as the identity of each entry and the external key. However, it didn’t feel right and I had to come up with many INNER JOINs in my stored procedures in order to achieve simple things. I searched the newsgroups and I read with great interest the arguments on the choice of natural primary keys vs identify fields. For the new design I preferred the former and now I am using GUIDs throughout. It has greatly simplified some stored procedures and it is easier to reason about things. Table relationships take care of the integrity tests, so there is no need for INNER JOINs in most cases. Anyway, I am going into uninteresting details.

You’ll notice that each comment gets its own link now, so they can be referred directly (the ‘#’ next to each comment).

However, the most important addition to pblog today is the support for trackbacks. It was a simple addition and it has been fun to implement a REST-based specification (I am sure this will please Mark). When someone sends a trackback to pblog, that trackback will appear bellow the comments. There is the necessary RDF statement embedded as an HTML comment when a post is displayed on its own and the RSS feed includes the necessary information too.

While the trackback specification is very simple, it occurred to me that the approach introduces unnecessary overhead. When a new post is sent to a blogging engine, the post has to be analysed and all the HTTP links retrieved. For every link, the referred page has to be retrieved and searched for an RDF statement that identifies the trackback URL to be used (if one exists). Now, if there was a specification that defined how a SOAP message could be sent to the URL of the referred post, then all one had to do was to just send a SOAP message there rather than trying to find an RDF statement inside an HTML page that has to be downloaded. I guess the ATOM API is trying to achieve just that (of course, I may be wrong in this).

Now, all I need is someone with a trackback-enabled engine to link to one of my posts 🙂