Child pages
  • Appendix C: Understanding the Publisher Rules XML Schema
Skip to end of metadata
Go to start of metadata


The full syntax for the Publisher filter rules is presented in simplified RELAX-NG Compact Syntax. The Content Router Publisher ships with a Document Type Definition (DTD) that shows the equivalent syntax: /etc/caringo/contentrouter/war-rules.dtd.

Below is the list of Publisher filter rules.

start = RuleSet
RuleSet = element rule-set {
Publish+
}

Publish = element publish {
Select+
}

Select = element select {
(Or|Filter|Exists|Not-Exists)*,
attribute name { text }
}

Or = element or {
(Filter|Exists|Not-Exists)+,
}

Filter = element filter {
(HeaderAttr|LifepointAttr),
# filter expression, using olderThan(), matches() etc.
text
}

Exists = element exists {
(HeaderAttr|LifepointAttr)
}

Not-Exists = element not-exists {
(HeaderAttr|LifepointAttr)
}

HeaderAttr = attribute header { text }

LifepointAttr = attribute lifepoint { text }

Exists and Not-Exists are tests to check if the header is present or not. An empty header will match an exists query.

Filter expressions are built using a small set of functions. The set of functions available to a filter include:

  • matches(regexstr, case-sensitive) or contains(regexstr, case-sensitive). Matches any part of the header value to a given regular expression (case-sensitive is an optional Boolean parameter, with a default value of True).
  • olderThan(dateSpec). Matches if the header value is a date and the date is older than the given date, which can be an absolute date or a relative (to execution time) date.

If the olderThan comparison fails at one point in time, the object is scheduled to be re-evaluated later. This means that as long as a object eventually matches a channel, it will then be returned for that channel. Content Router uses the Full Date Section 3.3.1 of the HTTP/1.1 specification. This means that the time must be specified in Greenwich Mean Time (GMT).

  • intValue(). Matches if the header value is an integer and executes the specified comparison against that integer (greater than, less than, equal to, and so on). For some examples, see Complex Content Metadata Analysis.

Typical Boolean and grouping operators are also available, so it is possible to easily construct more sophisticated filters. For example, the following syntax translates to "between one and two years old or on Mondays":

(olderThan('365d') and not olderThan('730d')) or matches('^Mon\s.*')

  • No labels