Loading...
Searching...
No Matches
TaQL_module
tables package (libcasa_tables)

More...

## Topics

| TaQL_module_internal_classes
| Internal TaQL_module classes and functions.

## Classes

class | casacore::TableExprNode
| More...
class | casacore::TableExprNodeSet
| More...
class | casacore::TableExprNodeSetElemSingle
| Class defining a set element containing a single value. More...
class | casacore::TableExprNodeSetElemDiscrete
| Class defining a set element containing a discrete range. More...
class | casacore::TableExprNodeSetElemCont
| Class defining a set element containing a continuous interval. More...
class | casacore::TableExprNodeSetElemMidWidth
| Class defining a set element containing a continuous mid/width interval. More...
class | casacore::TableExprNodeSetElem
| Class to hold the table expression nodes for an element in a set. More...
struct | casacore::MArrayLogical_global_functions_MArray_logical_operations
| More...
struct | casacore::MArrayMath_global_functions_MArray_mathematical_operations
| More...
struct | casacore::MArrayMathBase_global_functions_Array_basic_functions
| More...
struct | casacore::MArrayUtil_global_functions_reorderMArray
| More...
struct | casacore::MArrayUtil_global_functions_reverseMArray
| Reverse the order of one or more axes of an MArray. More...
struct | casacore::RecordExpr_global_functions_RecordExpr
| More...
class | casacore::TableExprData
| More...
class | casacore::TableExprId
| More...
class | casacore::TableExprIdAggr
| More...
class | casacore::UDFBase
| More...

## Detailed Description

TaQL is the query language for Casacore tables

See below for an overview of the classes in this module.

### Intended use:

Public interface

### Review Status

Reviewed By:
  jhorstko
Date Reviewed:
  1994/08/30

### Prerequisite

- Tables module

### Etymology

"TaQL" is the Table Query Language. Its pronounciation rhymes with bagel.

### Synopsis

TaQL is an SQL-like language to query a Casacore table. Amongst its options are row select, sort, update, and delete.
Some more information is given in the description of the Tables module. A detailed description is given in note 199.

The high-level interface is using a TaQL command as described in note 199. Such a command can be given in C++ (using TableParse.h), Python or the shell program 'taql'. The code for parsing and executing TaQL commands is quite complex. Processing a command consists of two steps.

1. First a command is parsed using 'flex' and 'bison'. The file TableGram.ll is used by 'flex' to recognize the tokens in the command. The file TableGram.yy defines the grammar which is used by bison to invoke actions on the recognized parts of the command. These actions consist of building a parse tree by means of class TaQLNode and associated classes. In this way the command is syntactically checked.
2. If the parsing is done successfully, the command is executed by walking through the parse tree using class TaQLNodeHandler. In its turn that class invokes functions in class TableParseQuery to check (semantically) and execute commands such as SELECT, UPDATE, etc.. Note that subqueries are executed before the entire parse tree has been walked through, thus before possible later semantic errors are detected.
   Expressions in the parse tree are converted to expression trees using the various TableExprNode classes. Expression trees are evaluated for each row in a table. Note that expressions can be used in many parts of a TaQL command. Functions in a command are handled by TableParseFunc.

Expression trees can also be generated directly in C++ using class TableExprNode which is overloaded for many operators and functions (such as sin, max, etc.). In fact, TaQLNodeHandler uses this code. For example:

### Example

Table tab("my.ms");
Table selection (tab(tab.col("ANTENNA1") == tab.col("ANTENNA2") &&
tab.col("SPECTRAL_WINDOW_ID") == 0));

creates a (reference) table containing the autocorrelations of the first spectral window in "my.ms".