rgarner edited this page Feb 6, 2011 · 4 revisions
Clone this wiki locally

Why does this gem exist?

In December, DGS was altered to support multiple tagging schemes. Originally, we thought we could use the off-the-shelf gem acts-as-taggable-on to perform these taggings, and indeed this worked well for keywords and IPSV subject tags (the only two schemes available at the time). It was thought that we'd simply be able to bolt a hierarchical taxonomy model on afterwards as a tangentially-related concept. However, there's a subtle problem with the internal modelling of acts-as-taggable-on. We were treating a tag as roughly equivalent to a taxonomy concept, but in AATO this isn't the case. AATO puts tags into 'contexts' at the time a document is tagged, so by saying

  article.dg_topics = ['Environment', 'Greener Living']

we are really creating two taggings against that article, and the 'Environment' or 'Greener Living' are added to the big bucket of strings that is the tags table (if they don't exist already). For our taxonomy-browsing purposes this isn't enough. A concept 'Environment' should be able to exist without having an explicit tagging (it may be tagged with one of its children, such as 'Greener Living', so tagged_with 'Environment', :on => :dg_topics should be able to pick up articles tagged with 'Greener Living').

Since we developed against non-hierarchical schemes (IPSV subjects and keywords) we didn't notice this until much later. Simple taggings aren't enough - tags must be able to exist in schemes independent of their taggings, as taggings are just a small window on a potentially much larger taxonomy.