<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Murray Woodman &#187; wordpress</title>
	<atom:link href="http://murraywoodman.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://murraywoodman.com</link>
	<description>Homepage and blog</description>
	<lastBuildDate>Fri, 05 Aug 2011 04:38:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>WordPress Taxonomies</title>
		<link>http://murraywoodman.com/355/wordpress-taxonomies?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-taxonomies</link>
		<comments>http://murraywoodman.com/355/wordpress-taxonomies#comments</comments>
		<pubDate>Tue, 16 Jun 2009 05:06:57 +0000</pubDate>
		<dc:creator>Murray Woodman</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[rdf]]></category>
		<category><![CDATA[taxonomies]]></category>
		<category><![CDATA[topicmaps]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://murraywoodman.com/?p=355</guid>
		<description><![CDATA[I have been interested in RDF and Topic Maps for a while so I thought that it would be interesting to see how some of the concepts in these specifications could translate across to WordPress. I had recently moved my topicmap.com site across to WordPress and was wanting to wring some more semantic goodness out [...]]]></description>
			<content:encoded><![CDATA[<p>I have been interested in RDF and <a href="http://topicmap.com/">Topic Maps</a> for a while so I thought that it would be interesting to see how some of the concepts in these specifications could translate across to WordPress. I had recently moved my topicmap.com site across to WordPress and was wanting to wring some more semantic goodness out of the standard install. Specifically, I wanted to add metadata which could be linked.<span id="more-355"></span></p>
<p>Out of the box WordPress comes with a fairly small set of hard-baked object types which don&#8217;t necessarily map particularly well to the semantic web:</p>
<ul>
<li> pages</li>
<li> posts</li>
<li> comments</li>
<li> links</li>
<li> users</li>
<li> tags, categories and link categories.</li>
</ul>
<p>The options for relating things have been pretty limited:</p>
<ul>
<li> posts can be related to tags and categories</li>
<li> links can be related to link categories</li>
<li> users and posts can have metadata but no out of the box display for this.</li>
</ul>
<h3>Taxonomies</h3>
<p>As of WordPress 2.3 the database schema changed to introduce &#8220;taxonomies&#8221;. This involved a rejigging of the way categories and tags were stored and related. This allowed for the creation of custom realtionships to be made. ie. it is possible to create custom relationship types such as &#8220;is a&#8221;, &#8220;studied&#8221;, &#8220;likes&#8221;, etc. This allows for much richer metadata to be produced. Out of the box taxonomies are not available to WordPress users but plugin developers are able to use the new data structures to come up with something better than what is available with tags and categories.</p>
<p>Check out these two posts explaining the changes</p>
<ul>
<li><a href="http://codex.wordpress.org/WordPress_Taxonomy">Tip #5 : Taxonomy in WordPress 2.3</a></li>
<li><a href="http://boren.nu/archives/2007/08/26/wordpress-23-taxonomy-schema/">WordPress 2.3 Taxonomy Schema</a></li>
</ul>
<p>This all looks promising. However, I was a bit disappointed with the way things had been implemented in the backend. To me it seems that some less than optimal decision were made.</p>
<p><em>The thoughts that follow are a result of looking at the DB schema only. I have not peered into the code or am aware of the background for making the decisions that were made.</em></p>
<p>The old WordPress had the following tables:</p>
<ul>
<li> categories</li>
<li> post2cat</li>
<li> link2cat</li>
</ul>
<p>The new WordPress has factored these replaced them with three new tables:</p>
<p><strong>wp_terms</strong><br />
term_id<br />
name<br />
slug</p>
<p><strong>wp_term_taxonomy</strong><br />
term_taxonomy_id<br />
term_id<br />
taxonomy<br />
description<br />
parent<br />
count</p>
<p><strong>wp_term_relationships</strong><br />
object_id<br />
term_taxonomy_id</p>
<p>Please read <a href="http://boren.nu/archives/2007/08/26/wordpress-23-taxonomy-schema/">WordPress 2.3 Taxonomy Schema</a> for a better understanding of how the above three tables work together. I will make a few points at this stage.</p>
<ul>
<li>the terms table handles names and slugs for category, link_category and post_tag. The slug provides the unique index. This design seems very strange to me as we have three namespaces (category, link_category and post_tag) which are being constrained by a single slug namespace. It therefore seems impossible to have the same slug represent different concepts (or names) across namespaces. eg /category/max (the &#8220;max&#8221; size) and /tag/Max (the &#8220;Max&#8221; person). The schema just smooshes the namespaces together, limiting expressiveness. This might be acceptable if there were only one namespace but there isn&#8217;t. This makes me a bit concerned about renaming things. If one term is forming double duty for a tag and a category, then the rename of one will knock onto the other.</li>
<li>naming duties are split between wp_terms and wp_term_taxanomy. Why does wp_terms get name and slug, and<br />
wp_term_taxonomy get description? Weird. I can&#8217;t see the benefit of the wp_terms table. One argument for it might be that wp_terms is there to handle duplication of names and to save space. I don&#8217;t buy this. Names and slugs are short, clashes are relatively rare and we have the namespace slug problem above. I can&#8217;t see the point of wp_terms. Further, any query would need to join across to wp_terms to get the name &#8211; a pointless exercise.</li>
<li>according to the documentation the object_id property type in wp_term_relationships can take a link_id or a post_id. What? This breaks the relational model. We don&#8217;t know what the ID represents in this table. Is it a link or a post? The only way I can see this working is to join across to wp_taxonomy and restrict on the taxonomy value! ie. you need to do a join to restrict the object ID. I haven&#8217;t checked the code so I can&#8217;t be sure. I must be missing something here but that is the only way I can see it working. This must lead to less than efficient querying on big datasets.</li>
</ul>
<p>So that&#8217;s me being a bit critical of the design of taxonomies as it stands technically. However, I have bigger problems with what can be achieved sematically with it. The main limitation lies with the content of the wp_term_relationships table. You are limited into what can go into object_id (links and posts) and what can go into term_taxonomy_id (category, link_category, tag, custom). There is a divide between the resources would and the subjects world. This means that it is impossible to:</p>
<ul>
<li> relate posts with posts, links, users, comments or pages</li>
<li> relate links with posts, links, users, comments or pages</li>
<li> relate users, commentsor pages with anything</li>
</ul>
<p>This really is a massive lost opportunity. Why the limitation?</p>
<p>The main problem for me is not being able to relate posts with posts. It is very common to want to encode a &#8220;see also&#8221; or a &#8220;is friends with&#8221; or &#8220;works for&#8221;. If you have this content in your WordPress as a post rather than a tag/category/custom then you are out of luck. For users who are using WordPress as a CMS with most of the content is posts (in order to get the benefits of tags and categories) this is a frustrating situation.</p>
<p>Another obvious loss is the inability for tags and categories to apply to pages. This kind of functionality is often bolted on by plugins. It would be nice if it could be supported natively.</p>
<h3>Suggested alternative</h3>
<p>OK. What would be a better design? If I were to take a stab at it I would solve it in two tables, rather than three.</p>
<p><strong>mw_term</strong><br />
term_id<br />
subtype (&#8220;tag&#8221;|&#8221;category&#8221;|&#8221;custom&#8221;|&#8221;predicate&#8221;)<br />
title<br />
slug<br />
description<br />
parent<br />
unique index: subtype + slug</p>
<p>1 = _category (subtype:predicate)<br />
2 = _link_category (subtype:predicate)<br />
3 = _post_tag (subtype:predicate)</p>
<p>This design solves the term problem by making a single mw_term table which handles all of the naming: title, slug and description. It also handles the namespacing problem because uniqueness is solved with slug + subtype index. The subtype handles the old &#8220;taxonomy&#8221; values but also includes another: predicate.</p>
<p>Predicates join subjects and objects. They could have their own table for naming but why double up? Lets just put them into the mw_term table. You can see that the first three rows in mw_term are for the category, link_category and post_tag terms.</p>
<p><strong>mw_triple</strong><br />
subject_type (post, link, term, user, comment, page)<br />
subject_id<br />
predictate_id<br />
object_type (post, link, term, user, comment, page)<br />
object_id</p>
<p>And here we have a standard relationship table which relates subjects with objects. This is very much like an RDF triple. You can see that this allows us to relate anything to anything resulting in the most freedom of expression. It is now possible to do some very helpful stuff without plugins:</p>
<ul>
<li> relate posts to posts</li>
<li> relate pages to categories and tags</li>
<li> relate tags/custom to tags/custom</li>
</ul>
<p>If we wanted to represent &#8220;joe (post_id=1) worksfor acme (post_id=2)&#8221; we would have the following:</p>
<p>mw_term.term_id = x<br />
mw_term.subtype = custom<br />
mw_term.title = &#8220;Works for&#8221;<br />
mw_term.slug = &#8220;works-for&#8221;</p>
<p>mw_triple.subject_type = &#8220;post&#8221;<br />
mw_triple.Subject_id = 1<br />
mw_triple.predictate_id = x<br />
mw_triple.object_type = &#8220;post&#8221;<br />
mw_triple.Object_id = 2</p>
<p>This is simple and straight forward.</p>
<h3>What can be done in the current framework?</h3>
<p>The most obvious thing is not to worry and just work with post-custom taxonomies. These are quite powerful and should get you a long way. This approach should gain a quick takeup once the taxonomy plugins become more widely deployed and used. For example, the <a href="http://yoast.com/wordpress/simple-taxonomies/">Simple Taxonomies</a> plugin is very simple to use and quite intuitive. If only I could get the target links to work <img src='http://cdn-small.murraywoodman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>But what is we want to do more within the wp_term_taxonomy paradigm. What can we do? It would be possible to hack some &#8220;proxy&#8221; term_taxonomies to make statements about posts. This allows us to make statements about a post as an object (in the triples sense of the word).</p>
<p>We will reuse the &#8220;joe worksfor acme&#8221; example above. The posts get some auto created terms which we can use to relate them. The hack here is to have a shadow term for each post.</p>
<p>wp_terms.term_id = x<br />
wp_terms.name = &#8220;mw.post_id.1&#8243;<br />
wp_terms.slug = &#8220;mw.post_id.1&#8243;</p>
<p>wp_terms.term_id = y<br />
wp_terms.name = &#8220;mw.post_id.2&#8243;<br />
wp_terms.slug = &#8220;mw.post_id.2&#8243;</p>
<p>wp_term_taxonomy.wp_term_taxonomy_id = t<br />
wp_term_taxonomy.taxonomy = &#8220;Works for&#8221;<br />
wp_term_taxonomy.term_id = y</p>
<p>wp_term_relationships.object_id = 1<br />
wp_term_relationships.term_taxonomy_id = t</p>
<p>We have just expressed &#8220;joe worksfor acme&#8221;. This is obviously a lot more complex than the example because we are forcing it to do something it doesn&#8217;t want to do.</p>
<p>This is problematic mainly because of duplication of data in wp_terms, making data integrity harder. If &#8220;joe&#8221; is deleted we will need to delete wp_terms.1. The row wp_term_taxonomy.t might also need to be deleted since it is an orphan. It also doesn&#8217;t solve the case where we want to relate tags with tags or custom with custom. So this is a sub-optimal solution.</p>
<h3>Conclusion</h3>
<p>The best way to look at taxonomies is to consider them as tags on steroids. To be honest this will solve a lot of problems and I am looking forward to using them to improve my tag structure. This will get me most of the way there.</p>
<p>I did have the dream of being able to import RDF and dump it into the two metadata centers in WordPress: Custom Fields for literals and Taxonomy for relationships. Or failing that, at the very least I wanted an easy way to relate my posts. However, it now appears that the taxonomy structure is a halfway house which isn&#8217;t capable of supporting structures as flexible as those found in RDF. It also seems to fall short for simpler things as well.  If you wanted to go down this path then the best bet seems to support a data structure outside of the WordPress tables which is a shame. How easy would it be to plug in an open source Topic Maps or RDF engine to support these relationships?</p>
]]></content:encoded>
			<wfw:commentRss>http://murraywoodman.com/355/wordpress-taxonomies/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Sydney Institute</title>
		<link>http://murraywoodman.com/239/sydney-institute?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sydney-institute</link>
		<comments>http://murraywoodman.com/239/sydney-institute#comments</comments>
		<pubDate>Sat, 30 May 2009 06:17:08 +0000</pubDate>
		<dc:creator>Murray Woodman</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[paypal]]></category>
		<category><![CDATA[publishing]]></category>
		<category><![CDATA[subscription]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://murraywoodman.com/?p=239</guid>
		<description><![CDATA[The Sydney Institute publishes the Sydney Papers, a quarterly publication of the various speeches given at weekly events. The Sydney Institute required a CMS which would allow them to maintain a subscription list where paying members have access to protected content. This was implemented as a WordPress site with a subscription manager. Requirement: Content Management, [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://murraywoodman.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/239.png&amp;w=100&amp;h=100&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p><a href="http://www.thesydneyinstitute.com.au/publications/">The Sydney Institute publishes</a> the <em>Sydney Papers</em>, a quarterly publication of the various speeches given at weekly events. The Sydney Institute required a CMS which would allow them to maintain a subscription list where paying members have access to protected content. This was implemented as a WordPress site with a subscription manager.<span id="more-239"></span></p>
<p><strong>Requirement:</strong> Content Management, Publishing, Subscription<br />
<strong>Technology:</strong> WordPress, PayPal, Theme customisation</p>
]]></content:encoded>
			<wfw:commentRss>http://murraywoodman.com/239/sydney-institute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing, Testing, 123</title>
		<link>http://murraywoodman.com/16/testing-testing-123?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=testing-testing-123</link>
		<comments>http://murraywoodman.com/16/testing-testing-123#comments</comments>
		<pubDate>Mon, 15 Dec 2003 03:09:00 +0000</pubDate>
		<dc:creator>Murray Woodman</dc:creator>
				<category><![CDATA[Know Idea]]></category>
		<category><![CDATA[blogger]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://cruncht.org/?p=16</guid>
		<description><![CDATA[I&#8217;ve just set up this blog using Blogger. Wouldn&#8217;t have done it if it wasn&#8217;t for the orange &#8220;b&#8221; in the google toolbar. One day I&#8217;ll get around to posting up some of my ideas&#8230; I&#8217;ve got a whole heap scattered around the place. Some of them go back several years &#8211; before this blog [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just set up this blog using Blogger. Wouldn&#8217;t have done it if it wasn&#8217;t for the orange &#8220;b&#8221; in the google toolbar. One day I&#8217;ll get around to posting up some of my ideas&#8230; I&#8217;ve got a whole heap scattered around the place. Some of them go back several years &#8211; before this blog post. I&#8217;ll set the dates retrospectively on them so that there is some kind of chronological ordering.</p>
<p><strong>Update</strong></p>
<p>Yep. I have worked through my various scribblings and have now uploaded some blog posts. Yipee.</p>
<p>At the time of inspiration I genuinely felt that there was something innovative in each of the ideas. In many (most) cases a little research demonstrated that the idea wasn&#8217;t that new and in fact someone had managed to implement it to a certain degree. Oh well. I&#8217;ve still included the ideas though for historical purposes. The joke is that many of the AdSense ads actually are for the idea <img src='http://cdn-small.murraywoodman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>There are of course a few ideas that I have held back on. I&#8217;m hoping to make something of them before releasing them to the world.</p>
<p><strong>Update:</strong> I moved the blog to WordPress in May 2009 and am happy for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://murraywoodman.com/16/testing-testing-123/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Content Delivery Network via cdn-small.murraywoodman.com

Served from: murraywoodman.com @ 2012-05-20 06:21:36 -->
