* 仕様書

[REFS[
- [6] [CITE@en[RFC 2295 - Transparent Content Negotiation in HTTP]] ([TIME[2014-08-31 19:36:42 +09:00]] 版) <http://tools.ietf.org/html/rfc2295#section-5.5>
- [1] '''[CITE@en[RFC 2295 - Transparent Content Negotiation in HTTP]] ([TIME[2014-08-31 19:36:42 +09:00]] 版) <http://tools.ietf.org/html/rfc2295#section-6.4>'''
]REFS]

* 意味

[4] [CODE(HTTP)@en[[[features]]]] [[異体属性]]は、
[[利用者エージェント]]の[[特徴集合]]における[[特徴タグ]]の存在・不存在が[[異体]]の全体の品質にどう影響するかを指定するものです [SRC[>>1]]。

* 構文

[2] 属性値は、 [CODE(ABNF)[feature-list]] です [SRC[>>6]]。

[3] [CODE(ABNF)@en[feature-list]] は、1つ[[以上]]の要素の[[空白]]区切りの[[リスト]]
([CODE(HTTP)[[[%]]]]) です [SRC[>>1]]。

[FIG(railroad)[
= 要素
= *
== [[OWS]]
== 要素
]FIG]

[5] 要素は、[[特徴述語]]1つか、[[特徴述語]]1つ[[以上]]の[[空白]]区切りの[[リスト]]
([CODE(HTTP)[[[%]]]]) を四角括弧で括ったもののいずれかです。
更にその後に [CODE(HTTP)[[[;]]]] と、省略可能な[[符号]]付きの[[小数]]を
[CODE(HTTP)[[[+]]]] と [CODE(HTTP)[[[-]]]] の順に続けることもできます。 [SRC[>>1]]

[FIG(railroad)[
= |
== [[特徴述語]]
== |
=== =
==== [CODE(HTTP)[[[''['']]]]
==== [[特徴述語]]
==== *
===== [[OWS]]
===== [[特徴述語]]
==== [CODE(HTTP)[[['']'']]]]
= ?
== [CODE(HTTP)[[[;]]]]
== ?
=== [CODE(HTTP)[[[+]]]]
=== [[小数]]
== ?
=== [CODE(HTTP)[[[-]]]]
=== [[小数]]
]FIG]

[7] [[小数]]の構文は明記されていませんが、[[生成規則]]名 [SRC[>>1]] から[[単精度浮動小数点数]]と思われます。仕様書上の例示は通常の表記のものばかりで、[[指数表記]]を使ったものは見られません。

[8] [[符号]] [CODE(HTTP)[[[+]]]] と小数が指定された場合、
[CODE[true-improvement]] が指定された小数値となります。
指定されなかった場合は [CODE[true-improvement]] が 1 となります。 [SRC[>>1]]

[9] [[符号]] [CODE(HTTP)[[[-]]]] と小数が指定された場合、
[CODE[false-degradation]] が指定された小数値となります。
指定されなかった場合は、 [CODE[true-improvement]] が指定されたら 1、
指定されなかったら 0 が [CODE[false-degradation]] となります。 [SRC[>>1]]

;; [12] [[OWS]] を挿入できるのかは不明です。仕様書上の例では構文上明示された箇所以外で[[空白]]を使っていません。

* 処理

[10] [CODE(HTTP)@en[[[features]]]] [[異体属性]]の[[q値]]を計算する際には、
指定された各要素の値を乗じたものと[[利用者エージェント]]はする[SHOULD[べき]]ですし、
[[遠隔異体選択アルゴリズム]]はし[['''なければなりません''']] [SRC[>>1]]。

;; [11] この計算結果は [N[1]] を超えることもあります [SRC[>>1]]。

[13] 各要素の値は、[[特徴述語]]が[[真]]の場合 (複数指定されている場合には最低1つが[[真]]の場合)
には [CODE[true-improvement]]、それ以外の場合には [CODE[false-degradation]]
となります [SRC[>>1]]。

* 歴史

[FIG(quote)[ [14] [[RFC 2295]] (HTTP 透過内容折衝) 5.5 Features

> The features attribute specifies how the presence or absence of
particular feature tags in the user agent affects the overall quality
of the variant.  This attribute is covered in section 6.4.

*RFC 2295 (HTTP 透過内容折衝) 6.4 Features attribute
> The features attribute, for which section 5.1 defines the syntax

-[CODE(ABNF)[ "{" "features" feature-list "}" ]]

> is used in a variant description to specify how the presence or
absence of particular feature tags in the user agent affects the
overall quality of the variant.

>
- [CODE(ABNF)[feature-list = 1%feature-list-element]]
-
[PRE[
       feature-list-element = ( [[fpred]] | [[fpred-bag]] )
                              [ ";" [ "+" true-improvement  ]
                                    [ "-" false-degradation ]
                              ]
]PRE]
-[CODE(ABNF)[ fpred-bag = "[" 1%fpred "]" ]]
-[CODE(ABNF)[true-improvement   =  [[short-float]]]]
-[CODE(ABNF)[false-degradation  =  short-float]]

> Features attributes are used in variant descriptions (section 5).
Variant descriptions can be transmitted in Alternates headers (section 8.3).

> Examples are:
-[SAMP(conneg)[ {features !textonly [blebber !wolx] colordepth=3;+0.7} ]]
-[SAMP(conneg)[ {features !blink;-0.5 background;+1.5 [blebber !wolx];+1.4-0.8} ]]

> The default value for the true-improvement is 1.  The default value
for the false-degradation is 0, or 1 if a true-improvement value is given.

> A user agent SHOULD, and a remote variant selection algorithm MUST
compute the quality degradation factor associated with the features
attribute by multiplying all quality degradation factors of the
elements of the feature-list.  Note that the result can be a factor greater than 1.

[CODE(ABNF)[feature-list]] の要素の品質減衰因子すべてを掛け合わせることによる
[CODE(conneg)[features]] 属性に関連付けられた品質減衰因子の計算を利用者エージェントは行う'''べきです'''し、
[[遠隔変種選択算法]]は計算しなければ'''なりません'''。

> A feature list element yields its true-improvement factor if the
corresponding feature predicate is true, or if at least one element
of the corresponding fpred-bag is true. The element yields its
false-degradation factor otherwise.

特徴目録要素は、対応する[[特徴述語]]が真であるか、
対応する [CODE(ABNF)[fpred-bag]] の少なくても1つが真である場合には
[CODE(ABNF)[true-improvement]] 因子を与えます。
それ以外の時には要素は [CODE(ABNF)[false-degradation]]
因子を与えます。
]FIG]

* メモ