The following words are reserved for use by the GSQL query language. That is, a query may not use any of these words for a user-defined identifier, such as the name of a local variable or a local TUPLE type.
v3.1: Added TAGS
, RESET_COLLECTION_ACCUM
, WITH
There is a separate list for Reserved Words for the GSQL DDL Language. The compiler will reject the use of a Reserved Word as a user-defined identifier.
No computer can store all floating point numbers (i.e., non-integers) with perfect precision. The float data type offers about 7 decimal digits of precision; the double data type offers about 15 decimal digits of precision. Comparing two float or double values by using operators involving exact equality (==, <=, >=, BETWEEN ... AND ...) might lead to unexpected behavior. If the GSQL language parser detects that the user is attempting an exact equivalence test with float or double data types, it will display a warning message and suggestion. For example, if there are two float variables v and v2, the expression v == v2 causes the following warning message:
Response to Non-existent vertex ID
If a query has a vertex parameter (VERTEX or VERTEX<vType>), and if the ID for a nonexistent vertex is given when running the query, an error message is shown, and the query won't run. This is also the response when calling a function to convert a single vertex ID string to a vertex:
to_vertex(): See Section "Miscellaneous Functions".
However, if the parameter is a vertex set (SET<VERTEX> or SET<VERTEX<vType>>), and one or more nonexistent IDs are given when running the query, a warning message is shown, but the query still runs, ignoring those nonexistent IDs. Therefore, if all given IDs are nonexistent, the parameter becomes an empty set. T his is also the response when calling a function to convert a set of vertex IDs to a set of vertices :
to_vertex_set(): See Section " Miscellaneous Functions ".
SelectVertex(): See Section " Miscellaneous Functions ".
Currently, a query defined withCREATE DISTRIBUTED QUERY
cannot be run in Interpreted Mode. However, interpreted queries can still run on a distributed graph with a regular, non-distributed execution model.
The list below includes additional limitations. These limitations are expected to be temporary. We are continuing to expand the capabilities of Interpreted Mode.
Distributed Query Mode
Any operation involving files
FILE
objects
PRINT TO_CSV
LoadAccum()
function
SelectVertex()
function
Statements
Exception statements:
RAISE
statements
TRY...EXCEPTION
statements
RETURN
statements
Returning a vertex set variable
Assigning value to a global variable at the statement level
Attributes and accumulators
ArrayAccum
Accessing the previous value of a vertex-attached accumulator with the ' operator, e.g., src.@acc'
STRING COMPRESS
as accumulator type
Accessing the attribute of a vertex variable that is not a vertex alias defined in a FROM
clause
Functions and Operators
Aggregate functions: AVG()
, MIN()
, MAX()
, COUNT()
, ISEMPTY()
, SUM()
neighbor()
, neighborAttribute()
COALESCE()
IS NULL
, IS NOT NULL
evaluate()
datetime_format()
parse_json_object()
, parse_json_array()
User-Defined Functions
Data types
JSONOBJECT
, JSONARRAY
BAG
type parameters
Other
In INSERT
: Optional vertex type information for from- and to- vertices when inserting edges
Using _
or ANY
to specify any source vertex type in a FROM
clause
Having the same name for global accumulators, global variables, and query parameters
For example, there cannot be a query parameter named param
and a global accumulator named @@param
within the same query
Below is the listing of the graph create&load command files and data files to generate the six example graphs used in this document: workNet , socialNet , friendNet , computerNet , minimalNet , andinvestmentNet . The tar-gzip file gsql_ref_examples_2.0.gz contains all of these files. Each graph has its own folder. To create a particular graph, go in its folder and run the following command: gsql graph_create.gsql
There is no loading job or data for minimalNet (hence, "minimal.")
This is the definition for the GSQL Query Language syntax. It is defined as a set of rules expressed in EBNF notation.
This defines the EBNF notation used to describe the syntax. Rules contains terminal and non-terminal symbols. A terminal symbol is a base-level symbol which expresses literal output. All symbols in single or double quotes (e.g., '+', "=", ")", "10") are terminal symbols. A non-terminal symbol is defined as some combination of terminal and non-terminal symbols. The left-hand side of a rule is always a non-terminal; this rule defines the non-terminal. The example rule below defines assignmentStmt (that is, an Assignment Statement) to be a name followed by an equal sign followed by an expression, operator, and expression with a terminating semi-colon. AssignmentStmt, name, and expr are all non-terminals. Additionally, all KEYWORDS are in all-capitals and are terminal symbols. The ":=" is part of EBNF and states the left hand side can be expanded to the right hand side.
A vertical bar | in EBNF indicates choice. Choose either the symbol on the left or on the right. A sequence of vertical bars means choose any one of the symbols in the sequence.
Square brackets [ ] indicate an optional part or group of symbols. Parentheses ( ) group symbols together. The rule below defines a constant to be one, two, or three digits preceded by an optional plus or minus sign.
Star * and plus + are symbols in EBNF for closure. Star means zero or more occurrences, and plus means one or more occurrences. The following defines intConstant to be an optional plus or minus followed by one or more digits. It also defines floatConstant to be an optional plus or minus followed by zero or more digits followed by a decimal followed by one or more digits. The star and plus also can be applied to groups of symbols as in the definition of list. The non-terminal list is defined as a parenthesized list of comma-separated expressions (expr). The list has at least one expression which can be followed by zero or more comma-expression pairs.