Categories are one of the most powerful and important aspects of Atom.
FWIW, in our Atom server;

1) We use GData-style Categories, at least in spirit.
GData uses some non-URL friendly characters, which we have swapped out for ease-of-use
So to select a Feed of a single URL;
     GET /v1/foos/bars/-/(urn:ha.foos.brands)HR

2) We have settled on "prefix notation" for more complex Category logic. e.g. OR AND x y z So in a URL, if you want to get all foos in brand "HR" that have Categories of type of "xxx" or "yyy", you would say:

    GET 
/v1/foos/bars/-/AND/(urn:ha.foos.brands)HR/OR/(urn:ha.foos.type)xxx/(urn:ha.foos.type)yyy

3) We allow the user to manipulate Categories themselves using a specialized Workspace. This was the most natural choice. We already have that vocabulary, so why not extend it.
So we use an automatic, parallel, transparent workspace.
E.g. for workspace "foo", the Categories are manipulated in workspace "tags:foo"

4) We have an easily configured "auto-tagger", which can be configured for each Workspace.
Its an interface, but the primary form is XPathAutoTagger.

Cheers,
- Chris


On Apr 30, 2008, at 2:50 AM, David Calavera wrote:

I don't know if it's the best practice but I usually add another route with
categories as part of the url:

.addRoute("feed", base + "*:collection/category/:cat*",
TargetType.TYPE_COLLECTION)

I think this approach is more user friendly

On Tue, Apr 29, 2008 at 11:00 PM, Remy Gendron <[EMAIL PROTECTED]> wrote:

Ok I have found in the Abdera unit tests and examples some code that
indicates that the following url should return the list of categories
associated to the specified entry:

http://localhost:8080/imdb/atom/movies/630226;categories

What I am trying to understand is the URL scheme to use to request the
collection of movies that are part of say, both the scifi and top100
categories.

Of course, I could do something like .../movies?cat=scifi&top100, but I believe the best practice is to specify the categories as part of the URL
path... Am I right?

Remy



-----Original Message-----
From: Remy Gendron [mailto:[EMAIL PROTECTED]
Sent: April 29, 2008 15:52
To: [email protected]
Subject: RE: Categories example

And just to be clear, I understand the Atom spec of the categories
document,
and how categories can be added to an entry, be it on the server side
(Entry.addCategory) or the client side (atom:category element).

I need to understand how it relates to URIs...

Thanks,


Rémy



[EMAIL PROTECTED]

418 809-8585
http://arrova.ca


-----Original Message-----
From: Remy Gendron [mailto:[EMAIL PROTECTED]
Sent: April 29, 2008 15:40
To: [email protected]
Subject: RE: Categories example

More questions:

I see that AbstractProvider will call the adapter's getCategories on a GET
for entries that are part of one or more categories:

Question 1) I cannot decipher from the Route implementation how you
specify
one of more categories for a feed request. Could you provide expansion
examples for base/:collection/:entry;categories, as defined in
DefaultProvider.

Question 2) I use AbstractEntityCollectionAdapter. Is there proper
integration for categories support with this entity oriented adapter?

Question 3) On a getEntries, I know how to fetch the parameters from the request and use them to fetch the entries. Assuming that getCategories is called, do I only have to retrieve the categories from the URL path and
fetch the matching entries?

Is the scheme used to specify the categories (which I don't know at the moment - see question 1) part of some Atom specifications? How does this
compare with the GDATA path/-/category/category/... scheme?

I have seen in the Abdera codebase how to add category info to a feed.
That
part is clearer.

Thanks again,

Rémy



[EMAIL PROTECTED]

418 809-8585
http://arrova.ca


-----Original Message-----
From: Remy Gendron [mailto:[EMAIL PROTECTED]
Sent: April 29, 2008 14:54
To: [email protected]
Subject: Categories example

I was looking for an example of dealing with categories.



I am using the DefaultProvider implementation, hence the RouteManager,
which
defines a route I have trouble interpreting. How would the URL to access a
collection category look like?



What is the contract of the AbstractCollectionAdapter with regard to
category support (getCategories(RequestContext)).



Thanks,





Rémy






--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.6/1403 - Release Date:
29/04/2008
7:26 AM



--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.6/1403 - Release Date:
29/04/2008
7:26 AM





--
David Calavera
http://www.thinkincode.net

Reply via email to