![Announcement icon Announcement icon](https://cdn.statically.io/img/www.drupal.org/files/styles/grid-2-2x-square/public/announcements/drupal-evergreen-logo-280X280px%20%281%29_0.jpg?itok=PHpn6rCb)
Instead of associating only nodes with taxonomy terms, It would be immensely useful to classify URIs instead. This is a superset of our current functionality, also offerring us a way to classify users, comments, feeds, and other non node items.
I would not expect for taxonomy.module to provide a UI for selecting URLs similar to the select box for nodes, just provide an API for other modules to use.
Idea suggest at this feature request.
Comments
Comment #1
kika CreditAttribution: kika commentedIt would be also a killer feature for distributed metadata systems such as XFML: http://xfml.org
But how to create such an extendable API?
Serialize extra fields to a term_data table? ANOTHER set of tables?
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedI like Kjartan's proposal a lot. Of course, I proposed a less mature version of this in October: http://list.drupal.org/drupal-devel/2002-October/007901.html
At first glance, it seems that adding a column for Domain is easier than associating URIs directly with terms.
-moshe
----- Original Message -----
From: "Kjartan Mannes"
To:
Sent: Thursday, December 12, 2002 2:11 PM
Subject: Re: [drupal-devel] feature #899 : Classify *anything* in a taxonomy
> Thursday, December 12, 2002, 7:42:59 PM, weitzman @ www . drop . org wrote:
> > Instead of associating only nodes with taxonomy terms, It would be
> > immensely useful to classify URIs instead. This is a superset of our
> > current functionality, also offerring us a way to classify users,
> > comments, feeds, and other non node items.
>
> I'm starting to dislike the current taxonomy API. Just too many support
> functions to do virtually the same thing. Just gonna throw some vague
> ideas out there and see how they land.
>
> Terms should not be linked to nid, but instead a general object. The
> table could look like:
>
> term_links table:
> | context | id | tid
> |----------|--------|----
> | node | 2 | 4
> | url | 2 | 2
> | node | 3 | 5
>
> Then have functions ala:
>
> taxonomy_get_term($conditions) {
> return array of terms matching conditions
> }
>
> taxonomy_get_vocabulary($conditions) {
> return array of vocabs matching conditions
> }
>
> taxonomy_get_synonym($conditions) {
> return array of synonyms matching conditions
> }
>
> taxonomy_get_hierarchy($conditions) {
> return array of hierarchy matching conditions
> }
>
> taxonomy_get_relation($conditions) {
> return array of relations matching conditions
> }
>
> taxonomy_get_link($conditions) {
> // For all links to nodes: $conditions = array("context" => "node");
> // For all links to a specific url: $conditions = array("context" => "url", "id" => 3);
> // For urls linked to a tid: $conditions = array("context" => "url", tid" => 3);
> return array of matching links
> }
>
> taxononmy_set_link($data) {
> // $data = array("context" => "node", "id" => 4, "tid" => 4");
> }
>
> If you added vid to the term_link table you could do pretty much
> anything with those functions. To me it just feels cleaner, and less
> functions to remember. Then again my knowledge of the taxonomy module
> isn't perfect so I don't know if this is a good idea.
>
> --
> Kjartan (http://natrak.net/)
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedHere is a 7 line patch which enables classifying anything in a vocabulary, not just nodes. This is done by adding a 'domain' column to the term_node table. Usually this column has 'node_nid' as its domain but modules are expected to provide their own domains.
for example, assume a module called feed.module which wants to classify feeds into a taxonomy. you can use 'feed_fid' as your domain and then add feed/term associations at will. The UI for adding these assocations is currently left up to the calling module, and not the taxonomy API. I added a '_taxo()' hook so that these non-node modules may hook into the Vocabulary admin page.
This feature is a start for private taxonomies as well.
In order to use this patch, you must add a column to your term_node table using the following SQL statement
I would think that feeds are a good candidate for being classified as a proof of concept (breyten?) ...
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedBreyten has given positive feedback for the patch here. Anyone else interested in this? It is ready for CVS consideration IMO.
Comment #5
(not verified) CreditAttribution: commentedUpon further review, the "taxo" hook introduced at the top of the previously posted patch is not necessary. Please ignore it.
Comment #6
steph CreditAttribution: steph commentedOk.. classifying anything in a taxonomy is something I am looking for at
the moment.
I am wanting to be able to classify user profiles in a taxo , but how
would this 7 line patch affect the taxonomy/or/ search
functionality , which afaik can only list nodes.
On Sat, 2003-05-10 at 14:57, weitzman@www.drop.org wrote:
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedIn order to view non-nodes which have been classified in the taxonomy, you have to roll your own view module which implements the txonomy_node_get_terms() function. That function name is misleading because after this patch, it can operate on non-nodes as well - see the 3rd parameter. But changing the function name means changing many other modules so I choose to keep it for now.
You cannot simply use the taxonomy/view/or/x syntax because taxonomy doesn't know how to render your 'anything' items.
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedAnd I should add that you have to roll your own UI for associating your 'anything' with taxonomy terms. This patch adjusts the core API, not user interface.
Comment #9
Mark Cheverton CreditAttribution: Mark Cheverton commentedGenerally do people think this is the best way of proceeding - allowing anything to be classified. With the effort to make comments nodes I would advocate that the core requirement is that users (and anything else that would be classified) should have a node representation, then we can do things like attach taxos (useful say for the user selecting a country when registering and other profile data) and also attach things to a user node like a FOAF record.
The downside as I see it is the difficulty in doing this without breaking all the DA modules, but it would provide alot of solutions to things like the profiles module, and enable some more advanced social software applications once you can start to group users together just like you can group nodes making applications such as ecademy much easier to build.
-Mark
Comment #10
JonBob CreditAttribution: JonBob commentedI agree with Mark. It seems much more flexible and powerful in the long run to keep taxonomy as a node classification system and make more types of information into nodes. Significant work has been done on turning feeds into nodes (http://drupal.org/node/view/468). It has frequently been stated that comments should be migrated over to nodes. If users could become nodes as well, that covers the use cases of the new domain field that have been given here as examples. We also have the user interface issue already solved by the existing node interface if taxonomy covers nodes only.
All that said, private taxonomies have also been frequently suggested, and as Moshe noted, this could be a positive step in that direction.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedThis discussion about how classification should work is nice, but we have to talk about code at some point. Specifically, we have talked for more than year about storing comments as nodes. But no patch for this has ever emerged. Maybe it is too hard, or maybe noone is motivated enough. Comment.module just underwent a significant overhaul, and it didn't include transition to node storage.
My point is that we have, in this project item, a working patch. In all other scenarios, we have hot air. This difference is very important. At some point, saying 'everything should be a node' is much less helpful than producing code code which gets us there.
I'n not trying to belittle an important debate, I just want to emphasize the importance of working code over theoretical discussion.
Comment #12
moshe weitzman CreditAttribution: moshe weitzman commentedComment #13
moshe weitzman CreditAttribution: moshe weitzman commentedComment #14
moshe weitzman CreditAttribution: moshe weitzman commentedComment #15
Dries CreditAttribution: Dries commentedIf we want to use one table (currently
term_node
) to bind different terms to different domains then we'll want to rename some tables and functions for sake of clarity and consistency. Moreover, we should try to generalize all node specific code. For example, we'll want to rework the administration pages so one can bind a single vocabulary to multiple domains, say 'nodes' and 'users'.I'd like to see this kind of functionality hit CVS but while Moshe's patch might be invaluable as a proof of concept, it needs to evolve some more before it can be considered CVS worthy. Renaming some tables and functions, rethinking some of the APIs and reworking snippets of the user interface strike me as important, no?
Comment #16
Dries CreditAttribution: Dries commentedComment #17
moshe weitzman CreditAttribution: moshe weitzman commentedanyone interested in reviving this effort? i think its still worth exploring.
Comment #18
pamphile CreditAttribution: pamphile commentedOf of the anticipated benefits is that you will be able to:
1. launch multiple websites based on your categories.
2. Use one codebase, intead of multiple codebases.
http://01wholesale.com
Comment #19
bdragon CreditAttribution: bdragon commented/me dredges this issue back to the top of the queue. ;)
This is a *very* interesting idea, and IMHO merits further discussion.
Router paths come to mind...
Comment #20
dmitrig01 CreditAttribution: dmitrig01 commentedI am going to try this one in 7. It's a great idea and should definitely get in... /me smells comment_taxonomy and user_taxonomy modules
Comment #21
mlncn CreditAttribution: mlncn commentedSubscribing.
benjamin, Agaric Design Collective
Comment #22
moshe weitzman CreditAttribution: moshe weitzman commentedOne possible way forward is for taxonomy to become a 'field' in #265604: Fields in core sense. Thats a ways into the future though.
Comment #23
marcp CreditAttribution: marcp commentedJournal could make good use of this feature, too: #480198: Allow single tags for Journal entries
Comment #24
Frando CreditAttribution: Frando commented#412518: Convert taxonomy_node_* related code to use field API + upgrade path will solve this.