[yaala] YAQL syntax.
Mon, 10 Mar 2003 22:56:51 +0600
Here is main ideas about syntax of query statements.
I tried to make it close to SQL and quite readable (intuitively clean).
Basic idea is object/properties paradigm:
Each (sub)expression defines some property of YAQL object
(either Definition, or Arrangament).
Data expression defined just as any expression in SQL or any other language.
Properties (attributes) are applied using special operators with keywords, like in
Sinplified grammar of YAQL:
DefinitionExpr : TypeSpec /* type specification */
DefinitionExpr : FormatSpec /* splitf-ike formatting */
DefinitionExpr AS Label
DefinitionExpr WITH Expr /* input filter */
DefinitionExpr FOR ArrangementExpr
SelectionExpr WHERE Expr /* output filter */
SelectionExrr SORT ExprList /* sort order */
These rules allows to concatenate several attribute operators.
SELECT amount = SUM(bytes) AS "Amount of downloaded" :number :"%'d"
FOR clients WHERE amount > 1024 SORT amount;
It may (and will) be conenient to apply attributes to several (or all)
statements, not to each separately.
I see 3 ways of making this.
1. using grouping brackets:
( DefinitionExprList ) AttributeOperator
2. applying attribute to void expr after list of expr:
3. using 'alternative' attrributes semantic:
Latter rule make the following interpretation:
expr1, expr2, attr1, attr2
=> (expr1, expr2) attr1, (expr1, expr2) attr2
This maybe very usefull to making that, what i call once 'keyvar
Egg, for some hypotetical iptraffic accounting log:
SELECT SUM(bytes), COUNT(clients),
WITH direction == 'outgoing' AS "Outgoing",
WITH direction == 'incoming' AS "Incoming"
Third rule may be also applied to 'FOR-operator':
And finally, ArrangementExpr:
ArrangementExpr / KeyVarList
KeyVarDef := may be attributed with label or format (with AS or ':' operators)
This defines list of expressions (or variables), separated with commas
or '/'. The '/' splits whole list into rows/columns/tables/pages
Empty sublist denotes to put data variables there.
Otherwise '=' is used to put datavars into user-specified splitting.