Bill de hOra wrote:
> Brian Smith wrote:
>
> > I tried doing something similar:
> >
> > <atom:category term="dog" label="Dog" >
> > <atom:id>http://example.org/categories/dog</atom:id>
> > </atom:category>
>
> I like that. Part of me thinks atom:category could evolve
> into something that carries a lot of metadata; be a
> specialised entry if you like.
Right, my intent is to create a feed of entries that represent categories,
people, and collections, which would basically replace service documents and
category documents, and make user information discoverable.
> > On the other hand, reusing the existing markup like this
> > creates a lot of problems when people give different semantics
> > to the same construct, as shown above. That is why I stopped
> > trying to reuse any existing markup for new purposes.
>
> Sure, but that's a generalization. I'd ask, where is the specific
> problem here? Your first case, embedded atom:id, seems consistent to
> me.
My point is that your example is using atom:category/atom:id in a totally
different way than I was using it, and it seems really hard to predict when
that will happen.
> And so does an embedded atom:link in my category case.
> And as I said before, in the category case, it's preferrable to
> drilling links into @term or overloading @scheme to be a link.
> It's unfortunate that Atom categories aren't resources by design.
I agree, but there are a lot more alternatives. For example:
<link rel='category-schemes'
href='http://exmaple.org/categories/schemes.feed'
type='application/atom+xml;type=feed'/>
The link references an atom feed, where each category scheme is represented by
an entry. We can link a category to a scheme matching its atom:category/@scheme
to the scheme entry's atom:id. The category-schemes feed would be a metafeed as
is common in GData, so that each scheme entry has a corresponding feed that
lists the categories within that scheme. To avoid creating anything new, we
will link <atom:categories> elements to entries in that feed, by matching the
categories @term to the entry's <atom:id>. This would require
atom:category/@term to be an IRI, but I don't think that is a big deal since
there is a separate "label".
Example:
<feed>
<content type='application/atom+xml'
href='http://example.org/categories/tags.feed'/>
<entry>
<!-- Notice that no extensions are being used! -->
<category scheme='http://example.org/categories/tags'
term='http://example.org/categories/tags/holiday'
label='Holiday'</category>
...
</entry>
</feed>
<feed>
<id>http://example.org/categories/tags</id>
<link rel='self'
href='http://example.org/categories/schemes.feed'/>
...
<entry>
<id>http://example.org/categories/tags</id>
<title>Tags</title>
<content type='application/atom+xml'
href='http://example.org/categories/tags.feed'/>
...
</entry>
</feed>
<feed>
<link rel='self'
href='http://example.org/categories/tags.feed'/>
...
<entry>
<id>http://example.org/categories/tags/holiday</id>
<link rel='self'
href='http://example.org/categories/tags/holidays.entry'/>
<title>Holidays</title>
<content type='application/atom+xml'
href='http://example.org/categories/tags/holidays.feed'/>
...
</entry>
</feed>
Benefits of this approach:
* Every scheme is potentially an AtomPub collection, which means that
categories within each scheme can be edited via AtomPub. The editability of a
scheme can be determined by looking for an <app:collection> element within the
scheme's feed. The mapping between categories and entries is simple:
label : atom:feed/atom:entry/atom:title
term : atom:feed/atom:entry/atom:id
scheme : atom:feed/atom:id.
* Schemes can be explicitly added/edited/removed as well via AtomPub, using a
similar mapping.
* There is no need to repeat the mapping information within each atom:category
element, so it doesn't get in the way of clients that don't understand the
extension.
Drawbacks:
* The default scheme cannot be used, since atom:category/@scheme would have to
be a IRI.
* Category terms have to be IRI's for the same reason. You could use a separate
nested <atom:id> instead, but then @term becomes redundant.
* You might not want to force clients to navigate from the orignal feed ->
schemes -> categories -> category-specific feed. You could provide a shortcut:
<category scheme='http://example.org/categories/tags'
term='http://example.org/categories/tags/holiday'
label='Holiday'</category>
<link rel='self'
href='http://example.org/categories/tags/holidays.feed'
type='application/atom+xml;type=feed/>
<!-- and/or -->
<link rel='self'
href='http://example.org/categories/tags/holidays.entry'
type='application/atom+xml;type=entry/>
</category>
- Brian