Having ended up as co-author of the Atom Rank Extensions draft
<http://www.ietf.org/internet-drafts/draft-snell-atompub-feed-index-09.txt>
I would like to encourage some more discussion on the extension's
features.  I would especially like to know whether they are flexible
enough to cope with all the major use cases while being at the same time
reasonably simple to implement.

The extension should, e.g., be able to cope with most grading schemes in
use; it needs to be able to describe the set of permissible rank values
(grades).  So we are talking (totally) ordered sets here.

Now the order part is easy; that is what @significance
(="ascending"/"descending") is for.  The hard part is to describe the
underlying set of numbers.

Now the current draft defines two elements, r:value and r:range, for
this purpose.  Those two elements can be, however, be collapsed into a
single one, and, with cleverly chosen defaults, defining sets using this
new r:values element is IMHO as simple, if not simpler, as with the old
approach.  Others might have different opinions, though, which I would
really like to hear about.

At any rate, the proposed change looks basically as follows (Note,
however, that the issue of rounding rank values has intentionally been
left out, since this would only distract from the design issue at hand.)


The r:scheme Element

Ranking Schemes are defined using the r:scheme element.  Each scheme
defines the set of rank values permissible for all r:rank elements with
the associated scheme.

[...]

The set of rank values defined by an r:scheme element is the union of
the sets of rank values defined by each of its r:values elements.  Note
that those sets may overlap.

The r:values Element

The r:values elements defines a set of rank values, each of which has to
conform to the XML Schema decimal data type [W3C.REC-xmlschema-2-20041028].

  values = element r:values {
    atomCommonAttributes,
    attribute minimum { xsd:decimal | "unbounded" }?,
    attribute maximum { xsd:decimal | "unbounded" }?,
    attribute steps   { xsd:decimal | "continuous" }?,
    attribute origin  { xsd:decimal }?,
    undefinedContent
  }

The "minimum" attribute specifies an inclusive lower bound on the set of
rank values defined by the r:values element.  Here, the special value of
"unbounded" denotes negative infinity.  If not specified, the value of
the "minimum" attribute is considered to be "unbounded".

The "maximum" attribute specifies an inclusive upper bound on the set of
rank values defined by the r:values element.  Here, the special value of
"unbounded" denotes positive infinity.  If not specified, the value of
the "minimum" attribute is considered to be "unbounded".

The "steps" attribute specifies either an increment or has the special
value "continuous".  If not specified, the value of the "steps"
attribute is considered to be 0.

The "origin" element specifies the base from which steps are to be
calculated. If not specified, the value of the "origin" attribute is
considered to be 0.

If the value of the "steps" attribute is "continuous" the set of rank
values defined by the r:values element is

  { x | minimum <= x <= maximum }.

Otherwise the set of rank values defined by the r:values element is

  { x | minimum <= x <= maximum,
        x = (origin + i * steps) for some integer i }.

The following examples illustrate how different sets of rank values can
be defined by means of a single r:value element:

<!-- The rank value 1 -->
<r:values origin="1" />

<!-- The rank values 1, 2, 3, 4, 5 -->
<r:values minimum="1" maximum="5" steps="1" />

<!-- The rank values 0.0, 0.5, 1.0, 1.5, ...., 10.0 -->
<r:values minimum="0.0" maximum="10.0" steps="0.5" />

<!-- The rational interval [0, 100] -->
<r:values minimum="0" maximum="100" steps="continuous" />

<!-- The integers ..., -2, -1, 0, +1, +2, ... -->
<r:values steps="1" />

<!-- The natural numbers 0, 1, 2, ... -->
<r:values minimum="0" steps="1" />


That's all.  Also note that this approach allows overlapping r:values
sets.  For example, one is now able to define, in a reasonable concise
way, the following grading scheme common in Germany:

<!-- 1.0, 1.3, 1.7, 2.0, 2.3, 2.7, ..., 4.0, and 5.0 -->
<r:scheme significance="descending" ...>
  <r:values minimum="1.0" maximum="4.0 origin="1.0" steps="1.0" />
  <r:values minimum="1.0" maximum="4.0 origin="1.3" steps="1.0" />
  <r:values minimum="1.0" maximum="4.0 origin="1.7" steps="1.0" />
  <r:values origin="5.0" />
</r:scheme>

Of course one could alternatively list all 11 values explicitly, but the
above is rather more concise.  (In fact, the definition of 5.0 could
even be moved into the first r:values element.)

But as I said above, others might see this differently...

Also, I would like to know whether a definition in terms of set notation
is fine with you, or whether we should expand on the natural language
explanations.  Describing precisely what "origin" and "steps" do, in
plain English, is unfortunately surprisingly difficult. :-(

Looking forwards to your feedback,

Andreas Sewe

Reply via email to