Jump to content

Taxonomy Management


WillMorris
 Share

Recommended Posts

We're evaluating Processwire to see if it will work for our site. One of the major requirements is being able to maintain a large taxonomy . You can see our current example here:

http://neotropical.birds.cornell.edu/portal/species/tree

We need to be able to maintain a set of terms with key values and associated metadata (e.g. common name, scientific name, alternate name, etc.) and then associate content with those terms.

Does Processwire allow us to create and maintain a taxonomy of this size? What are the upper performance limits?

Thanks.

Link to comment
Share on other sites

Hello Will (or Morris :) ),

first, regarding size: There are already sites of all sizes: from 3 or for pages to thousands. Theoretically, there are no performance limits, since you can always add memory and CPU :) In reality, System tends to be slow-ish if you load 6k+ pages in a single page (note here please, that this is loading in one call, not having it in your tree).

second, regarding taxonomies: There is absolutely no problem with this. You'll basically make one page, which will be parent of all of items, each item having virtually any data you please. Also, adding this items to your other pages (as tags to blogs, for instance) is as simple as having one 'page' field (one of the types of content you can have in ProcessWire), and selecting items you wish to link to this page. In the code, you'll have this simply available via

<?php
foreach ($page->taxonomy_items as $item){
 //here is all data for linked taxonomy items
}

(note: this example assumes you named your taxonomy link field 'taxonomy_items')

Link to comment
Share on other sites

Hi Will and welcome to the forums.

ProcessWire will scale very well in that kind of usage. You can easily build multiple categories, subcategories etc. There is no limits for how many categories you can have or how many terms there will be. You can also freely define what metadata each term has (common name, scientific name, alternate name etc).

Link to comment
Share on other sites

WillMorris,

Very likely ProcessWire will be a good fit for your need. That bird site would be an excellent example of where ProcessWire does well. When it comes time to build your "taxonomy" post the full scenario here and we'll guide you through the best approach. ProcessWire tends to be very flexible in this regard, and that means that some ways to approach something are better than another. For instance, it would be possible to build this taxonomy in a way that's not very efficient, and likewise possible to build it in a way that's highly efficient. When it comes to building for the large scale, you have to be more careful with approach in order to ensure you aren't accidentally loading 6k pages in 1 API call (as Adam mentioned).

Taxonomy is such an unfortunate term. It has a strong resemblance to the term "Taxidermy", which in English means the "art" of creating life-like stuffed animals out of dead animals. Not a mental picture I like. This is why you don't see me use the term taxonomy very often. :)

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

I've a followup on WIll's question on this topic. One thing about the biological taxonomy we use in the neotropical birds site is that the taxonomy changes yearly. Basically the meaning of the term "Blue-crowned Motmot" actually changes requiring yearly updates to the metadata associated with at least some of the keys. Because there are over 4000 terms (species) with associated metadata, we need to be able to programmatically update the metadata and also be able to programmatically update the 'page' field values or tags in all pages which have a specific tag value.

Does processwire have this level of programatic access to the taxonomy tables or would I need to write directly to the database for updates?

Thanks

Jeff

Link to comment
Share on other sites

@jgerbracht, with page field you can choose any field of the targeted page for it's label. I just tried it, and the label does change when you modify this field on the selected page.

post-88-0-65754900-1332356602_thumb.png

Link to comment
Share on other sites

I think diogo may have your answer there and what I was typing below might be way off, but I'll finish typing it anyway as it shows off some other PW features.

I would say yes to your question Jeff, but the thing to remember here is that in ProcessWire every piece of content is a page. That sounds confusing and possibly slightly mental at first, but it's incredibly powerful system as a page can be anything you want it to be.

Because all "pages" are accessible via the API, it is simple enough to batch-update pages as you want to.

As a rough example (that would need tweaking to handle lots of pages) you can do something like this - this just adds a bit of text to say " - edited" to the end of the title field as an abstract example, but you can edit any field you like:

$birds = $pages->find('template=birds');
foreach ($birds as $bird) {
$bird->title .= " - edited";
$bird->save();
}

And that's all there is to it. I realise that's incredibly simple and likely not at all what you want to do, but it does very briefly show off the selectors that you might use to get the relevant pages and the save function to save your changes.

If you're making a single change to the same field across many hundreds or thousands of pages, it might be best to instead skip the line where I saved the page and rab all the page ID's instead, then run a mySQL query to do something like:

UPDATE field_table SET data = $your_changed_data where pages_id IN($page_ids_selected_earlier)

Looking back at diogo's answer though, that would be the far easier approach and I'm not sure why I didn't think of that first - every time I think metadata I think of keywords and a text field with comma-separated values (the way I used to do it in MODx), when what he's suggesting with a dropdown generated from pages containing just a title field (really simple in PW and not as bonkers as it first sounds) is the best way to go by far.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...