As is always the case with domain-specific languages, there is a
tension between a minimalist syntax (LISP-like, for example) and
a ``kitchen-sink'' syntax. The former has a few simple
primitives whereas the latter has many complex primitives,
one for each anticipated use. The minimalist syntax is easy to
learn but combining the primitives into complex sentences
(queries, in our case) can be cumbersome. The kitchen-sink syntax,
on the other hand, has a steeper learning-curve, but common
sentences (those anticipated by the language designers) are
easier to express.
QL is of ``medium'' complexity:
while it has some kitchen-sink features, there are many data
structures which cannot be expressed directly but have to be
constructed by combining simple primitives. QL primitives
include integers, floats, booleans, lists, tuples, atoms, and
links. Links are (directed and undirected) edges between atoms
that are used to build up linked structures such as graphs and
trees. Special syntax was provided for these structures since we
anticipate that many A
goVista users will be wanting to classify
graph structures and problems on graphs.
Figure 6(a) shows the syntax of QL,
and Figure 6(b) gives some example queries.
In the query in Figure 6(b)
a
pair of integers (1 and 2) is mapped to an integer (3). A
goVista returns the result set
Binary or, Integer add
since 1+2=3 and
.
In the query in
Figure 6(b)
a directed graph is
mapped to a directed graph. Each graph is represented,
by convention, as a pair of a node-list and an edge-list.
The query in Figure 6(b)
asks
A
goVista to classify a particular graph, which turns out to
be a strongly connected directed graph.
Figure 6(b)
,
finally,
shows a query that maps a pair of vectors to a vector:
A([3,7],[5,1,6])==>[5,1,6,3,7]
.