AUCQL has several useful syntactic shortcuts that can be utilized to significantly reduce verbose queries. In this section, we first give a simple query and then show how to use AUCQL's defaults to significantly shorten the query.
A verbose queryFirst, let's look at a very verbose query. Below is a query to find the names of movie stars.
Default MATCHsA regular expression that appears alone in a FROM clause, by default, is assumed to be the regular expression in a MATCH(ROOTS, ...) operation. For instance, the query given above can be shortened by using the default MATCH operation as follows. (Note that the second MATCH cannot be removed since it is from Movie rather than ROOTS.)
Variables can start regular expressionsNow let's remove that second MATCH! If a variable starts a regular expression, an implicit MATCH that extends the paths represented by the variable is assumed.
Required NAME propertiesSince searching on required NAMEs will be common, property lists that are just a single word are assumed to be a required NAME property with that word. So the above query can be rewritten, more concisely, as follows.
Note that the variable namespace is not distinct from the NAME property valuespace, which can be a potential source of confusion!
An expression in a SELECT or WHERE clauseAn implicit variable assignment is generated for expressions that appear in the SELECT or WHERE clause. So the above query can be rewritten, more concisely, as follows.
The even shorter query
SELECT movie, movie.stars.name;is a perfectly legal query, but determines all the combinations of movies and movie.stars.names in the database, rather than associating a star.name with a particular movie. So it has a very different meaning than the previous queries.
SETting DEFAULT PROPERTYsOften it is useful to establish default properties for all the descriptors in a query. Setting the security certificates owned by the user, or setting the transaction time to now are common defaults. Defaults can be set using the following syntax.
SET DEFAULT PROPERTY property listBelow is a query to set the default transaction time.
Another common default is to set all the security certificates available to the user. (Note, in general the certificate is an encrypted string.)
Curtis E. Dyreson, Michael H. Böhlen, and Christian S. Jensen © 1998-2000. All rights reserved.
|E-mail questions or comments to Curtis.Dyreson at usu.edu|