Taxonomy for beginners!
Hi, here is a IRC log from #drupal-support about using taxonomy. Probably a lot of people will find this usefull:
[15:37] Without using taxonomy, I shoudl still be able to create a fairly static website with menus right?
[15:38] yes.
[15:39] taxonomy confuses me
[15:39] whats the purpose besides making categories for blog topics
[15:40] rump: organizing, categorizing nodes
[15:41] so i get terms
[15:41] but why the vocabulary
[15:41] rump: well, first of all, how many terms are you gonna use?
[15:41] i never know what to put for vocab
[15:41] what's a "category" vs. a "blog topic"
[15:42] "Blog Topics" => Name of Vocab
[15:42] "Monkeys" => Name of Term within "Blog Topics" Vocab
[15:42] well, say i want to categorize animals
[15:42] animals that are warm blooded
[15:42] animals that are primates
[15:42] animals that eat fruit
[15:43] can one node belong to all of these
[15:43] of course.
[15:43] and across multiple vocabs?
[15:43] http://www.disobey.com/node/1693 is a blog post that has 5 terms: Words: adware | Disobey Nonsense Network | Firefox | google | winer
[15:43] yes again, sure.
[15:43] or not. entirely up to you.
[15:44] rump: facets are not hierarchical, that's the idea
[15:44] did you create all these categories
[15:44] or free tagging
[15:44] brick: lord in heaven, don't tell him that.
[15:44] that's like fifty new words in the span of 7.
[15:44] rump: those are freetagging terms, but I could just have easily made them before hand.
[15:45] the only difference between "freetagging" and anything else Drupal taxonomy can do is *how you enter the data*.
[15:45] Nothing else changes.
[15:45] so,
[15:45] i guess what i really think about
[15:46] is why use taxonomy to display all those animals who are fruit eating warm bloods
[15:46] instead of just a query
[15:46] a query of what?
[15:46] what are you talking about now?
[15:46] okay say i have database of products
[15:46] each product will have a page, a node
[15:47] now i want to display all products on sale
[15:47] or whatever
[15:47] you're mixing intent, I think.
[15:47] but go on.
[15:47] ok so tax doesnt play this role
[15:47] taxonomy is nothing more then categories.
[15:48] nothing more. it doesn't do anything special.
[15:48] It can be as stupid, or as smart, as you want.
[15:48] For instance.
[15:48] before i used to select from table where type is frugivore
[15:48] * Morbus tries to shove something into your metaphor.
[15:48] and then display those 10 records
[15:48] what's "type"?
[15:48] lord in heaven :)
[15:48] table column
[15:49] table column of what? node?
[15:49] terms and node types have little in common.
[15:49] no of my animals table
[15:49] well, now you're off creating your own tables.
[15:49] haha
[15:49] okay my animal node
[15:49] with a hidden field called type
[15:49] no, no, no.
[15:49] no, no, no.
[15:49] think simpler.
[15:49] yes, save me please
[15:50] think dummer.
[15:50] I have a blog about my dog.
[15:50] I collect dogs.
[15:50] I have fifty dogs.
[15:50] I write about dogs a lot.
[15:50] I have fifty different dogs.
[15:50] My dogs can be described as Finicky, Angry, or Dumb.
[15:50] ok and allow people to vote on which dog is coolest
[15:50] and display top 10 favorite dogs
[15:50] no, that's not taxonomy either
[15:50] ok
[15:51] I've got 5000 blog entries about dogs.
[15:51] i thought taxonomy is magical but i think i was expecting too much
[15:51] How do I find all the entries, with *no additional coding*, about Brown, Stupid dogs, and Toilet Training.
[15:51] *with no conding at all*.
[15:51] Here's how you do it.
[15:51] why cant you add to that
[15:51] Three vocabs: Color, Personality, and Training
[15:51] brown stupid dogs with toilet training who have 4.5+ voting
[15:51] * Nomad411 is listening attentively, actually learning.. :)
[15:52] will you leaving the voting out of it for a second?
[15:52] lol
[15:52] taxonomy *does not analysis at all*
[15:52] heheh okay
[15:52] Voting requires analysis.
[15:52] hi
[15:52] que tal, fuffalo
[15:52] So, if I had three vocabs, as above.
[15:52] I'd be able to say, WITH NO CODING AT ALL, show me all the entries about White Dogs.
[15:52] or, show me all the entries about Sad dogs.
[15:52] Or, show me all the entries about Black dogs who are Sad.
[15:52] Or, "I have a Dumb dog, how do I toilet train him?"
[15:53] if you added 2 more vocabs, dogs and cats.. could you immediately go, show me cats who are black who are sad
[15:53] Because of taxonomy, and because of the *categories* with which I've described a post, I can do that.
[15:53] Yes.
[15:53] oh, thats neat
[15:53] Let me show you a real world example.
[15:53] over at nhpr.org, we have two vocabs.
[15:53] One is "Show Name" - it's a vocab of all the shows that NHPR produces each day.
[15:53] The other is simply "Keywords" - free tagging, in essence.
[15:54] Here is a list of all entries tagged to the "Show" "NHPR News": http://www.nhpr.org/taxonomy/term/15002
[15:54] and here is al ist of all entries tagged to the "Keyword" "Family": http://www.nhpr.org/taxonomy/term/1202
[15:54] but, what if i wanted to ONLY show "Family" entries in the "NHPR News" "Show"?
[15:54] blam!
[15:54] http://www.nhpr.org/taxonomy/term/1202+15002
[15:55] dang, just with the + like that
[15:55] right.
[15:55] brilliant
[15:55] now, NHPR is pretty special.
[15:55] what if i want to limit the scope of a vocab to another vocab
[15:55] Because i've created a "related tags" sort of thing.
[15:55] so, here's an entry: http://www.nhpr.org/node/10294
[15:55] and, because of tags, I can show "RElated news" and "Related shows"
[15:55] because they share terms.
[15:56] boing
[15:56] you made this site?
[15:56] yes.
[15:56] nice
[15:56] is this head too
[15:56] no, this is from last year.
[15:58] but, the principle does not change at all.
[16:00] see also http://www.nhpr.org/node_neighbors/10294
[16:00] which lists "for this entry, show me the most recent entries in the same terms"
[16:00] isnt recent analysis
[16:01] well, that URL, along with the "RElated" is custom code that I've written to extend taxonomy.
[16:01] By itself, taxonomy doesn't do that.
[16:01] But *having the data available in taxonomy* allows me to make these sorts of analysisisisis
[16:02] so i will be able to, query all from these 3 terms only order by this field and limit 10
[16:02] using the tax data
[16:02] yes.
[16:02] neato
[16:03] thanks, you cleared that up for me
[16:03] and that happens automatically just by a magic URL
[16:03] http://www.disobey.com/taxonomy/term/1 - show me all terms in "Disobet Nonsene Network"
[16:03] http://www.disobey.com/taxonomy/term/3 - show me all terms named "Drupal"
[16:03] http://www.disobey.com/taxonomy/term/3+1 - show me all entries matching Drupal and DNN
[16:04] freetagging creates these terms on the fly, each with an id?
[16:04] (i screwed up the descriptions of the other two)
[16:04] yes.
[16:04] or, you can enter them yourself in the admin/taxonomy screens
[16:04] http://www.disobey.com/taxonomy/term/3,1 rather
[16:04] not a +
[16:04] dammit.
[16:04] heh.
[16:04] commas not plusses
[16:04] whats + vs ,
[16:05] and, or?
[16:05] ignore +
[16:05] , only
[16:05] the + is or, i Blieve
[16:05] and the comma is and
[16:05] yeah.
[16:05] you had it right.
[16:05] i'm useful.
[16:06] heh
[16:06] you are, ty much
[16:07] Yes, thanks a lot Morbus, great explanation
[16:07] now, going back to your products metaphor.
[16:07] say you're not a coder.
[16:07] but you really need to tell your viewers about your inventory.
[16:07] and whether you have the items in or not.
[16:07] Now making a very basic site to get going, cuz deadlines are short, taxonomy can be added afterwards of course..
[16:07] ?
[16:08] menu items with the url with , tax ids eh
[16:08] you could add a new Vocabulary called "Inventory", with terms "In Stock", "Out of Stock", "Expecting Soon"
[16:08] now, again with no coding, you can label a product as In Stock, Out of Stock, or Expecting Soon.
[16:08] es muy powerful
[16:08] And, from an admin/inventory standpoint, you can say "shit, what do I need to reorder? I know! I'll go to the URL that shows all my products that are Out Of Stock!"
[16:08] and blam, you're done.
[16:09] and change the terms a product belongs programatically?
[16:09] Nomad411: correct, yeah.
[16:09] not programmatically.
[16:09] hmm
[16:09] you just say "hey! Drupal! Whenever I edit a product, let me choose an option from this vocabulary"
[16:09] when you create a vocabulary, you are given a list of all the different node types in your Drupal install.
[16:10] So you can say "i'd like inventory to be associated with the product type, and I'd like this Monkey vocab to be associated only with animal node typds"
[16:10] ok
[16:10] and this is all done from the admin menus.
[16:10] nothing you need to code.
[16:12] what are some of the most obsecure things taxonomy can be used for heh
[16:12] i remember reading of really weird applications, thats why i thought it did other things
[16:12] well. heh.
[16:12] Morbus is more likely to know the obscene things taxonomy can be used for...
[16:12] * Morbus whistles.
[16:13] oh hi Morbus
[16:13] * Morbus shuffles around for screenshot.
[16:13] heh
[16:13] rump: http://www.disobey.com/detergent/2005/similar_keywords.jpg
[16:13] Morbus: that's nifty
[16:14] that's generated by http://cvs.drupal.org/viewcvs/drupal/contributions/modules/taxonomy_simi...
[16:14] which is a 4.6 module I wrote for NHPR.
[16:14] They have upwards of 8000+ terms in their database.
[16:14] So when they're adding terms to stories, it's really helpful to see similar terms that they should also use.
[16:14] yeah that scares me of free tagging
[16:14] bunch of misspelled and duplicate terms
[16:15] well, that's the downside of free tagging.
[16:15] and it's helped along a bit by the autocomplete in drupal 4.7
[16:15] but, really, when you use freetagging, you throw control to the wind.
[16:15] oh no
[16:15] they're case sensitive
[16:16] in that screenshot, they are.
[16:16] i'mnot sure if that's Real though.
[16:16] may have changed. I don't recall.
[16:16] how long was that project
[16:17] well, i had written the code already for nhpr before they used drupal.
[16:17] it only took about an hour to convert over.
[16:17] probably take another hour to convert to 4.7
[16:17] in fact, i'm the one who wrote freetagging for Drupal, *because* of NHPR ;)
[16:18] wow
[16:24] * redmonk genuflects
[16:24] * Morbus strokes chin.

Nice!
That was useful, thanks. I didn't know about the + and comma action. Excellent insight!