Resource Directory for the Z39.86-2010 Authoring and Interchange
Content Selection Feature
version 0.2

Table of Contents

This is an early access version, made available for early testing and evaluation.

Introduction

The Content Selection feature provides a mechanism with which publishers can define alternate renditions of content fragments, and a mechanism for defining conditional expressions that allows runtime selection of these renditions.

One core use-case for this feature is to vary the information set of output documents, based on criteria such as output content type, or target consumer group. As examples,

In the Z39.86 Authoring and Interchange context, the feature may also be used to provide feature fallbacks. While a publisher would normally be in a situation where the feature support in used Processing Agents is known, this is not always the case, especially in a content interchange scenario. As an example, not knowing whether a processing chain has full support for the MathML feature, a publisher may choose to use the Content Selection feature to provide a fallback for MathML content.

The Content Selection feature employs a conditional switch mechanism, represented by 1-n when elements appearing as children to the parent select element. There is an always-present default choice within the switch, represented by the otherwise element.

This feature is maintained by the ANSI/NISO Z39.86 advisory committee under the auspices of NISO.

Normative References

Definition of terms

Conditional expression

An expression used at runtime to test whether a content segment should be selected or not. The expression appears as the value of the expr attribute on the when element. A conditional expression is syntactically a combination of one or more functions, and zero or more operators. The result of the evaluation of a conditional expression must always be a boolean.

The syntax of a conditional expression is normatively defined in EBNF Definition of the Conditional Expression.

Function

A function is the core component of a conditional expression. The return value of a function must always be boolean. A function can take zero or more arguments.

A function must not take another function as an argument, with the exception of the not() function, which always takes another function as its argument.

The literal reference to a function always uses a prefix. This prefix defines which function set the function belongs to.

Logical Operators

The operators and and or are used when referencing more than one function in a conditional expression. These operators have the following meaning:

  • and: the value of a conditional expression is true if, and only if, all functions in the expression evaluate to true.
  • or: the value of a conditional expression is true if, and only if, at least one of the functions in the expression evaluates to true.

The and and or operators must not occur simultaneously in the same conditional expression. There is no limitation on the number of functions to be connected through logical operators.

This feature also defines the function not(), with one, and only one, argument, which must be another function. The purpose of this function is to return the value false if the argument function evaluates to true, and vice versa. Note that, contrary to all other functions, the not() function must not be prefixed.

Function Set

A Function Set is a collection of 1-n functions. The set is defined by a canonical URI, where human-readable prose is available defining the name and nature of each function included in the set.

When a function is used in a conditional expression, is uses a name prefix as a token for that URI.

The Content Selection feature provides a set of predefined function sets. Additional function sets may be defined.

General document model requirements

The namespace of all members of the Content Selection feature element set is http://www.daisy.org/z3986/2010/auth/features/select/#.

The otherwise element must not contain descendants in the http://www.daisy.org/z3986/2010/auth/features/select/# namespace.

Declaration of function set prefix-URI mappings

The prefix of each function set that is used in a document instance must be declared in the document instance head using meta elements with the prefix property of the Resource Directory Vocabulary.

The declared prefix must resolve to a URI which must contain a human-readable document where the processing behavior of included functions are defined. This URI serves as the canonical identifier of the function set.

In the example below, a target prefix is bound to the URI http://www.daisy.org/z3986/2010/auth/features/select/functionSets/#targetFunctionSet:

      <head xmlns:res="http://www.daisy.org/z3986/2010/vocab/resourcedirectory/#">
      	<meta about="http://www.daisy.org/z3986/2010/auth/features/select/functionSets/#targetFunctionSet" 
      		property="res:prefix" content="target" />
      </head>
      

Note that function set prefixes, such as target in the example above, are static throughout the document scope.

[Validity constraint] Several prefixes for the same function set URI must not be declared within the document scope.

[Validity constraint] With the exception of the not() function, which is unique in that it takes no prefix, all functions in Conditional Expressions must be literally referenced using prefixes, and these prefixes must be bound to a URI using the mechanism defined above.

Note - the prefix declaration mechanism for function sets is subject to change, since changes to the prefix decl mechanism for CURIEs is currently being investigated.

EBNF Definition of the Conditional Expression

        Conditional Expression := function, (operator, function)*
        function := ('not','(' .*')') | (qname, ('()' | '(' .*')'))
        operator := 'and' | 'or'
        qname := prefix ':' localname
        prefix := ncname
        localname := ncname
        ncname := [A-Za-z][A-Za-z0-9_]*
      

Predefined Function Sets

A set of predefined Function Sets are available. These Function Sets do not differ behaviorally from externally defined function sets in terms of processing requirements.

Defining Additional Function Sets

TODO describe process

Processing Agent Processing Requirements

Processing the select element

From a document information set perspective, the result of the processing of a select element is that the select element is replaced by the content of exactly one of the select element's when or otherwise children.

Processing Agents must process select elements in the following way:

  1. Evaluate the conditional expressions of each when child, starting with the first when child in document order.
  2. If the evaluation of the conditional expression on the current when element results in true, select the content of the current when element, and return.
  3. If the evaluation of the conditional expression on the current when element results in false, continue processing the next sibling in document order (which is a when or otherwise element).
  4. If the conditional expression uses a function from an unrecognized or unsupported function set or an unrecognized parameter, continue processing the next sibling in document order (which is a when or otherwise element). Processing Agents should issue a warning when encountering unrecognized or unsupported functions or parameters.
  5. If none of the when tests evaluate to true, select the content of the otherwise child, and return.

TODO fix the above to reflect nested when's

Note that the mechanism for supply of runtime parameters to test the conditional expressions against is implementation dependant.

Processing Conditional Expressions

Processing Agents must process conditional expressions (the value of the expr attribute on the when element) in the following way:

  • TODO Per
  • TODO note that if undefined function prefix, static error

Identity URI

The canonical identity URI of this version of this feature is http://www.daisy.org/z3986/2010/auth/features/select/0.2/.

Specification Compliance

This feature is compliant with the Z3986-2010 Part A Specification.

Normative schemata

The normative schema of this feature is z3986-feature-select.rng.

Note - this feature schema does not represent an entire document model; it is intended for inclusion in host profiles.

The normative schema includes a number of modules and/or subschemas, which are listed in Appendix 1.

The latest version of the normative schema is available at the canonical URI http://www.daisy.org/z3986/2010/schema/mod/z3986-feature-select.rng.

A listing of all public versions of this feature is available.

Informative References

Supporting software

This section will contain references to transformation, validation etc software, once provisioning schemes are in place.

Appendix 1: Listing of modules in the normative schema

Note: the canonical base URI of these modules is http://www.daisy.org/z3986/2010/schema/mod/ , where the modules are available in their latest version.

The below list represents the modules at the time of version 0.2 of this feature.