A scope is a query context in which execution is isolated from all other contexts. A scope can also have special text format attributes. A single query can transition between scopes to allow a dynamic response to context-sensitive data. Scope features are:
- By default, a query is executed in the Global scope, but an optional query parameter allows a different scope to be specified.
- Scope can be specified in an identifier name by using a two part name, with the scope name first - eg. "german.pallete" for an axiom source that provides German colors in a scope named "german".
- A scope can also be assigned it's own default locale for international formatting of currency, numbers etc. The locale can be defined according to language, region, variant and script.
- A special type of term list called a local which is backed by an axiom specific to current scope - useful for word translation (see details opposite).
Format
A scope declaration has format:
scope name [ ( properties ) ]
{
eXPL-statements
}
A scope has a name and encloses statements in braces {}. Optional properties are specified as a comma-delimited list of key=value pairs. Keys are reserved for specifying the scope locale: "language", "region" and "variant" eg. (language="de", region="DE") specifies the Germany locale.
Scope Term List
All properties assigned to a scope are available in a term list named "scope". From the previous example, scope[language]
returns "de". A property value can be text, a number, a boolean ("true"/"false") or reserved word "unknown".
Formatted Numbers
Numbers can be presented in a format suited to the locale of the current scope when enclosed in braces. For example a German formatted number for 1,234,567.89 would be {1.234.567,89}. Note that in an English language locale, {1,234,567} can be used to represent 1234567, which helps with readability.
