📄 rfc2533.txt
字号:
'filter' is the predicate body. It may contain references to the
formal parameters, and may also contain references to feature tags
and other values defined in the environment in which the predicate is
invoked. References to formal parameters may appear anywhere where a
reference to a feature tag ('ftag') is permitted by the syntax for '
filter'.
The only specific mechanism defined by this memo for introducing a
named predicate into a feature set definition is the "auxiliary
predicate" described later. Specific negotiating protocols or other
specifications may define other mechanisms.
NOTE: There has been some suggestion of creating a registry for
feature sets as well as individual feature values. Such a
registry might be used to introduce named predicates corresponding
to these feature sets into the environment of a capability
assertion. Further discussion of this idea is beyond the scope of
this memo.
Klyne Standards Track [Page 24]
RFC 2533 A Syntax for Describing Media Feature Sets March 1999
6.1.2 Invoking named predicates
Assuming a named predicate has been introduced into the environment
of some other predicate, it can be invoked by a filter 'ext-pred' of
the form:
ext-pred = fname *param
param = expr
The number of parameters must match the definition of the named
predicate that is invoked.
6.1.3 Auxiliary predicates in a filter
A auxiliary predicate is attached to a filter definition by the
following extension to the "filter" syntax:
filter =/ "(" filtercomp *( ";" parameter ) ")"
"where" 1*( named-pred ) "end"
The named predicates introduced by "named-pred" are visible from the
body of the "filtercomp" of the filter to which they are attached,
but are not visible from each other. They all have access to the
same environment as "filter", plus their own formal parameters.
(Normal scoping rules apply: a formal parameter with the same name as
a value in the environment of "filter" effectively hides the
environment value from the body of the predicate to which it
applies.)
NOTE: Recursive predicates are not permitted. The scoping rules
should ensure this.
6.1.4 Feature matching with named predicates
The preceding procedures can be extended to deal with named
predicates simply by instantiating (i.e. substituting) the predicates
wherever they are invoked, before performing the conversion to
disjunctive normal form. In the absence of recursive predicates,
this procedure is guaranteed to terminate.
When substituting the body of a precdicate at its point of
invocation, instances of formal parameters within the predicate body
must be replaced by the corresponding actual parameter from the point
of invocation.
Klyne Standards Track [Page 25]
RFC 2533 A Syntax for Describing Media Feature Sets March 1999
6.1.5 Example
This example restates that given in section 4.3 using an auxiliary
predicate named 'Res':
(| (& (Pix-x=1024) (Pix-y=768) (Res Res-x Res-y) )
(& (Pix-x=800) (Pix-y=600) (Res Res-x Res-y) );q=0.9
(& (Pix-x=640) (Pix-y=480) (Res Res-x Res-y) );q=0.8 )
where
(Res Res-x Res-y) :-
(| (& (Res-x=150) (Res-y=150) )
(& (Res-x=150) (Res-y=300) )
(& (Res-x=300) (Res-y=300) )
(& (Res-x=300) (Res-y=600) )
(& (Res-x=600) (Res-y=600) ) )
end
Note that the formal parameters of "Res", "Res-x" and "Res-y",
prevent the body of the named predicate from referencing similarly-
named feature values.
6.2 Unit designations
In some exceptional cases, there may be differing conventions for the
units of measurement of a given feature. For example, resolution is
commonly expressed as dots per inch (dpi) or dots per centimetre
(dpcm) in different applications (e.g. printing vs faxing).
In such cases, a unit designator may be appended to a feature value
according to the conventions indicated below (see also [3]). These
considerations apply only to features with numeric values.
Every feature tag has a standard unit of measurement. Any expression
of a feature value that uses this unit is given without a unit
designation -- this is the normal case. When the feature value is
expressed in some other unit, a unit designator is appended to the
numeric feature value.
The registration of a feature tag indicates the standard unit of
measurement for a feature, and also any alternate units and
corresponding unit designators that may be used, according to RFC
2506 [3].
Thus, if the standard unit of measure for resolution is 'dpcm', then
the feature predicate '(res=200)' would be used to indicate a
resolution of 200 dots-per-centimetre, and '(res=72dpi)' might be
used to indicate 72 dots-per-inch.
Klyne Standards Track [Page 26]
RFC 2533 A Syntax for Describing Media Feature Sets March 1999
Unit designators are accommodated by the following extension to the
feature predicate syntax:
fvalue =/ number *WSP token
When performing feature set matching, feature comparisons with and
without unit designators, or feature comparisons with different unit
designators, are treated as if they were different features. Thus,
the feature predicate '(res=200)' would not, in general, fail to
match with the predicate '(res=200dpi)'.
NOTE: A protocol processor with specific knowledge of the feature
and units concerned might recognize the relationship between the
feature predicates in the above example, and fail to match these
predicates.
This appears to be a natural behaviour in this simple example, but
can cause additional complexity in more general cases.
Accordingly, this is not considered to be required or normal
behaviour. It is presumed that an application concerned will
ensure consistent feature processing by adopting a consistent unit
for any given feature.
6.3 Unknown feature value data types
This memo has dealt with feature values that have well-understood
comparison properties: numbers, with equality, less-than, greater-
than relationships, and other values with equality relationships
only.
Some feature values may have comparison operations that are not
covered by this framework. For example, strings containing multi-
part version numbers: "x.y.z". Such feature comparisons are not
covered by this memo.
Specific applications may recognize and process feature tags that are
associated with such values. Future work may define ways to
introduce new feature value data types in a way that allows them to
be used by applications that do not contain built-in knowledge of
their properties.
7. Examples and additional comments
7.1 Worked example
This example considers sending a document to a high-end black-and-
white fax system with the following receiver capabilities:
Klyne Standards Track [Page 27]
RFC 2533 A Syntax for Describing Media Feature Sets March 1999
(& (dpi=[200,300])
(grey=2) (color=0)
(image-coding=[MH,MR]) )
Turning to the document itself, assume it is available to the sender
in three possible formats, A4 high resolution, B4 low resolution and
A4 high resolution colour, described by:
(& (dpi=300)
(grey=2)
(image-coding=MR) )
(& (dpi=200)
(grey=2)
(image-coding=[MH,MMR]) )
(& (dpi=300) (dpi-xyratio=1)
(color<=256)
(image-coding=JPEG) )
These three image formats can be combined into a composite capability
statement by a logical-OR operation (to describe format-1 OR format-2
OR format-3):
(| (& (dpi=300)
(grey=2)
(image-coding=MR) )
(& (dpi=200)
(grey=2)
(image-coding=[MH,MMR]) )
(& (dpi=300)
(color<=256)
(image-coding=JPEG) ) )
The composite document description can be matched with the receiver
capability description by combining the capability descriptions with
a logical AND operation:
(& (& (dpi=[200,300])
(grey=2) (color=0)
(image-coding=[MH,MR]) )
(| (& (dpi=300)
(grey=2)
(image-coding=MR) )
(& (dpi=200)
(grey=2)
(image-coding=[MH,MMR]) )
(& (dpi=300)
Klyne Standards Track [Page 28]
RFC 2533 A Syntax for Describing Media Feature Sets March 1999
(color<=256)
(image-coding=JPEG) ) ) )
--> Expand value-set notation:
(& (& (| (dpi=200) (dpi=300) )
(grey=2) (color=0)
(| (image-coding=MH) (image-coding=MR) ) )
(| (& (dpi=300)
(grey=2)
(image-coding=MR) )
(& (dpi=200)
(grey=2)
(| (image-coding=MH) (image-coding=MMR) ) )
(& (dpi=300)
(color<=256)
(image-coding=JPEG) ) ) )
--> Flatten nested '(&...)':
(& (| (dpi=200) (dpi=300) )
(grey=2) (color=0)
(| (image-coding=MH) (image-coding=MR) )
(| (& (dpi=300)
(grey=2)
(image-coding=MR) )
(& (dpi=200)
(grey=2)
(| (image-coding=MH) (image-coding=MMR) ) )
(& (dpi=300)
(color<=256)
(image-coding=JPEG) ) ) )
--> (distribute '(&...)' over inner '(|...)'):
(& (| (dpi=200) (dpi=300) )
(grey=2) (color=0)
(| (image-coding=MH) (image-coding=MR) )
(| (& (dpi=300) (grey=2) (image-coding=MR) )
(& (dpi=200) (grey=2) (image-coding=MH) )
(& (dpi=200) (grey=2) (image-coding=MMR) )
(& (dpi=300) (color<=256) (image-coding=JPEG) ) ) )
--> continue to distribute '(&...)' over '(|...)', and flattening
nested '(&...)' and '(|...)' ...:
(| (& (dpi=200) (grey=2) (color=0) (image-coding=MH)
(| (& (dpi=300) (grey=2) (image-coding=MR) )
Klyne Standards Track [Page 29]
RFC 2533 A Syntax for Describing Media Feature Sets March 1999
(& (dpi=200) (grey=2) (image-coding=MH) )
(& (dpi=200) (grey=2) (image-coding=MMR) )
(& (dpi=300) (color<=256) (image-coding=JPEG) ) ) )
(& (dpi=200) (grey=2) (color=0) (image-coding=MR)
(| (& (dpi=300) (grey=2) (image-coding=MR) )
(& (dpi=200) (grey=2) (image-coding=MH) )
(& (dpi=200) (grey=2) (image-coding=MMR) )
(& (dpi=300) (color<=256) (image-coding=JPEG) ) ) )
(& (dpi=300) (grey=2) (color=0) (image-coding=MH)
(| (& (dpi=300) (grey=2) (image-coding=MR) )
(& (dpi=200) (grey=2) (image-coding=MH) )
(& (dpi=200) (grey=2) (image-coding=MMR) )
(& (dpi=300) (color<=256) (image-coding=JPEG) ) ) )
(& (dpi=300) (grey=2) (color=0) (image-coding=MR)
(| (& (dpi=300) (grey=2) (image-coding=MR) )
(& (dpi=200) (grey=2) (image-coding=MH) )
(& (dpi=200) (grey=2) (image-coding=MMR) )
(& (dpi=300) (color<=256) (image-coding=JPEG) ) ) ) )
--> ... until normal form is achieved:
(| (& (dpi=200) (grey=2) (color=0) (image-coding=MH)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -