Categories of tags

2020-02-29 10:14发布

问题:

I'm starting a pro bono project that is the web interface to the world's largest collection of lute music and it's a challenging collection from several points of view. The pieces are largely from 1400 to 1600, but they range from the mid-1200's to present day. Needless to say, there is tremendous variability in how the pieces are categorized and who they are attributed to. It is obvious that any sort of rigid, DB-enforced hierarchy isn't going to work with this collection, so my thoughts turn to tags.

But not all tags are the same. I'll have tags that represent a person/role (composer, translator, entabulator, etc.), tags that represent the instrument(s) the piece in written for, and tags that represent how the piece has been classified by any one of half a dozen different classification systems used over the centuries.

We will be using a semi-controlled tag vocabulary to prevent runaway tag proliferation (e.g. del.icio.us), but I want to treat the tags as belonging to different groups. People tags should not be offered when the editor is doing instrument tagging, etc.

Has anyone done something like this? I have several ways I can think of to do it, but if there is an existing system that is well-done it would save me time implementing/debugging.

FWIW: This is a Django system and I'm looking at starting with Django-tagging and then hacking from there, possibly adding a category field or ...

回答1:

There's an issue #14 for django-tagging filed back in 2007 which is trying to address this problem. Don't know whether developers are planning to add this feature or not.

However, there's a machinetags branch of django-tagging mantained by Gregor Müllegger here at https://code.launchpad.net/~gregor-muellegger/django-tagging/machinetags/. It allows to assign tags namespaces (and/or values), and facilitate querying tags by namespace / value. So you'd be able to tag a piece with instrument:<instrument_name> or instrument=<instrument_name>, for example.

It's mostly in sync with the django-tagging trunk (the latest commit is there's a number of commits missing though). I remember myself working on some project using that branch about a year ago; it worked fine. Read the documentation on branch and comments on the issue for more details.