Merge branch 'yingyi/asterix_beta_fix'
diff --git a/asterix-doc/src/site/markdown/AsterixDataTypes.md b/asterix-doc/src/site/markdown/AsterixDBDataModel.md
similarity index 94%
rename from asterix-doc/src/site/markdown/AsterixDataTypes.md
rename to asterix-doc/src/site/markdown/AsterixDBDataModel.md
index 6674006..ffefd09 100644
--- a/asterix-doc/src/site/markdown/AsterixDataTypes.md
+++ b/asterix-doc/src/site/markdown/AsterixDBDataModel.md
@@ -23,7 +23,12 @@
### Int8 / Int16 / Int32 / Int64 ###
-Integer types using 8, 16, 32, or 64 bits.
+Integer types using 8, 16, 32, or 64 bits. The ranges of these types are:
+
+- `Int8`: -127 to 127
+- `Int16`: -32767 to 32767
+- `Int32`: -2147483647 to 2147483647
+- `Int64`: -9223372036854775808 to 9223372036854775807
* Example:
@@ -40,7 +45,7 @@
### Float ###
-`Float` represents approximate numeric data values using 4 bytes.
+`Float` represents approximate numeric data values using 4 bytes. The range of a float value can be from 2^(-149) to (2-2^(-23)·2^(127) for both positive and negative. Beyond these ranges will get `INF` or `-INF`.
* Example:
@@ -57,7 +62,7 @@
### Double ###
-`Double` represents approximate numeric data values using 8 bytes.
+`Double` represents approximate numeric data values using 8 bytes. The range of a double value can be from (2^(-1022)) to (2-2^(-52))·2^(1023) for both positive and negative. Beyond these ranges will get `INF` or `-INF`.
* Example:
diff --git a/asterix-doc/src/site/markdown/AsterixDataTypesAndFunctions.md b/asterix-doc/src/site/markdown/AsterixDBFunctions.md
similarity index 86%
rename from asterix-doc/src/site/markdown/AsterixDataTypesAndFunctions.md
rename to asterix-doc/src/site/markdown/AsterixDBFunctions.md
index 7576648..d47752c 100644
--- a/asterix-doc/src/site/markdown/AsterixDataTypesAndFunctions.md
+++ b/asterix-doc/src/site/markdown/AsterixDBFunctions.md
@@ -1,290 +1,3 @@
-# Asterix Data Model (ADM) #
-
-# Basic data types #
-
-An instance of Asterix data model (ADM) can be a _primitive type_ (`Int32`, `Int64`, `String`, `Float`, `Double`, `Date`, `Time`, `Datetime`, etc. or `NULL`) or a _derived type_.
-
-## Primitive Types ##
-
-### Boolean ###
-`Boolean` data type can have one of the two values: _*true*_ or _*false*_.
-
- * Example:
-
- let $t := true
- let $f := false
- return { "true": $t, "false": $f }
-
-
- * The expected result is:
-
- { "true": true, "false": false }
-
-
-
-### Int8 / Int16 / Int32 / Int64 ###
-Integer types using 8, 16, 32, or 64 bits.
-
- * Example:
-
- let $v8 := int8("125")
- let $v16 := int16("32765")
- let $v32 := 294967295
- let $v64 := int64("1700000000000000000")
- return { "int8": $v8, "int16": $v16, "int32": $v32, "int64": $v64}
-
-
- * The expected result is:
-
- { "int8": 125i8, "int16": 32765i16, "int32": 294967295, "int64": 1700000000000000000i64 }
-
-
-### Float ###
-`Float` represents approximate numeric data values using 4 bytes.
-
- * Example:
-
- let $v1 := float("NaN")
- let $v2 := float("INF")
- let $v3 := float("-INF")
- let $v4 := float("-2013.5")
- return { "v1": $v1, "v2": $v2, "v3": $v3, "v4": $v4 }
-
-
- * The expected result is:
-
- { "v1": NaNf, "v2": Infinityf, "v3": -Infinityf, "v4": -2013.5f }
-
-
-### Double ###
-`Double` represents approximate numeric data values using 8 bytes.
-
- * Example:
-
- let $v1 := double("NaN")
- let $v2 := double("INF")
- let $v3 := double("-INF")
- let $v4 := double("-2013.593823748327284")
- return { "v1": $v1, "v2": $v2, "v3": $v3, "v4": $v4 }
-
-
- * The expected result is:
-
- { "v1": NaNd, "v2": Infinityd, "v3": -Infinityd, "v4": -2013.5938237483274d }
-
-
-### String ###
-`String` represents a sequence of characters.
-
- * Example:
-
- let $v1 := string("This is a string.")
- let $v2 := string("\"This is a quoted string\"")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": "This is a string.", "v2": "\"This is a quoted string\"" }
-
-
-### Point ###
-`Point` is the fundamental two-dimensional building block for spatial types. It consists of two `double` coordinates x and y.
-
- * Example:
-
- let $v1 := point("80.10d, -10E5")
- let $v2 := point("5.10E-10d, -10E5")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": point("80.1,-1000000.0"), "v2": point("5.1E-10,-1000000.0") }
-
-
-### Line ###
-`Line` consists of two points that represent the start and the end points of a line segment.
-
- * Example:
-
- let $v1 := line("10.1234,11.1e-1 +10.2E-2,-11.22")
- let $v2 := line("0.1234,-1.00e-10 +10.5E-2,-01.02")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": line("10.1234,1.11 0.102,-11.22"), "v2": line("0.1234,-1.0E-10 0.105,-1.02") }
-
-
-### Rectangle ###
-`Rectangle` consists of two points that represent the _*bottom left*_ and _*upper right*_ corners of a rectangle.
-
- * Example:
-
- let $v1 := rectangle("5.1,11.8 87.6,15.6548")
- let $v2 := rectangle("0.1234,-1.00e-10 5.5487,0.48765")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": rectangle("5.1,11.8 87.6,15.6548"), "v2": rectangle("0.1234,-1.0E-10 5.5487,0.48765") }
-
-
-### Circle ###
-`Circle` consists of one `point` that represents the center of the circle and a radius of type `double`.
-
- * Example:
-
- let $v1 := circle("10.1234,11.1e-1 +10.2E-2")
- let $v2 := circle("0.1234,-1.00e-10 +10.5E-2")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": circle("10.1234,1.11 0.102"), "v2": circle("0.1234,-1.0E-10 0.105") }
-
-
-### Polygon ###
-`Polygon` consists of _*n*_ points that represent the vertices of a _*simple closed*_ polygon.
-
- * Example:
-
- let $v1 := polygon("-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81")
- let $v2 := polygon("-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": polygon("-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81"), "v2": polygon("-1.0,1050.0 -2.15E50,2.5 -1.0,3300.0 -250000.0,20.15 350.0,3.6 -0.0046,4.75 -2.0,100.0 -200000.0,20.1 30.5,3.25 -0.00433,4.75") }
-
-
-### Date ###
-`Date` represents a time point along the Gregorian calendar system specified by the year, month and day. ASTERIX supports the date from `-9999-01-01` to `9999-12-31`.
-
-A date value can be represented in two formats, extended format and basic format.
-
- * Extended format is represented as `[-]yyyy-mm-dd` for `year-month-day`. Each field should be padded if there are less digits than the format specified.
- * Basic format is in the format of `[-]yyyymmdd`.
-
- * Example:
-
- let $v1 := date("2013-01-01")
- let $v2 := date("-19700101")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": date("2013-01-01"), "v2": date("-1970-01-01") }
-
-
-### Time ###
-`Time` type describes the time within the range of a day. It is represented by three fields: hour, minute and second. Millisecond field is optional as the fraction of the second field. Its extended format is as `hh:mm:ss[.mmm]` and the basic format is `hhmmss[mmm]`. The value domain is from `00:00:00.000` to `23:59:59.999`.
-
-Timezone field is optional for a time value. Timezone is represented as `[+|-]hh:mm` for extended format or `[+|-]hhmm` for basic format. Note that the sign designators cannot be omitted. `Z` can also be used to represent the UTC local time. If no timezone information is given, it is UTC by default.
-
- * Example:
-
- let $v1 := time("12:12:12.039Z")
- let $v2 := time("000000000-0800")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": time("12:12:12.039Z"), "v2": time("08:00:00.000Z") }
-
-
-### Datetime ###
-A `Datetime` value is a combination of an `Date` and `Time`, representing a fixed time point along the Gregorian calendar system. The value is among `-9999-01-01 00:00:00.000` and `9999-12-31 23:59:59.999`.
-
-A `Datetime` value is represented as a combination of the representation of its `Date` part and `Time` part, separated by a separator `T`. Either extended or basic format can be used, and the two parts should be the same format.
-
-Millisecond field and timezone field are optional, as specified in the `Time` type.
-
- * Example:
-
- let $v1 := datetime("2013-01-01T12:12:12.039Z")
- let $v2 := datetime("-19700101T000000000-0800")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": datetime("2013-01-01T12:12:12.039Z"), "v2": datetime("-1970-01-01T08:00:00.000Z") }
-
-
-### Duration ###
-`Duration` represents a duration of time. A duration value is specified by integers on at least one of the following fields: year, month, day, hour, minute, second, and millisecond.
-
-A duration value is in the format of `[-]PnYnMnDTnHnMn.mmmS`. The millisecond part (as the fraction of the second field) is optional, and when no millisecond field is used, the decimal point should also be absent.
-
-Negative durations are also supported for the arithmetic operations between time instance types (`Date`, `Time` and `Datetime`), and is used to roll the time back for the given duration. For example `date("2012-01-01") + duration("-P3D")` will return `date("2011-12-29")`.
-
-Note that a canonical representation of the duration is always returned, regardless whether the duration is in the canonical representation or not from the user's input. More information about canonical representation can be found from [XPath dayTimeDuration Canonical Representation](http://www.w3.org/TR/xpath-functions/#canonical-dayTimeDuration) and [yearMonthDuration Canonical Representation](http://www.w3.org/TR/xpath-functions/#canonical-yearMonthDuration).
-
- * Example:
-
- let $v1 := duration("P100Y12MT12M")
- let $v2 := duration("-PT20.943S")
- return { "v1": $v1, "v2": $v2 }
-
-
- * The expected result is:
-
- { "v1": duration("P101YT12M"), "v2": duration("-PT20.943S") }
-
-
-### Interval ###
-`Interval` represents inclusive-exclusive ranges of time. It is defined by two time point values with the same temporal type(`Date`, `Time` or `Datetime`).
-
- * Example:
-
- let $v1 := interval-from-date(date("2013-01-01"), date("20130505"))
- let $v2 := interval-from-time(time("00:01:01"), time("213901049+0800"))
- let $v3 := interval-from-datetime(datetime("2013-01-01T00:01:01"), datetime("20130505T213901049+0800"))
- return { "v1": $v1, "v2": $v2, "v3": $v3 }
-
-
- * The expected result is:
-
- { "v1": interval-date("2013-01-01, 2013-05-05"), "v2": interval-time("00:01:01.000Z, 13:39:01.049Z"), "v3": interval-datetime("2013-01-01T00:01:01.000Z, 2013-05-05T13:39:01.049Z") }
-
-
-## Derived Types ##
-
-### Record ###
-A `Record` contains a set of fields, where each field is described by its name and type. A record type is either open or closed. Open records can contain fields that are not part of the type definition, while closed records cannot. Syntactically, record constructors are surrounded by curly braces "{...}".
-
-An example would be
-
-
- { "id": 213508, "name": "Alice Bob" }
-
-
-### OrderedList ###
-An `OrderedList` is a sequence of values for which the order is determined by creation or insertion. OrderedList constructors are denoted by brackets: "[...]".
-
-An example would be
-
-
- ["alice", 123, "bob", null]
-
-
-### UnorderedList ###
-An `UnorderedList` is an unordered sequence of values, similar to bags in SQL. UnorderedList constructors are denoted by two opening flower braces followed by data and two closing flower braces, like "{{...}}".
-
-An example would be
-
-
- {{"hello", 9328, "world", [1, 2, null]}}
-
-
# Asterix: Using Functions #
Asterix provides rich support of various classes of functions to support operations on string, spatial, and temporal data. This document explains how to use these functions.
diff --git a/asterix-doc/src/site/markdown/AsterixQueryLanguageReference.md b/asterix-doc/src/site/markdown/AsterixQueryLanguageReference.md
index c9ed3e2..1ed876e 100644
--- a/asterix-doc/src/site/markdown/AsterixQueryLanguageReference.md
+++ b/asterix-doc/src/site/markdown/AsterixQueryLanguageReference.md
@@ -3,38 +3,79 @@
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
+ PrimaryExpr ::= Literal
+ | VariableRef
+ | ParenthesizedExpression
+ | FunctionCallExpr
+ | DatasetAccessExpression
+ | ListConstructor
+ | RecordConstructor
+
#### Literals
- Literal ::= StringLiteral | <INTEGER_LITERAL> | <FLOAT_LITERAL> | <DOUBLE_LITERAL> | <NULL> | <TRUE> | <FALSE>
+ Literal ::= StringLiteral
+ | <INTEGER_LITERAL>
+ | <FLOAT_LITERAL>
+ | <DOUBLE_LITERAL>
+ | "null"
+ | "true"
+ | "false"
StringLiteral ::= <STRING_LITERAL>
+##### Examples
+
+ "a string"
+ 42
+
+
#### Variable References
VariableRef ::= <VARIABLE>
+
+##### Example
+
+ $id
+
#### Parenthesized Expressions
- ParenthesizedExpression ::= <LEFTPAREN> Expression <RIGHTPAREN>
+ ParenthesizedExpression ::= "(" Expression ")"
+
+##### Example
+
+ ( 1 + 1 )
+
#### Function Calls
- FunctionCallExpr ::= FunctionOrTypeName <LEFTPAREN> ( Expression ( "," Expression )* )? <RIGHTPAREN>
-
+ FunctionCallExpr ::= FunctionOrTypeName "(" ( Expression ( "," Expression )* )? ")"
+
+##### Example
+
+ string-length("a string")
+
+
#### Dataset Access
- DatasetAccessExpression ::= <DATASET> ( ( Identifier ( "." Identifier )? )
- | ( <LEFTPAREN> Expression ( "," Expression )* <RIGHTPAREN> ) )
+ DatasetAccessExpression ::= "dataset" ( ( Identifier ( "." Identifier )? )
+ | ( "(" Expression ")" ) )
Identifier ::= <IDENTIFIER> | StringLiteral
+##### Examples
+
+ dataset customers
+ dataset (string-join("customers", $country))
+
+
#### Constructors
ListConstructor ::= ( OrderedListConstructor | UnorderedListConstructor )
@@ -43,20 +84,51 @@
RecordConstructor ::= "{" ( FieldBinding ( "," FieldBinding )* )? "}"
FieldBinding ::= Expression ":" Expression
+##### Examples
+
+ [ "a", "b", "c" ]
+
+ {{ 42, "forty-two", "AsterixDB!" }}
+
+ {
+ "project name" : "AsterixDB"
+ "project members" : {{ "vinayakb", "dtabass", "chenli" }}
+ }
+
+
### Path Expressions
ValueExpr ::= PrimaryExpr ( Field | Index )*
Field ::= "." Identifier
Index ::= "[" ( Expression | "?" ) "]"
+##### Examples
+
+ { "list" : [ "a", "b", "c"] }.list
+
+ [ "a", "b", "c"][2]
+
+ { "list" : [ "a", "b", "c"] }.list[2]
+
+
### Logical Expressions
OperatorExpr ::= AndExpr ( "or" AndExpr )*
AndExpr ::= RelExpr ( "and" RelExpr )*
+##### Example
+
+ $a > 3 and $a < 5
+
+
### Comparison Expressions
RelExpr ::= AddExpr ( ( "<" | ">" | "<=" | ">=" | "=" | "!=" | "~=" ) AddExpr )?
+
+##### Example
+
+ 5 > 3
+
### Arithmetic Expressions
@@ -64,6 +136,11 @@
MultExpr ::= UnaryExpr ( ( "*" | "/" | "%" | <CARET> | "idiv" ) UnaryExpr )*
UnaryExpr ::= ( ( "+" | "-" ) )? ValueExpr
+##### Example
+
+ 3 ^ 2 + 4 ^ 2
+
+
### FLWOGR Expression
FLWOGR ::= ( ForClause | LetClause ) ( Clause )* "return" Expression
@@ -81,16 +158,99 @@
Variable ::= <VARIABLE>
+##### Example
+
+ for $user in dataset FacebookUsers
+ where $user.id = 8
+ return $user
+
+##### Example
+
+ for $user in dataset FacebookUsers
+ for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return
+ {
+ "uname": $user.name,
+ "message": $message.message
+ };
+
+##### Example
+
+ for $user in dataset FacebookUsers
+ let $messages :=
+ for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return $message.message
+ return
+ {
+ "uname": $user.name,
+ "messages": $messages
+ };
+
+##### Example
+
+ for $user in dataset TwitterUsers
+ order by $user.followers_count desc, $user.lang asc
+ return $user
+
+* null is smaller than any other value
+
+##### Example
+
+ for $x in dataset FacebookMessages
+ let $messages := $x.message
+ group by $loc := $x.sender-location with $messages
+ return
+ {
+ "location" : $loc,
+ "message" : $messages
+ }
+
+* after group by only variables that are either in the group-by-list or in the with-list are in scope
+* the variables in the with-clause contain a collection of items after the group by clause (all the values that the variable was bound to in the tuples that make up the group)
+* null is handled as a single value for grouping
+
+##### Example
+
+ for $user in dataset TwitterUsers
+ order by $user.followers_count desc
+ limit 2
+ return $user
+
+##### Example (currently not working)
+
+ for $x in dataset FacebookMessages
+ distinct by $x.sender-location
+ return
+ {
+ "location" : $x.sender-location,
+ "message" : $x.message
+ }
+
+* every variable that is in-scope before the distinct clause is also in scope after the distinct clause
+* works a lot like group by, but for every variable that contains more than one value after the distinct-by clause, one value is picked non-deterministically
+* if the variable is in the disctict-by list, then value is deterministic
+* null is a single value
+
### Conditional Expression
- IfThenElse ::= "if" <LEFTPAREN> Expression <RIGHTPAREN> "then" Expression "else" Expression
+ IfThenElse ::= "if" "(" Expression ")" "then" Expression "else" Expression
+
+##### Example
+
+ if (2 < 3) then "yes" else "no"
### Quantified Expressions
QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression
( "," Variable "in" Expression )* "satisfies" Expression
+
+##### Examples
+ every $x in [ 1, 2, 3] satisfies $x < 3
+ some $x in [ 1, 2, 3] satisfies $x < 3
## 3. Statements
@@ -103,7 +263,6 @@
| SetStatement
| InsertStatement
| DeleteStatement
- | FeedStatement
| Query
### Declarations
@@ -111,21 +270,48 @@
DataverseDeclaration ::= "use" "dataverse" Identifier
SetStatement ::= "set" Identifier StringLiteral
FunctionDeclaration ::= "declare" "function" Identifier ParameterList "{" Expression "}"
- ParameterList ::= <LEFTPAREN> ( <VARIABLE> ( "," <VARIABLE> )* )? <RIGHTPAREN>
+ ParameterList ::= "(" ( <VARIABLE> ( "," <VARIABLE> )* )? ")"
+
+##### Example
+
+ use dataverse TinySocial;
+
+##### Example
+
+ set simfunction "jaccard";
+ set simthreshold "0.6f";
+
+##### Example
+
+ set simfunction "jaccard";
+ set simthreshold "0.6f";
+
+##### Example
+
+ declare function add($a, $b) {
+ $a + $b
+ };
### Lifecycle Management Statements
- CreateStatement ::= "create" ( TypeSpecification | DatasetSpecification | IndexSpecification | DataverseSpecification | FunctionSpecification )
+ CreateStatement ::= "create" ( DataverseSpecification
+ | TypeSpecification
+ | DatasetSpecification
+ | IndexSpecification
+ | FunctionSpecification )
- DropStatement ::= "drop" ( <DATASET> QualifiedName IfExists
- | "index" DoubleQualifiedName IfExists
- | "type" FunctionOrTypeName IfExists
- | "dataverse" Identifier IfExists
- | "function" FunctionSignature IfExists )
- IfExists ::= ( "if" "exists" )?
QualifiedName ::= Identifier ( "." Identifier )?
DoubleQualifiedName ::= Identifier "." Identifier ( "." Identifier )?
+#### Dataverses
+
+ DataverseSpecification ::= "dataverse" Identifier IfNotExists ( "with format" StringLiteral )?
+
+
+##### Example
+
+ create dataverse TinySocial;
+
#### Types
TypeSpecification ::= "type" FunctionOrTypeName IfNotExists "as" TypeExpr
@@ -137,55 +323,140 @@
TypeReference ::= Identifier
OrderedListTypeDef ::= "[" ( TypeExpr ) "]"
UnorderedListTypeDef ::= "{{" ( TypeExpr ) "}}"
-
+
+##### Example
+
+ create type FacebookUserType as closed {
+ id: int32,
+ alias: string,
+ name: string,
+ user-since: datetime,
+ friend-ids: {{ int32 }},
+ employment: [EmploymentType]
+ }
+
+
#### 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 )?
- | "internal"? <DATASET> QualifiedName <LEFTPAREN> Identifier <RIGHTPAREN> IfNotExists
- PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
+ DatasetSpecification ::= "internal"? "dataset" QualifiedName "(" Identifier ")" IfNotExists
+ PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
+ | "external" "dataset" QualifiedName "(" Identifier ")" IfNotExists
+ "using" AdapterName Configuration ( "hints" Properties )?
AdapterName ::= Identifier
- Configuration ::= <LEFTPAREN> ( KeyValuePair ( "," KeyValuePair )* )? <RIGHTPAREN>
- KeyValuePair ::= <LEFTPAREN> StringLiteral "=" StringLiteral <RIGHTPAREN>
- Properties ::= ( <LEFTPAREN> Property ( "," Property )* <RIGHTPAREN> )?
+ Configuration ::= "(" ( KeyValuePair ( "," KeyValuePair )* )? ")"
+ KeyValuePair ::= "(" StringLiteral "=" StringLiteral ")"
+ Properties ::= ( "(" Property ( "," Property )* ")" )?
Property ::= Identifier "=" ( StringLiteral | <INTEGER_LITERAL> )
ApplyFunction ::= "apply" "function" FunctionSignature
FunctionSignature ::= FunctionOrTypeName "@" <INTEGER_LITERAL>
PrimaryKey ::= "primary" "key" Identifier ( "," Identifier )*
+
+##### Example
+ create internal dataset FacebookUsers(FacebookUserType) primary key id;
+
+##### Example
+
+ create external dataset Lineitem(LineitemType) using localfs (
+ ("path"="127.0.0.1://SOURCE_PATH"),
+ ("format"="delimited-text"),
+ ("delimiter"="|"));
+
#### 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>
+ IndexSpecification ::= "index" Identifier IfNotExists "on" QualifiedName
+ "(" ( Identifier ) ( "," Identifier )* ")" ( "type" IndexType )?
+ IndexType ::= "btree"
+ | "rtree"
+ | "keyword"
+ | "fuzzy keyword"
+ | "ngram" "(" <INTEGER_LITERAL> ")"
+ | "fuzzy ngram" "(" <INTEGER_LITERAL> ")"
-#### Dataverses
+##### Example
- DataverseSpecification ::= "dataverse" Identifier IfNotExists ( "with format" StringLiteral )?
+ create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+
+##### Example
+
+ create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+
+##### Example
+
+ create index fbMessageIdx on FacebookMessages(message) type keyword;
+
#### Functions
- FunctionSpecification ::= "function" FunctionOrTypeName IfNotExists ParameterList "{" Expression "}"
+ FunctionSpecification ::= "function" FunctionOrTypeName IfNotExists ParameterList "{" Expression "}"
+
+##### Example
+
+ create function add($a, $b) {
+ $a + $b
+ };
+
+
+#### Removal
+
+ DropStatement ::= "drop" ( "dataverse" Identifier IfExists
+ | "type" FunctionOrTypeName IfExists
+ | "dataset" QualifiedName IfExists
+ | "index" DoubleQualifiedName IfExists
+ | "function" FunctionSignature IfExists )
+ IfExists ::= ( "if" "exists" )?
+
+##### Example
+
+ drop dataset FacebookUsers if exists;
+
+##### Example
+
+ drop index fbSenderLocIndex;
+
+##### Example
+
+ drop type FacebookUserType;
+
+##### Example
+
+ drop dataverse TinySocial;
+
+##### Example
+
+ drop function add;
+
### Import/Export Statements
- LoadStatement ::= "load" <DATASET> QualifiedName "using" AdapterName Configuration ( "pre-sorted" )?
+ LoadStatement ::= "load" "dataset" QualifiedName "using" AdapterName Configuration ( "pre-sorted" )?
+
+##### Example
+
+ load dataset FacebookUsers using localfs
+ (("path"="localhost:///Users/zuck/AsterixDB/load/fbu.adm"),("format"="adm"));
+
### Modification Statements
- InsertStatement ::= "insert" "into" <DATASET> QualifiedName Query
- DeleteStatement ::= "delete" Variable "from" <DATASET> QualifiedName ( "where" Expression )?
+ InsertStatement ::= "insert" "into" "dataset" QualifiedName Query
+ DeleteStatement ::= "delete" Variable "from" "dataset" QualifiedName ( "where" Expression )?
+
+##### Example
-### Feed Management Statements
+ insert into dataset UsersCopy (for $user in dataset FacebookUsers return $user)
- FeedStatement ::= "begin" "feed" QualifiedName
- | "suspend" "feed" QualifiedName
- | "resume" "feed" QualifiedName
- | "end" "feed" QualifiedName
- | "alter" "feed" QualifiedName "set" Configuration
+##### Example
+
+ delete $user from dataset FacebookUsers where $user.id = 8;
+
### Queries
Query ::= Expression
+##### Example
+
+ for $praise in {{ "great", "brilliant", "awesome" }}
+ return
+ string-concat(["AsterixDB is ", $praise])
diff --git a/asterix-doc/src/site/markdown/index.md b/asterix-doc/src/site/markdown/index.md
new file mode 100644
index 0000000..cba2fdc
--- /dev/null
+++ b/asterix-doc/src/site/markdown/index.md
@@ -0,0 +1 @@
+# AsterixDB
diff --git a/asterix-doc/src/site/site.xml b/asterix-doc/src/site/site.xml
new file mode 100644
index 0000000..6724153
--- /dev/null
+++ b/asterix-doc/src/site/site.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="AsterixDB" xmlns="http://maven.apache.org/DECORATION/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+ <!--
+ <bannerLeft>
+ <name>Asterix</name>
+ <src>http://asterix.ics.uci.edu/pic/img9.jpg</src>
+ <href>http://asterix.ics.uci.edu/</href>
+ </bannerLeft>
+ -->
+
+ <skin>
+ <groupId>org.apache.maven.skins</groupId>
+ <artifactId>maven-fluido-skin</artifactId>
+ <version>1.2.1</version>
+ </skin>
+ <custom>
+ <fluidoSkin>
+ <sideBarEnabled>true</sideBarEnabled>
+ <!-- <googlePlusOne /> -->
+ </fluidoSkin>
+ </custom>
+
+ <body>
+ <links>
+ <item name="Home" href="index.html"/>
+ </links>
+
+ <menu name="Documentation">
+ <item name="AsterixDB: A Big Data Management System" href="AsterixAlphaRelease.html"/>
+ <item name="Installing Asterix using Managix" href="InstallingAsterixUsingManagix.html"/>
+ <item name="AsterixDB 101: An ADM and AQL Primer" href="AdmAql101.html"/>
+ <item name="Asterix Data Model (ADM)" href="AsterixDBDataModel.html"/>
+ <item name="AsterixDB Functions" href="AsterixDBFunctions.html"/>
+ <item name="The Asterix Query Language" href="AsterixQueryLanguageReference.html"/>
+ <item name="AsterixDB Support of Similarity Queries" href="AsterixSimilarityQueries.html"/>
+ <item name="Accessing External Data in AsterixDB" href="AccessingExternalDataInAsterixDB.html"/>
+ <item name="REST API to AsterixDB" href="AsterixDBRestAPI.html"/>
+ <item name="(old AQL doc)" href="AsterixQueryLanguage.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+ </body>
+</project>