Chapter 5: Hermes Types, Variables and Constants.
-
5.1 -- Introduction: Hermes supports both simple
and complex data types, which gives it the power to communicate with and
between a wide range of external software and data. This chapter presents
the formal syntax, and some examples, for the Hermes data types
and constants. Hermes is a strongly typed language -- all data types
used by a mediator are known and checked when the mediator is read into
memory. For clarity, types in Hermes are always names. Because Hermes
supports nested combinations of arrays, records and sets, as well as various
boolean, numeric and character types, there is both flexibility and precision
in using various data types. Hermes can process data structures
in memory using the in literal
and subscript operator '[]' for arrays, the field operator '.'
for records, and the in
literal for sets. Large data structures are stored in files.
-
5.2 -- Hermes character set: Hermes syntax
supports a typical character set comprised of letters, digits, punctuation
and spaces (see Fig. 5-1).
-
5.3 -- Hermes data/term types: For defining
data types in Hermes, arrays are indicated with brackets '[]',
records are indicated with angle brackets '<>' and sets are
indicated with braces '{}'. Type any can only be used to declare
domain function input types, and is discussed in more detail in section
6.2.6. Type number can only be used to declare domain function input
and output types, and is also discussed in more detail in section
6.2.5.
For example, the Radius declaration in 5-3 defines an integer
type named Radius. Likewise, Images defines a set of image
files. Showing an increased complexity, Part describes
a factory part data record comprised of six attribute fields, five string
fields (Name, Color, Temperature, Weight, and Currency) and the real Cost
field. Finally, to demonstrate some simple data nesting, the Route
declaration describes a data structure used to store a hypothetical terrain
traversal route. It includes the fields RouteCost, a real number
representing route length and difficulty, RouteLength, an integer
noting the number of route points saved, RoutePoints, actually
an array of position point records comprised of integer X and Y coordinates,
and RouteScript, the file path of a system shell script which
the user may call to display the route information.
In general, the name of a type is meaningful only
to the user, and is not used by Hermes in processing. The exception
is field names for records. Two record types are equal if and only if their
field names and types are equal and in the same sequence. For example,
Point/<x/integer, Y/integer> and Point/<Y/integer, X/integer>
are two different types.

-
5.4 -- Hermes variables: Hermes
uses variables for type names, term names, and of course just as variables.
A variable is any sequence of letters, digits and underscores beginning
with an upper-case letter. For example: Data, PartName, Time2.
-
5.5
-- Hermes constants: Hermes constants include logical,
numeric, character, array, record and set constants. Logical constants
include booleans. Numeric constants include integers and reals. Character
constants include names, files and strings, which are surrounded by 0,
1, or 2 quotes, respectively. When character constants are compared for
equality, the comparison is not case sensitive. For example, = ('CASE",
"case") evaluates to true. Arrays, records and sets can be arbitrarily
nested.

-
5.6 -- Hermes boolean values: Hermes represents
booleans simply as true or false values.

-
5.7 -- Hermes integer values: The range
of an Hermes integer is the range of a C long on the given machine.
Sample integers: 2, -2.
-
5.8 -- Hermes real values: The range of
a real number is the range of a C double on the given machine. Sample reals:
2, 2.0, -2.0, 2.0E+2, 2.0e-2.
-
5.9
-- Hermes name values: A name is any sequence of letters, digits
and underscores beginning with a lower-case letter. Names are used for
keywords, domain names, functionnames, predicate names, and name constants.
For example: select, query1, minimumCost, supplier_part.
-
5.10 -- Hermes keywords: Hermes
reserves a small set of predefined keywords for use within its' domain
and mediator files; Keyword meanings are explained in the appropriate sections.
-
5.11
-- Hermes file names: Hermes uses single quotes to enclose
file names such as 'parts.rel'. By including an '@' character
followed by a host-machine name, as in 'parts.rel@tanagra.cs.umd.edu',
or the URL style double-slash '//' followed a host-machine name , as in '//tanagra.cs.umd.edu/parts.rel',
a Hermes file name can address data from specific, perhaps remote,
host machines. Additionally, use of embedded spaces, which the search engine
removes during parsing, further eases Hermes rule writing as lengthy
file names may span several lines (see Fig. 5-12). NOTE: In cases where
the search engine runs on the same named host machine, Hermes will
automatically shorten the file name to that of the local path. That is
to say that, should we process the Fig. 5-12 rule from a Hermes
search engine running on the spectrum.eg.bucknell.edu host, then
Hermes would modify the rule to read as that in Fig. 5-13.
-
5.12
-- Hermes strings consist of any keyboard character sequence
-- letters, digits, punctuation and spaces -- inclosed by double quotes.
Two double quotes together, within a string, form an embedded double quote
as in "the animal ""Zebra"" will appear quoted within the rendered
string".
Hermes allows strings to span lines (via embedded white spaces) for
rule writing clarity; The search engine converts these multi-space (white
space) gaps to single spaces during parsing -- The string in Fig. 5-15,
for instance, will read "Find the temperature of a part, resolving qualitative
and quantitative measures." after parsing.
NOTE: The current maximum length of a Hermes string is about
4000 characters. Users can the maximum length by redefining the MAXLEXEME
macro located in the util/symbol2.c file, and then recompiling the Hermes
search engine(s).
-
5.13 -- Hermes arrays consist of ordered
lists of like type elements enclosed by left and right brackets '[]'--
Empty brackets represent an empty array. Fig. 5-17 shows two potential
route point arrays.

-
5.14 -- Hermes records consist of ordered
and named lists of (varied type) data fields enclosed by left and right
angle brackets '<>'. Field names are usually given separately
in a mediator data declaration.
-
5.15
-- Hermes sets consist of unordered like type elements lists
surrounded by left and right braces '{}' -- Empty braces represent
an empty set. Hermes commonly uses its set notation to represent
unordered lists of data records such as those found in relational or object-oriented
databases. Fig. 5-21 lists several database record sets; the last of which
illustrates a hypothetical parts database in which each record contains
a part name, quantity, color, and list of sub-parts.
Although unordered by definition, Hermes may
actually sort set elements during certain operations (such as union). Hermes
does not enforce the uniqueness of set elements; rather, such properties
are left to underlying domain functions.
Web Accessibility