AUCQL logo
 
Using AUCQL's Syntactic Sugar
A Query Language for Semistructured Data with Metadata Properties
Home        
Publications   
Prototype  
Examples    
  The DB
  Start       
  Defaults
  Match
  Property
  Collapse
  Coalesce
  Security
  Time
 
Curtis Dyreson
  Home
  Publications
  Projects
  Software
  Demos
  Teaching
  Contact me

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 query

First, let's look at a very verbose query. Below is a query to find the names of movie stars.
What are movie star names?:
SELECT Movie, Name
FROM   MATCH(ROOTS, (NAME! movie)) Movie,
       MATCH(Movie, (NAME! stars).(NAME! name)) Name;

The query result is duplicated below.
Movie Name
&Star_Wars_IV Bruce Willis

Default MATCHs

A 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.)
What are movie star names?:
SELECT Movie, Name
FROM   (NAME! movie) Movie,
       MATCH(Movie, (NAME! stars).(NAME! name)) Name;

Variables can start regular expressions

Now 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.
What are movie star names?:
SELECT Movie, Name
FROM   (NAME! movie) Movie,
       Movie.(NAME! stars).(NAME! name) Name;

Required NAME properties

Since 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.
What are movie star names?:
SELECT Movie, Name
FROM movie Movie,
     Movie.stars.name Name;

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 clause

An 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.
What are movie star names?:
SELECT Movie, Movie.stars.name
FROM movie Movie;

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 PROPERTYs

Often 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 list
Below is a query to set the default transaction time.
What are the current nodes?:
SET DEFAULT PROPERTY (TRANSACTION_TIME: [now - now]);
SELECT ()*;

Another common default is to set all the security certificates available to the user. (Note, in general the certificate is an encrypted string.)

What are the nodes that I can access with my security certificates?:
SET DEFAULT PROPERTY (SECURITY: 'paid, subscriber, over 18');
SELECT ()*;


                                                                                                                                                                                                                                     
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 Valid HTML 4.01!