Forum OpenACS Development: Looking for some advice re use of Categories.

Request notifications

Hi

I have a longer question about Categories in OpenACS but first I'll ask the shorter question: I'm having trouble finding documentation for Categories - searching under the old Documentation or the XoWiki stuff gave me nothing.

Does anybody know where I might find some?

thanks
Brian

Collapse
Posted by Brian Fenton on
Well, I found the basic design stuff at http://cvs.openacs.org/cvs/openacs-4/packages/categories/www/doc/ so that has given me a start.

Let me ask my question anyway, as somebody may be able to advise me on the best approach.

Looking at the data model, I can see all Trees are Categories but is every Category also a Tree? The data model certainly seems to say "NO" but the reason I'm confused is that /categories/cadmin/tree-map says "Map this subtree" when it's clearly linking to a Category, so that got me thinking that maybe Categories are also Trees. Maybe it's just a terminology thing? My natural thing to do is to take the data model as Truth but I'd love some confirmation of this.

If I have a simple Tree called Sport with sub-categories "soccer" "rugby" and "golf" (I only need to allow 1 sub-level in this particular example). Now I understand that "soccer" "rugby" and "golf" are all Categories but are they also Sub-Trees?

The reason I ask this is that I want to be able to allow various objects to map to these sub-categories. For example, I may want a Person to select which sub-categories they are interested in under the "Sport" category. I might also want a different type of object (e.g.a Ticket) to map to a different set of sub-categories of another Tree. Now, looking at the data model it appears that either CATEGORY_OBJECT_MAP or CATEGORY_TREE_MAP would be a perfect match for my needs. Can anyone explain when you would use either of those 2 tables? I guess the answer to my first question will answer that one too. I see there is some interesting looking "Widget" stuff on CATEGORY_TREE_MAP - does anyone have any more info on how to best use that?

many thanks for any help
Brian

Collapse
Posted by Brian Fenton on
Finally got a chance to come back to this and answer my own question. I had completely misunderstood the data model when I asked the original question but after reading the nested sets stuff here http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=49180 it all started making sense.

So trees are not categories. However a branch of a tree comprised of some categories is sometimes referred to as a subtree with one category as the root, but this does not make it a tree.

Once I had that clarified it made my 2nd question very straight forward to answer - I used CATEGORY_OBJECT_MAP to map my objects to multiple categories. There is a beautiful API there for doing this. Worked very nicely - I enjoyed my introduction to categories.

Hope this is useful to somebody else someday.

Brian

Collapse
Posted by Iuri Sampaio on
Collapse
Posted by Brian Fenton on
Thanks Iuri, your reply is apprectiated, but it was Categories I was interested in, not Notifications. :-)

Good to see the old Openforce website again though!

thanks
Brian