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

This section provides an overview of the Aalborg University College Query Language (AUCQL).

The Importance of Variables

The key to understanding AUCQL is to understand the use of variables. Variables are established in the FROM clause. The FROM clause is essentially just a list of variable assignments. The value assigned to each variable is the result of one of AUCQL's operations: MATCH, NODES, COLLAPSE, SLICE, PROPERTY, or COALESCE.

MATCH

The MATCH operation matches a regular expression to the labels along a path. It is a common semistructured operation, but is typically an implicit operation. Let's start with a simple example that you can edit and/or submit directly to AUCQL's query engine.

Query 1: The following query determines which nodes are reachable from a root via an edge named 'movie'?
SELECT Movie
FROM   MATCH(ROOTS, (NAME: movie)) Movie;

The query result is duplicated below.
Movie
&Star_Wars_IV
There are actually two movie nodes in the database that match the name property. However, there is a required security property on one of those edges (to Color of Night). This prevents the edge from being matched (because the appropriate security was not given in the query, please see the security examples).

Let's extend the query with an appropriate level of security (note that in general, the security property is an encrypted string!).

Query 2: The following query determines which movies are available to someone who is over 18?

SELECT Movie
FROM   MATCH(ROOTS, (NAME: movie, SECURITY: 'over 18')) Movie;

The query result is duplicated below.
Movie
&Star_Wars_IV
&Color_of_Night

Regular expressions

A regular expression is permitted in a MATCH operation. This regular expression is built using the usual rules for regular expressions. The following query uses a Kleene closure (the '*' operator).
Query 3: This query retrieves all the nodes that are reachable to a user who is over 18.

SELECT Movie
FROM   MATCH(ROOTS, (SECURITY: 'over 18')*) Movie;

Default MATCH operation

Because a MATCH(ROOTS, ...) operation is so common, it is the default operation if an operation is not specified. Here is the same query as that listed above.
Query 4: This query retrieves all the nodes that are reachable to a user who is over 18.

SELECT Reachable
FROM   (SECURITY: 'over 18')* Reachable;

Extending the paths from a variable in a MATCH

The MATCH operation can extend a path from a previous reached node. The first argument is the node to from which to start matching. Frequently, this node is specified by the variable ROOTS; ROOTS represents the roots of the semistructure. In general, any previously assigned variable can be used.

Query 5: What are all the nodes that are reachable from a root?

SELECT *
FROM   (SECURITY: 'over 18')* Reachable,
       MATCH(Reachable, (NAME: name)) Name;

There are a lot of null values for the names since few of the nodes have 'name' edges hanging off of them.

Since extending previously matched paths will be common, AUCQL has some useful syntactic sugar. A regular expression of the form

Variable.regExp Xvariable
is interpreted as follows.
MATCH(Variable, regExp) Xvariable
So the query given above can be rewritten more concisely as follows.
Query 6: What are all the nodes that are reachable from a root?

SELECT *
FROM   (SECURITY: 'over 18')* Reachable,
       Reachable.(NAME: name) Name;

Where clause

In the previous example there were many null values. We can eliminate the nulls in the WHERE clause as follows.

Query 7: Which non-null names are reachable from a root?

SELECT *
FROM   (SECURITY: 'over 18')* Reachable,
       Reachable.(NAME: name) Name
WHERE  NONNULL(Name);

Next

Continue with the next example to find out more about AUCQL.
                                                                                                                                                                                                                                     
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!