The Virtual Language of the Tower Model
The language for defining virtual structures is based upon an observation
in relational databases:
while relational query languages cannot express all desirable
programs and hence have to be augmented by
high-level programming languages, they can be used
for expressing many programs, especially by less experienced users.
Moreover, they permit the specification of these programs
at the conceptual level
of the data model (i.e. in terms of relations) instead of at the
lower level of an actual programming language.
Additionally, such limited languages are efficiently
implementable, and their optimization problem is tractable
in contrast to general programming languages.
Accordingly, the tower model comes with a limited language
for the definition of virtual structures in our data model.
The language does not define all virtual structures needed,
but it can be used to define some of them:
specifically, at the level of views within a city.
The virtual structure definition language is an FP-like language
made of two layers corresponding to the layering of
structures into constructors and objects.
The first layer is a small set of functional forms that are higher-order
operators (functions), constructing new functions (operators) from given ones.
They abstract useful patterns for manipulating the
modeling constructs of the Tower Model.
These operators are generic, meaning that they are applicable to
all instantiations of a modeling construct.
For example, the filter operator selects
elements of a composite object according to a predicate, irrespective
of the actual composite object constructor used to build the object.
A second layer consists of
operators specific to particular types of structures; e.g. set-theoretic
operators for set composite objects.
The first three generic operators are applicable
to the values of the objects built by means of our three modeling
constructs: composite objects, towers, and cities.
These operators are
defined in terms of manipulating elements of the values of these objects.
These elements are the components of a composite object, the levels of a
tower, and the views in a city, respectively.
-
Apply-to-All: Transforms all values of elements of an object's
value by applying a function to each of them.
Such a function is a method defined for the type of the elements.
If C(o1, o2,...)
is an object built from elements
o1, o2,... by a constructor C then the apply-to-all
of a function f to the object is C(f(o1),
f(o2),...).
-
Filter: Select a subset of the values of the elements from an object
according to a predicate.
Such a predicate is a boolean method for the type of the elements.
If C(o1, o2,...) is an object built from elements
o1, o2,... by a constructor C then filtering the
object by means of predicate p gives C(< oi :
oi satisfies predicate p >).
-
Enumeration: Construct an object using construct C for an
enumerated list of functions generating its elements.
These functions may optionally have parameters (and all get the same
arguments). Thus an enumeration for construct C and parameter o
looks like C(f1(o), f2(o),...).
The fourth operation can only be applied to composite objects:
-
Abstraction: Partition the elements of a composite according to
a function.
Each such partition contains those elements that yield the
same value for the function,
and is abstracted into a new composite object.
If f is a function that defines a partition
S1, S2,... on o1, o2,...
and C and C' are constructs, then the abstraction of
C(o1, o2,...) according to f and C' is
C(C'(S1), C'(S2),...).
These operators are illustrated by an
example with apply-to-all and abstraction
and an example with a filter.