Thread:Project:Support desk/Best way to grab parent categorization of article categories? (2)

Let's say you have a movie wiki and movie articles are categorized like that:


 * >> is in
 * >> is in
 * >> is in
 * >> is in

On that movie page I want to be able to use the categories for the json API. But by depending on their parent category type:
 * Get the genre categories of the article and do stuff with them.
 * Get the actor categories of the article and do stuff with them.

I want to output these in the Javascript vars in the DOM like this (preferably in the order as they're added on the article)

The parent category names are static and can be defined.

How the hell would I do that? I already have some code to grab the regular page categorization (regex on the article text before output > keeps the category order), but without checking the parent category of each.

It wouldn't make much sense to memcache the query on each page call I guess. Only if a further procedere is added on when a category page is edited.