6.2.1
-- The domain declaration: Domains generally correspond to programs
(such as a relational database management system) or a sets of related
functions (such as math functions). The declaration consists of the reserved
word domain followed by arguments for name and a domain description as
seen in Fig. 6-3.
6.2.2
-- The type declaration: Hermes provides global type declarations
to simplify and clarify the use of data types in the domain catalog and
mediators. The domain catalog can contain type declarations used by domain
functions. A type can be declared anywhere in the domain catalog, but it
must be declared before it is used either in a domain function declaration
or in another type declaration. All types declared in the domain catalog
are available to a mediator.
6.2.3
-- The domain function declaration: Hermes domains can include
any number of domain functions. The function-name and descriptor-string
tokens are self-explanatory. The term-types token, if any, represents
the domain function input parameter names and types (See section
5.3 for syntax). Finally, the function-type token declares the
defined function return type.
Executing the math domain count function, as defined in Fig. 6-7, with
parameters (0, 10, 2) will cause Hermes to return the array
[0 2 4 6 8 10].
user
to input multiple search paths (with standard wild-card characters). Thus,
the query (see Fig. 6-8) searches two source directories and returns an
array of file names which match the search string, but are found in either
source directory (Fig. 6-9).
6.2.5
-- Domain function number type: The number type can only be used to
declare domain function input and output types.
Using number input and output types, the math:add function, noted
in Fig. 6-10, above can be used with any combination of constants, variables
and functions evaluating to integers or reals. The first function call
(see Fig. 6-11) returns an integer; the remaining four return real values.
would
render the string "Printing messages is as easy as 1 2 3!" to
system standard output. Note, Hermes also defines a file:format
function which prints Hermes format characters along with the values.
Some domain functions, such as file:print defined in the example
code, accept all Hermes data types for the any input type. Other
domain functions, such as ingres:select, require that the any
input type correspond to another input type. Hermes is not able
to check these relationships between domain function input types, so the
domain interface is responsible for checking the types at run time and
returning an error message if a mismatch occurs. In the ingres:select
function, listed in Fig. 6-14, the constant type specified by Value input
must match the field type specified by Field input. Hermes will
accept function calls such as those in Fig. 6-15 as it can not know that
the entries "widget3",
or
3, must correspond to the table field type referenced by the name string
"part". The ingres interface will return an error message,
however, if the Value type does not match the Field type.
The Hermes domain, listed in Fig. 6-17, can process nested arrays,
records and sets. In each case, the domain function returns a data set
of the same types as the input database.
Some databases, such as the text domain in
Fig. 6-21, return a fixed data type -- In this case there is no need for
the data function or declaration.