|
Publishing Framework
Filters
What are Filters?
A filter is a property of a subscriber that enables that subscriber to
receive only that content that meets certain criteria. Filters can
be used to exclude content that the subscriber is not interested in, or that the
subscriber's computing resources cannot handle. Filters can be
defined based on the entry type, MIME type, or one or more name/value pairs that are
defined for the content. A filter can be an include filter, which means that the
subscriber receives all content that meets the filter criteria, or an exclude filter,
which means that the subscriber receives all content that does not meet the
filter criteria.
Notes:
For each type of filter (entry type, MIME type, or name/value pair), you can
define either inclusion or exclusion filters (but not both). If you have previously defined exclusion name/value
filters, for example, and then specify an inclusion filter, then all of the
previously defined exclusion filters are deleted from the repository.
The SAS Information Delivery Portal does not currently support subscription filters.
Entry Filters
Each published package contains one or more entries. Each entry is one of
several possible types. You can create a filter to include or exclude one or
more entry types. Valid entry types include the following:
binary | catalog | dataset |
fdb | html | mddb |
reference | sqlview | nested_package |
text | viewer |
MIME Type Filters
MIME types provide details about the information that is being published. For
example, specifying the
MIME type audio/basic indicates that the file is an audio file
and requires software that
can interpret such content.
You can define a filter that determines the type of
information the subscriber receives. For example, a subscriber who is connecting
with a modem might not want to receive some data types that may be large or
unwieldy, such as movies or audio. By excluding those MIME types, the subscriber
never encounters those types of information.
Some common MIME types include the following:
application/msword | application/octet-stream |
application/pdf | application/postscript |
application/zip | audio/basic |
image/jpeg | image/gif |
image/tiff | model/vrml |
text/html | text/plain |
text/richtext | video/quicktime |
video/mpeg | |
Name/Value Pair Filters
Publishers can specify name/value pairs that describe the package that is
being published. Knowledge of name/value pairs enables you to define filters
for a subscriber that determine the packages that are received. If an inclusion
name/value filter is defined for a subscriber, then the subscriber will receive only
those packages that match the name/value filter.
A name/value pair is expressed as either a name or a relationship
between a name and a value in the form
name < operator value >
- name is a variable to which a value can be assigned. name
is not case-sensitive.
- operator relates the variable to the value. Commonly used
operators are as follows:
Comparison Operators | Logical Operators |
= (equals) | & (AND) |
!= (not equal) | | (OR) |
? (contains) | |
- value is a character string or numeric value. value
is case-sensitive.
Examples:
The following is an example of a package description using name/value pairs that
a publisher has assigned to a published package:
market=(Mexico, US) type=report Quarter4 sales _priority_=low
Knowing the conventions that a publisher uses to describe packages helps
subscribers to write meaningful filters. The following examples illustrate
filter strings that determine whether the preceding example entity would be
selected by the filter. If the package meets the filter conditions, then the
package is delivered to the subscriber.
-
market=(US, Asia, Europe)
- No match. Because the equals comparison operator (=) is used, the
subscriber values and the publisher values that are assigned to the variable
name MARKET must match exactly. In this example, the subscriber filters for
US, Asia, and Europe, whereas the publisher assigns a value of Mexico and US. The conditions for selection are not met. Therefore, the package is not delivered to the subscriber.
market=(mexico, us)
- No match. Because the equals comparison operator (=) is used, the
subscriber values and the publisher values that are assigned to the variable
name MARKET must match exactly. In this example, the subscriber values do
not match the publisher values because of case differences.
market=US | market=Asia | market=Mexico
- No match. Because the equals comparison operator (=) is used, the
subscriber values and the publisher values that are assigned to the variable
name MARKET must match exactly. In this example, although the OR operator
(|) might seem to cause a matching condition, the equals operator (=)
requires that each name/value pair that is separated by an OR operator
(|) match the publisher name/value pair entirely. A match would result if
the subscriber values were written as follows:
market=Mexico, US | market=Asia | market=Mexico
The first name/value pair in the series would match.
market=(Mexico, US)
- Match. Because the equals comparison operator (=) is used, the
subscriber values and the publisher values that are assigned to the variable
name MARKET must match exactly. In this example, the value set does match.
market=(US, Mexico)
- Match. Because the equals comparison operator (=) is used, the
subscriber values and the publisher values that are assigned to the variable
name MARKET must match exactly. In this example, the value set matches,
regardless of the order of values within the value set.
market?US & market?Asia & market?Mexico
- No match. The conditions that are specified in the subscriber
name/value pair read: Variable name MARKET must contain the values US and
Asia and Mexico. The contains comparison operator (?) identifies the
eligible values for consideration. In this example, although the publisher
variable MARKET contains US and Mexico, it does not also contain Asia.
Because the logical AND operator (&) is used, its condition is not
satisfied.
market?US | market?Asia | market?Mexico
- Match. The conditions that are specified in the subscriber name/value
pair read: Variable name MARKET must contain the values US or Asia or Mexico.
The contains comparison operator (?) identifies the eligible values for
consideration. In this example, the publisher variable MARKET contains US, and
the logical OR operator (|) condition is satisfied.
Quarter4=sales
- No match. Because the equals comparison operator (=) is used, the
subscriber values and the publisher values that are assigned to the variable
name QUARTER4 must match exactly. In this example, because the publisher
variable name QUARTER4 does not contain a value and the subscriber variable
name QUARTER4 does contain a value of sales, the value sets do not match.
Quarter4
- Match Variable names are not required to have values. In this
example, because the publisher variable name QUARTER4 does not have an
assigned value and the subscriber variable name QUARTER4 does not have an
assigned value, the value sets match.
type=report & forecast
- No match. Two conditions must be met. The equals comparison operator
(=) requires that the subscriber values and the publisher values that are
assigned to variable name TYPE match. In this example, the first condition
is met because both the publisher and the subscriber assign the value report
to variable TYPE. However, the AND logical operator (&) requires that
the variable name TYPE also be assigned the value forecast. Because the
publisher variable name TYPE is not assigned a value of forecast, the final
condition is not met.
type=report & sales
- Match. Two conditions must be met. The equals comparison operator (=)
requires that the subscriber value and the publisher value that are assigned
to variable name TYPE match. In this example, the values match. Both assign
the value report to the variable name TYPE. The AND logical operator (&)
also requires that the variable name SALES match. Because both the publisher
and the subscriber identify a variable name sales with no assigned value,
the final condition is also met.
|