add new sub-project asterix-doc
add first stub for language reference in markdown format
diff --git a/asterix-doc/pom.xml b/asterix-doc/pom.xml
new file mode 100644
index 0000000..f44c06d
--- /dev/null
+++ b/asterix-doc/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>asterix</artifactId>
+ <groupId>edu.uci.ics.asterix</groupId>
+ <version>0.0.6-SNAPSHOT</version>
+ </parent>
+ <artifactId>asterix-doc</artifactId>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.3</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/asterix-doc/src/site/markdown/aql.md b/asterix-doc/src/site/markdown/aql.md
new file mode 100644
index 0000000..1fa553c
--- /dev/null
+++ b/asterix-doc/src/site/markdown/aql.md
@@ -0,0 +1,206 @@
+# The Asterix Query Language, Version 1.0
+## 1. Introduction
+
+This document provides an overview of the Asterix Query language.
+
+## 2. Expressions
+
+ Expression ::= ( OperatorExpr | IfThenElse | FLWOGR | QuantifiedExpression )
+
+### Primary Expressions
+
+ PrimaryExpr ::= Literal | VariableRef | ParenthesizedExpression | FunctionCallExpr
+ | DatasetAccessExpression | ListConstructor | RecordConstructor
+
+#### Literals
+
+ Literal ::= StringLiteral | <INTEGER_LITERAL> | <FLOAT_LITERAL> | <DOUBLE_LITERAL> | <NULL> | <TRUE> | <FALSE>
+ StringLiteral ::= <STRING_LITERAL>
+
+#### Variable References
+
+ VariableRef ::= <VARIABLE>
+
+#### Parenthesized Expressions
+
+ ParenthesizedExpression ::= <LEFTPAREN> Expression <RIGHTPAREN>
+
+#### Function Calls
+
+ FunctionCallExpr ::= FunctionOrTypeName <LEFTPAREN> ( Expression ( "," Expression )* )? <RIGHTPAREN>
+
+#### Dataset Access
+
+ DatasetAccessExpression ::= <DATASET> ( ( Identifier ( "." Identifier )? )
+ | ( <LEFTPAREN> Expression ( "," Expression )* <RIGHTPAREN> ) )
+ Identifier ::= <IDENTIFIER> | StringLiteral
+
+#### Constructors
+
+ ListConstructor ::= ( OrderedListConstructor | UnorderedListConstructor )
+ OrderedListConstructor ::= "[" ( Expression ( "," Expression )* )? "]"
+ UnorderedListConstructor ::= "{{" ( Expression ( "," Expression )* )? "}}"
+ RecordConstructor ::= "{" ( FieldBinding ( "," FieldBinding )* )? "}"
+ FieldBinding ::= Expression ":" Expression
+
+### Path Expressions
+
+ ValueExpr ::= PrimaryExpr ( Field | Index )*
+ Field ::= "." Identifier
+ Index ::= "[" ( Expression | "?" ) "]"
+
+### Logical Expressions
+
+ OperatorExpr ::= AndExpr ( "or" AndExpr )*
+ AndExpr ::= RelExpr ( "and" RelExpr )*
+
+### Comparison Expressions
+
+ RelExpr ::= AddExpr ( ( "<" | ">" | "<=" | ">=" | "=" | "!=" | "~=" ) AddExpr )?
+
+### Arithmetic Expressions
+
+ AddExpr ::= MultExpr ( ( "+" | "-" ) MultExpr )*
+ MultExpr ::= UnionExpr ( ( "*" | "/" | "%" | <CARET> | "idiv" ) UnionExpr )*
+ UnionExpr ::= UnaryExpr ( "union" ( UnaryExpr ) )*
+ UnaryExpr ::= ( ( "+" | "-" ) )? ValueExpr
+
+### FLWOGR Expression
+
+ FLWOGR ::= ( ForClause | LetClause ) ( Clause )* "return" Expression
+ Clause ::= ForClause | LetClause | WhereClause | OrderbyClause
+ | GroupClause | LimitClause | DistinctClause
+ ForClause ::= "for" Variable ( "at" Variable )? "in" ( Expression )
+ LetClause ::= "let" Variable ":=" Expression
+ WhereClause ::= "where" Expression
+ OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )?
+ ( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
+ GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," ( Variable ":=" )? Expression )*
+ "with" VariableRef ( "," VariableRef )*
+ LimitClause ::= "limit" Expression ( "offset" Expression )?
+ DistinctClause ::= "distinct" "by" Expression ( "," Expression )*
+ Variable ::= <VARIABLE>
+
+
+### Conditional Expression
+
+ IfThenElse ::= "if" <LEFTPAREN> Expression <RIGHTPAREN> "then" Expression "else" Expression
+
+
+### Quantified Expressions
+
+ QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression
+ ( "," Variable "in" Expression )* "satisfies" Expression
+
+
+## 3. Statements
+
+ Statement ::= ( SingleStatement ( ";" )? )* <EOF>
+ SingleStatement ::= DataverseDeclaration
+ | FunctionDeclaration
+ | CreateStatement
+ | DropStatement
+ | LoadStatement
+ | WriteStatement
+ | SetStatement
+ | InsertStatement
+ | DeleteStatement
+ | UpdateStatement
+ | FeedStatement
+ | Query
+
+### Declarations
+
+ DataverseDeclaration ::= "use" "dataverse" Identifier
+ SetStatement ::= "set" Identifier StringLiteral
+ FunctionDeclaration ::= "declare" "function" Identifier <LEFTPAREN> ( <VARIABLE> ( "," <VARIABLE> )* )? <RIGHTPAREN> "{" Expression "}"
+
+### Lifecycle Management Statements
+
+ CreateStatement ::= "create" ( TypeSpecification | NodegroupSpecification | DatasetSpecification | IndexSpecification | DataverseSpecification | FunctionSpecification )
+
+ DropStatement ::= "drop" ( <DATASET> QualifiedName IfExists
+ | "index" DoubleQualifiedName IfExists
+ | "nodegroup" Identifier IfExists
+ | "type" FunctionOrTypeName IfExists
+ | "dataverse" Identifier IfExists
+ | "function" FunctionSignature IfExists )
+ IfExists ::= ( "if" "exists" )?
+ QualifiedName ::= Identifier ( "." Identifier )?
+ DoubleQualifiedName ::= Identifier "." Identifier ( "." Identifier )?
+
+#### Types
+
+ TypeSpecification ::= "type" FunctionOrTypeName IfNotExists "as" TypeExpr
+ FunctionOrTypeName ::= QualifiedName
+ IfNotExists ::= ( "if not exists" )?
+ TypeExpr ::= RecordTypeDef | TypeReference | OrderedListTypeDef | UnorderedListTypeDef
+ RecordTypeDef ::= ( "closed" | "open" )? "{" ( RecordField ( "," RecordField )* )? "}"
+ RecordField ::= Identifier ":" ( TypeExpr ) ( "?" )?
+ TypeReference ::= Identifier
+ OrderedListTypeDef ::= "[" ( TypeExpr ) "]"
+ UnorderedListTypeDef ::= "{{" ( TypeExpr ) "}}"
+
+#### Nodegroups
+
+ NodegroupSpecification ::= "nodegroup" Identifier IfNotExists "on" Identifier ( "," Identifier )*
+
+#### Datasets
+
+ DatasetSpecification ::= "external" <DATASET> QualifiedName <LEFTPAREN> Identifier <RIGHTPAREN> IfNotExists
+ "using" AdapterName Configuration ( "hints" Properties )?
+ | "feed" <DATASET> QualifiedName <LEFTPAREN> Identifier <RIGHTPAREN> IfNotExists
+ "using" AdapterName Configuration ( ApplyFunction )? PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
+ | <DATASET> QualifiedName <LEFTPAREN> Identifier <RIGHTPAREN> IfNotExists
+ PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
+ AdapterName ::= Identifier
+ Configuration ::= <LEFTPAREN> ( KeyValuePair ( "," KeyValuePair )* )? <RIGHTPAREN>
+ KeyValuePair ::= <LEFTPAREN> StringLiteral "=" StringLiteral <RIGHTPAREN>
+ Properties ::= ( <LEFTPAREN> Property ( "," Property )* <RIGHTPAREN> )?
+ Property ::= Identifier "=" ( StringLiteral | <INTEGER_LITERAL> )
+ ApplyFunction ::= "apply" "function" FunctionSignature
+ FunctionSignature ::= FunctionOrTypeName "@" <INTEGER_LITERAL>
+ PrimaryKey ::= "primary" "key" Identifier ( "," Identifier )*
+
+#### Indices
+
+ IndexSpecification ::= "index" Identifier IfNotExists "on" QualifiedName <LEFTPAREN> ( Identifier ) ( "," Identifier )* <RIGHTPAREN> ( "type" IndexType )?
+ IndexType ::= "btree" | "rtree" | "keyword" | "fuzzy keyword" | "ngram" <LEFTPAREN> <INTEGER_LITERAL> <RIGHTPAREN> | "fuzzy ngram" <LEFTPAREN> <INTEGER_LITERAL> <RIGHTPAREN>
+
+#### Dataverses
+
+ DataverseSpecification ::= "dataverse" Identifier IfNotExists ( "with format" StringLiteral )?
+
+#### Functions
+
+ FunctionSpecification ::= "function" FunctionOrTypeName IfNotExists <LEFTPAREN> ( <VARIABLE> ( "," <VARIABLE> )* )? <RIGHTPAREN> "{" Expression "}"
+
+
+### Import/Export Statements
+
+ WriteStatement ::= "write" ( ( "output" "to" Identifier ":" StringLiteral ( "using" StringLiteral )? ) | ( "into" <DATASET> <LEFTPAREN> Query <RIGHTPAREN> ) )
+ LoadStatement ::= "load" <DATASET> QualifiedName "using" AdapterName Configuration ( "pre-sorted" )?
+
+### Modification Statements
+
+ InsertStatement ::= "insert" "into" <DATASET> QualifiedName Query
+ DeleteStatement ::= "delete" Variable "from" <DATASET> QualifiedName ( "where" Expression )?
+ UpdateStatement ::= "update" Variable "in" Expression "where" Expression <LEFTPAREN> ( UpdateClause ( "," UpdateClause )* ) <RIGHTPAREN>
+ UpdateClause ::= "set" Expression ":=" Expression
+ | InsertStatement
+ | DeleteStatement
+ | UpdateStatement
+ | "if" <LEFTPAREN> Expression <RIGHTPAREN> "then" UpdateClause ( "else" UpdateClause )?
+
+### Feed Management Statements
+
+ FeedStatement ::= "begin" "feed" QualifiedName
+ | "suspend" "feed" QualifiedName
+ | "resume" "feed" QualifiedName
+ | "end" "feed" QualifiedName
+ | "alter" "feed" QualifiedName "set" Configuration
+
+### Queries
+
+ Query ::= Expression
+
diff --git a/pom.xml b/pom.xml
index 20efdb3..f4c46c6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,6 +84,7 @@
<module>asterix-server</module>
<module>asterix-installer</module>
<module>asterix-events</module>
+ <module>asterix-doc</module>
</modules>
<repositories>