- the feature set of the current request,
- a collection of quality values assigned to media types,
languages, and charsets for the current request, following the
model of the corresponding HTTP/1.1 [1] Accept- headers,
- a table which lists `forbidden' combinations of media types and
charsets, i.e. combinations which cannot be displayed because of
some internal user agent limitation.
The output of the algorithm is either the best variant, or the
conclusion that none of the variants are acceptable.
19.1 Computing overall quality values
As a first step in the local variant selection algorithm, the overall
qualities associated with all variant descriptions in the list are
computed.
The overall quality Q of a variant description is the value
Q = round5( qs * qt * qc * ql * qf * qa )
where rounds5 is a function which rounds a floating point value to 5
decimal places after the point. It is assumed that the user agent
can run on multiple platforms: the rounding function makes the
algorithm independent of the exact characteristics of the underlying
floating point hardware.
The factors qs, qt, qc, ql, qf, and qa are determined as follows.
qs Is the source quality factor in the variant description.
qt The media type quality factor is 1 if there is no type
attribute in the variant description. Otherwise, it is the
quality value assigned to this type by the configuration
database. If the database does not assign a value, then the
factor is 0.
RFC 2295 Transparent Content Negotiation March 1998
qc The charset quality factor is 1 if there is no charset
attribute in the variant description. Otherwise, it is the
quality value assigned to this charset by the configuration
database. If the database does not assign a value, then the
factor is 0.
ql The language quality factor is 1 if there is no language
attribute in the variant description. Otherwise, it is the
highest quality value the configuration database assigns to any
of the languages listed in the language attribute. If the
database does not assign a value to any of the languages
listed, then the factor is 0.
qf The features quality factor is 1 if there is no features
attribute in the variant description. Otherwise, it is the
quality degradation factor computed for the features attribute
using the feature set of the current request.
qa The quality adjustment factor is 0 if the variant description
lists a media type - charset combination which is `forbidden'
by the table, and 1 otherwise.
As an example, if a variant list contains the variant description
{"paper.2" 0.7 {type text/html} {language fr}}
and if the configuration database contains the quality value
assignments
types: text/html;q=1.0, type application/postscript;q=0.8
languages: en;q=1.0, fr;q=0.5
then the local variant selection algorithm will compute the overall
quality for the variant description as follows:
{"paper.2" 0.7 {type text/html} {language fr}}
| | |
| | |
V V V
round5 ( 0.7 * 1.0 * 0.5 ) = 0.35000
With same configuration database, the variant list
{"paper.1" 0.9 {type text/html} {language en}},
{"paper.2" 0.7 {type text/html} {language fr}},
{"paper.3" 1.0 {type application/postscript} {language en}}
would yield the following computations:
=28= |