[ Top ] [ Previous Section ] [ Next Section ]

HERMES:
A Heterogeneous Reasoning and Mediator System

2.3. The Mediator Compiler

In order for HERMES to execute queries expressed in the mediator language described in Section 2.2, several auxiliary facilities are necessary. The first is a catalog used to maintain information, including argument types, about the predefined functions in the domains that have been integrated. The second is a standard format used by the mediator compiler to convert data returned by domain functions into ``internal'' formats.

2.3.1. The Domain Catalog

The catalog contains information about the functions that make up the interface to a domain. This information is used to facilitate compilation, and to give indications on how output from domain function calls should be interpreted. As an example, suppose a mediator accesses the SPATIAL database package. The catalog for the SPATIAL database package is shown in Figure 2.

domain quadtree "SPATIAL"
    /* Variable Data */

function all "All Points"
input    quadtree:file

function range "Range"
input    quadtree:file x:integer y:integer radius:integer
output   x1: integer  y1:integer

function vertical "Vertical Slice"
input    quadtree:file left:integer right:integer
output   x1: integer  y1:integer

function horizontal "Horizontal Slice"
input    quadtree:file lower:integer upper:integer
output   x1: integer  y1:integer

function point_data "Point Data"
input    quadtree:file x:integer y:integer
output   value: void

function less "Less Than"
input    quadtree:file field:name value:void
output   x1:integer y1:integer

function less_equal "Less Than or Equal"
input    quadtree:file field:name value:void
output   x1:integer y1:integer

function equal "Equal"
input    quadtree:file field:name value:void
output   value1: boolean

function not_equal "Not Equal"
input    quadtree:file field:name value:void
output   x1:integer y1:integer

function great_equal "Greater Than or Equal"
input    quadtree:file field:name value:void
output   x1:integer y1:integer

function great "Greater Than"
input    quadtree:file field:name value:void
output   x1:integer y1:integer

Figure 2. A Catalog for SPATIAL

The catalog specifies information concerning 10 functions that collectively make up the interface of the SPATIAL database to the external world. The first line in each function entry defines the name of the function. The second line enumerates the arguments and their associated types. The final line indicates the output type.

For example, the entry

function range "Range"
input    quadtree:file x:integer y:integer radius:integer
output   x1: integer  y1:integer

specifies a function called range, whose input consists of three arguments: a file and two integers, and whose output is a set of pairs of integers. For technical reasons, boolean functions such as less will either return a point (x1,y1) to indicate true, or it returns a null represented by the distinguished pair (*,*).

2.3.2. The Standard Data Format

At run-time, when a domain function f is called, the solution returned will adhere to the output format associated with the function f in the domain catalog. However, in order for the mediator to access the data uniformly across domains, some simple and consistent internal data format needs to be maintained. This data format should be sufficiently general to represent a variety of external data formats -- a non-trivial task. We do not purport to provide an all-encompassing solution. However, the approach described below appears to work well in most cases.

A special data structure is associated with each domain, function pair d,f. This data structure, denoted d-f is a record type whose field names and types are identical to those in the output field of f's output format described in the catalog. Returning to the SPATIAL domain and the function range defined therein.

function range "Range"
input    quadtree:file x:integer y:integer radius:integer
output   x1: integer  y1:integer

This internal data structure d-f corresponding to the domain-function pair (spatial, range) is:

type spatial:range = record of x1 : integer; y1 : integer end

Had one of the field types been a complex type, then the corresponding complex type would have to be included in the internal data structure. For instance, if the output of range is of type point where point is a user-defined record having two fields x and y, each of type integer, then the data structure defined in the internal format would appear as

type spatial:range = record of
     p : point
     end;

These declarations, one for each function in the domain being integrated, will be placed in a file called the output-format file, which can be automatically generated by examining the domain catalogs. The compiler will subsequently generate variable declarations to correspond to each of the types defined above.

2.3.3. Internal Facts

The mediator compiler keeps track of a number of internal facts whose values serve different purposes. For example, there is an internal clock used to keep track of the current time (year, month, day, hour, sec, millisec). The value of the clock will maintain temporal data on the creation of various data sources. When a new data source is integrated into a mediated system, the mediator compiler stores the time at which this is done. This information will facilitate conflict resolution strategies, described later in Section 2.4.2. The time is then stored through a special predicate called data. For instance, the fact

declares part.2 to be a Paradox relation having the specified schema, and was created at time Time. The number 0.8 is a criticality value that specifies that this data is believed to be correct with 80\% certainty.

[ Top ] [ Previous Section ] [ Next Section ]


Click here to go back to the Hermes homepage .

Web Accessibility