AQL Language Introduction

The ARDI Query Language is a simple concatenative language.

It allows you to write your queries as 'programs' that run to produce the results you need.

For those used to traditional languages, the biggest difference is that the parameters to a function appear before the function.

For example, the ASSET function searches ARDI for assets that match a given piece of text (ie. it searches for a name or ID number).

The correct AQL to find the asset is…

  'Wind Turbine' ASSET

Tokens

A token is a single piece of your query. For example, there were two tokens in the query above

TokensType
'Wind Turbine'CONSTLIST
ASSETFUNCTION

Each token has a type. Normally these will be either functions (commands to be run) or lists.

Whenever a single item that isn't a function appears, it is converted into a list that contains just the one item (ie. a list of constant values with only one item - the string 'Wind Turbine').

The Stack

Each token of your AQL query is added to what is called the STACK. The stack is simply a list of tokens waiting to be processed.

The stack is processed from the left to the right. When a FUNCTION is found, it takes any parameters it needs off the stack and optionally writes tokens back onto the stack when it's done.

For example, the ASSET function takes a single parameter - a CONSTLIST. It then returns a ASSETLIST containing all of the assets it could find that had could be found with a name or properties that matched any one of the values in the parameter.

Multiple Items in a List

If there is more than one item in a list, the system adds the various results together. For example…

  ('Wind Turbine #1','Wind Turbine #2') ASSET

The brackets make AQL copy the two strings into the same CONSTLIST, resulting in…

TokensType
'Wind Turbine #1' + 'Wind Turbine #2'CONSTLIST
ASSETFUNCTION

In this case, ASSET would return a list of two assets - Turbine #1 and Turbine #2.

If you're curious, you can read the Alphabetical List of AQL Functions.

Continue Reading