GQL Cheat Sheet¶
This topic catalogs the most commonly used statements and commands in GQL for quick reference.
Note
The statements and commands in this topic are primarily based on the movie dataset. For brevity, the USE movie clause is omitted in most data query statements.
Data Definition Statements¶
Schema¶
| Statement | Description |
|---|---|
|
Creates a schema. |
|
Drops a schema. |
Graph Type¶
| Statement | Description |
|---|---|
|
Creates a graph type where each node type uses a single property as the primary key. |
|
Creates a graph type where each edge type uses a single property as the multi-edge key. |
|
Creates a graph type where node type properties have default values. |
|
Creates a graph type where the primary key and multi-edge key each consist of multiple properties. |
|
Creates an empty graph type. |
|
Drops a graph type. |
|
Adds node types and edge types. |
|
Drops node types and edge types. |
|
Renames node types and edge types. |
|
Adds labels to node types and edge types. |
|
Drops labels from node types and edge types. |
|
Adds properties to node types and edge types. |
|
Drops properties from node types and edge types. |
|
Renames properties of node types and edge types. |
|
Modifies properties of node types and edge types. |
|
Renames a graph type. |
Graph¶
| Statement | Description |
|---|---|
|
Creates a graph. |
|
Drops a graph. |
|
Renames a graph. |
Temporary Graph¶
| Statement | Description |
|---|---|
|
Creates a temporary graph based on an existing graph. |
|
Creates a temporary graph based on a subgraph. |
|
Drops a temporary graph. |
Index¶
| Statement | Description |
|---|---|
|
Creates a normal index on a node type. |
|
Creates a normal index on an edge type. |
|
Creates an IVF vector index based on the L2 metric on two node types.
|
|
Creates an HNSW vector index based on the IP metric on an edge type.
|
|
Creates a spatial index on a geospatial property of a node type. |
|
Creates a spatial index on a geospatial property of an edge type. |
|
Creates a full-text index on a node type. |
|
Drops an index on a node type. |
|
Drops an index on an edge type. |
TTL¶
| Statement | Description |
|---|---|
|
Sets the TTL duration for an edge type. |
|
Removes the TTL duration for an edge type. |
|
Modifies the TTL duration for an edge type. |
Procedure¶
| Statement | Description |
|---|---|
|
Creates a UDP. |
|
Creates or replaces a UDP. |
|
Drops a UDP. |
|
Modifies the comment of a UDP. |
|
Renames a UDP. |
Data Manipulation Statements¶
INSERT¶
| Statement | Description |
|---|---|
|
Inserts nodes based on node types. If a conflict is detected, the statement fails and reports an error, and no graph elements are inserted. |
|
With INSERT OR REPLACE, inserts the graph element if it does not exist, or replaces it if it already exists.
|
|
With INSERT OR IGNORE, inserts the graph element if it does not exist. If it already exists, ignores the write and keeps the existing data unchanged without reporting an error. In this example, the existing node with id:11 remains unchanged, and the node with id:12 is inserted if it does not yet exist.
|
|
With INSERT OR UPDATE, inserts the graph element if it does not exist, or updates it if it already exists.
|
|
Inserts nodes by specifying labels. |
|
Inserts a node with a NULL property value.
|
|
Inserts an edge based on existing nodes. |
|
Inserts new nodes and edges simultaneously. |
|
Inserts a node and an edge based on an existing node. |
|
Inserts multiple nodes and edges based on existing nodes. |
|
Batch inserts nodes and edges using a table variable. |
SET¶
| Statement | Description |
|---|---|
|
Updates a single property of a node. |
|
Updates multiple properties of a node. |
|
Updates a single property of an edge. |
|
Batch updates nodes using a table variable. |
DELETE¶
| Statement | Description |
|---|---|
|
Deletes a node. |
|
Deletes an edge. |
|
Deletes a node and an edge. |
|
Uses DETACH DELETE to delete a node and all edges connected to it.
|
|
Uses DETACH DELETE to delete all nodes and edges.
|
|
Batch deletes nodes using a table variable. |
Data Query Statements¶
MATCH¶
| Statement | Description |
|---|---|
|
Matches nodes with a node variable. |
|
Matches nodes with a label. |
|
Matches nodes with a variable label. |
|
Matches nodes with a WHERE clause. |
|
Matches nodes with node properties. |
|
Matches nodes with a single node type. |
|
Matches nodes with variable node types. |
|
Matches nodes with multiple node types. |
|
Matches edges with an edge variable. |
|
Matches edges with a label. |
|
Matches edges with a variable label. |
|
Matches edges with a WHERE clause. |
|
Matches edges with edge properties. |
|
Matches edges with a single edge type. |
|
Matches edges with a variable edge type. |
|
Matches edges with multiple edge types. |
|
Matches incoming edges. |
|
Matches undirected edges. |
|
Matches undirected edges and incoming edges. |
|
Matches outgoing and incoming edges. |
|
Matches edges in any direction. |
|
Matches variable-length paths with a quantified edge pattern. |
|
Matches with a simple path pattern. |
|
Matches with a complex path pattern. |
|
Matches variable-length paths with a quantified path pattern. |
|
Matches variable-length paths and returns the paths. |
|
Matches paths without repeated edges. |
|
Matches paths without repeated nodes. |
|
Matches all paths between two nodes that satisfy the conditions. |
|
Matches any two paths between two nodes that satisfy the conditions. |
|
Matches all shortest paths between two nodes that satisfy the conditions. |
|
Matches any single shortest path between two nodes that satisfy the conditions. |
|
Matches any two shortest paths between two nodes that satisfy the conditions. |
|
Matches multiple node patterns. |
|
Matches multiple edge patterns. |
|
Matches multiple path patterns. |
|
Specifies the OPTIONAL keyword for optional matching. |
|
Uses both regular matching and optional matching. |
FILTER¶
| Statement | Description |
|---|---|
|
Filters the results of a FOR statement. |
|
Filters the results of a MATCH statement. |
|
Filters the results of a CALL statement. |
LET¶
| Statement | Description |
|---|---|
|
Defines variables using expressions. |
|
Defines variables using node properties. |
|
Defines a variable using a subquery. |
|
Uses variables in subsequent statements. |
FOR¶
| Statement | Description |
|---|---|
|
Unnests a list. |
|
Unnests a nested list. |
|
Unnests two lists. |
|
Unnests a list generated by the range function. |
|
Unnests two lists concatenated with ||. |
|
Unnests a table. |
|
Unnests a list and returns the 1-based index. |
|
Unnests a list and returns the 0-based index. |
Pagination¶
| Statement | Description |
|---|---|
|
Paginates using ORDER BY, OFFSET, and LIMIT. |
|
Paginates after the RETURN statement. |
RETURN¶
| Statement | Description |
|---|---|
|
Returns all results. |
|
Returns multiple properties of a node. |
|
Returns multiple properties of a node with aliases. |
|
Returns aggregated results. |
|
Returns deduplicated results. |
Primitive Result Statements¶
| Statement | Description |
|---|---|
|
Returns unique results with pagination. |
|
Ends a MATCH statement without returning data. |
|
Ends an inline procedure. |
CALL¶
| Statement | Description |
|---|---|
|
Calls a named procedure. |
|
Calls a named procedure with the OPTIONAL keyword. |
|
Calls an inline procedure for computation. |
|
Calls an inline procedure with the OPTIONAL keyword. |
Linear Query¶
| Statement | Description |
|---|---|
|
Executes a linear query with FOR, FILTER, RETURN, and OFFSET statements. |
|
Executes a linear query with MATCH, FILTER, RETURN, and ORDER BY statements. |
Composite Query¶
| Statement | Description |
|---|---|
|
Combines two query results using the UNION operator. |
|
Combines two query results using the EXCEPT operator. |
|
Combines two query results using the INTERSECT operator. |
Nearest Neighbor Query¶
| Statement | Description |
|---|---|
|
Performs a KNN search to find the 3 nearest neighbors based on Euclidean distance. |
|
Performs an ANN search to find the 3 nearest neighbors based on Euclidean distance. |
Import/Export Statements¶
IMPORT¶
| Statement | Description |
|---|---|
|
Imports a complete graph from NebulaGraph Database Developer Edition into a temporary graph. |
|
Imports specific nodes and edges from NebulaGraph Database Developer Edition into a temporary graph. |
|
Imports data directly from a CSV file into a temporary graph. |
|
Imports data from a CSV file into a temporary graph using file variables. |
EXPORT¶
| Statement | Description |
|---|---|
|
Exports nodes and edges to a CSV file. |
|
Exports properties of nodes and edges to a CSV file. |
|
Exports node-attached aggregator values to a table. |
Server-side Programming Statements¶
Match-Compute Statement¶
| Statement | Description |
|---|---|
|
Computes the Jaccard similarity between users based on their movie preferences. |
Variable Operation Statements¶
| Statement | Description |
|---|---|
|
Assigns values to primitive value variables. |
|
Assigns values to global aggregated value variables. |
|
Assigns values to node-attached aggregator value variables. |
|
Assigns values to an active set variable. |
|
Aggregates values into a global aggregated value variable. |
|
Aggregates values into a node-attached aggregator value variable. |
|
Calls a member function of an aggregated value variable. |
Control Flow Statements¶
| Statement | Description |
|---|---|
|
Repeatedly executes a statement block using a WHILE loop. |
|
Conditionally executes a statement block using an IF-ELSEIF-ELSE statement. |
|
Exits a loop using the BREAK statement. |
|
Skips the remaining statements in the current iteration and proceeds to the next iteration using the CONTINUE statement. |
Log Statement¶
| Statement | Description |
|---|---|
|
Logs informational and warning messages during query execution. |
Statement Blocks¶
| Statement | Description |
|---|---|
|
A statement block containing both data query and data manipulation statements. |
|
A statement block containing multiple data query statements. |
Clauses¶
USE¶
| Statement | Description |
|---|---|
|
Declares a working graph in a query statement. |
|
Declares multiple working graphs in a composite query statement. |
|
Declares a working graph multiple times in a nested query statement. |
|
Declares a working graph in a data manipulation statement. |
WHERE¶
| Statement | Description |
|---|---|
|
Filters with a single condition. |
|
Filters with multiple conditions. |
YIELD¶
| Statement | Description |
|---|---|
|
Selects and renames columns. |
GROUP BY¶
| Statement | Description |
|---|---|
|
Groups by a single column. |
|
Groups by an aliased column. |
|
Groups by multiple columns. |
|
Treats all rows as a single group. |
ORDER BY¶
| Statement | Description |
|---|---|
|
Sorts in ascending order using ASC.
|
|
Sorts in descending order using DESC.
|
|
Places null values first using NULLS FIRST. When using DESC, NULLS LAST is the default.
|
|
Sorts by multiple columns. Results are sorted by the first sort key; if the values are equal, results are further sorted by the second sort key, and so on until all sort keys are applied. |
LIMIT¶
| Statement | Description |
|---|---|
|
Specifies the maximum number of rows to return. If the limit is greater than or equal to the total number of rows, all rows are returned. Otherwise, the number of returned rows does not exceed the limit. |
OFFSET¶
| Statement | Description |
|---|---|
|
Skips a specified number of rows in the result. If the offset is greater than the total number of rows, an empty result is returned. |
SAMPLE¶
| Statement | Description |
|---|---|
|
Samples the first 2 edges. |
|
Randomly samples 10% of the edges. |
|
Randomly samples 2 edges connecting unique neighbors. |
Functions¶
Math Functions¶
| Statement | Description |
|---|---|
|
The abs() function returns the absolute value of a number.
|
|
The mod() function returns the remainder of a division operation.
|
|
The floor() function returns the largest integer or decimal (with a fractional part of 0) that is less than or equal to the given number.
|
|
The ceil() or ceiling() function returns the smallest integer or decimal (with a fractional part of 0) that is greater than or equal to the given number.
|
|
The round() function rounds a number to the specified precision.
|
|
The exp() function returns e raised to the specified power.
|
|
The sign() function takes a float or integer as input and returns a specific integer value based on the sign of the input.
|
|
The pi() function returns the mathematical constant pi.
|
|
The sqrt() function returns the square root of a number.
|
|
The power() function returns the result of raising a number to a power.
|
|
The isnan() function checks whether the given number is NaN, returning true if it is and false otherwise.
|
|
The rand() function returns a random float in the range 0 (inclusive) to 1 (exclusive).
|
|
rand_geo() is an alias of rand_geometric(). Both functions return the number of failed trials before the first success in a geometric distribution.
|
|
The log() function returns the logarithm of a number to a specified base.
|
|
The log10() function returns the base-10 logarithm of a number.
|
|
The ln() function returns the natural logarithm (base e) of a number.
|
|
The sin() function returns the sine of a number.
|
|
The cos() function returns the cosine of a number.
|
|
The tan() function returns the tangent of a number.
|
|
The cot() function returns the cotangent of a number.
|
|
The sinh() function returns the hyperbolic sine of a number.
|
|
The cosh() function returns the hyperbolic cosine of a number.
|
|
The tanh() function returns the hyperbolic tangent of a number.
|
|
The asin() function returns the arcsine of a number.
|
|
The acos() function returns the arccosine of a number.
|
|
The atan() function returns the arctangent of a number.
|
|
The haversin() function returns the haversine of a number.
|
Aggregate Functions¶
| Statement | Description |
|---|---|
|
The avg() function returns the average of a set of values. |
|
The collect() function aggregates a set of values into a list. The collect_list() function is equivalent to collect(). |
|
The count() function returns the count of a set of values. |
|
The max() function returns the maximum value in a set of values. |
|
The min() function returns the minimum value in a set of values. |
|
The sum() function returns the sum of a set of values. |
|
The stddev_pop() function returns the population standard deviation of a set of values. |
|
The stddev_samp() function returns the sample standard deviation of a set of values. |
|
The percentile_cont() function takes a percentile between 0 and 1 and returns the interpolated value at the position corresponding to that percentile in a sorted set of values. |
|
The percentile_disc() function takes a percentile between 0 and 1 and returns the actual value closest to the specified percentile in a sorted set of values, rather than an interpolated value. |
|
The any_value() function returns an arbitrary value from a set of values. |
For more information about aggregate expressions, see Aggregate Expressions.
String Functions¶
| Statement | Description |
|---|---|
|
The substring() function returns a substring of a string.
|
|
The fmt() function formats the specified values and inserts them into placeholders in a string.
|
|
The left() function returns the leftmost characters of a string with the specified length. |
|
The right() function returns the rightmost characters of a string with the specified length. |
|
The upper() function converts all characters in a string to uppercase. |
|
The lower() function converts all characters in a string to lowercase. |
|
The trim() function returns the string with the specified characters removed from the left, right, or both sides. |
|
The ltrim() function returns the string with the specified characters removed from the left. |
|
The rtrim() function returns the string with the specified characters removed from the right. |
|
The length() function returns the number of characters in a string. |
|
The contains() function returns true if the specified substring is found in the string. |
|
The like() function returns true if the string matches the specified pattern. |
|
The regexp_like() function returns true if the string matches the specified regular expression. |
|
The split() function splits a string into a list of substrings using the specified regular expression as the delimiter. |
|
The md5() function returns the MD5 hash of a string. |
|
The index_of() function returns the starting position of the first occurrence of the specified substring in the target string. |
|
The indexes_of() function returns a list of all starting positions of the specified substring in the target string. |
|
The to_literal() function returns the string representation of the input value. |
Temporal Functions¶
| Statement | Description |
|---|---|
|
The date() function parses a string into a date. |
|
The local_datetime() function parses a string into a local datetime. |
|
The zoned_datetime() function parses a string into a zoned datetime and returns a datetime with the session time zone. |
|
The zoned_time() function parses a string into a zoned time and returns a time with the session time zone. |
|
The local_time() function parses a string into a local time. |
|
CURRENT_TIME is a keyword-style zero-argument function that returns the current zoned time in the session time zone. |
|
CURRENT_TIMESTAMP is a keyword-style zero-argument function that returns the current zoned datetime in the session time zone. |
|
The from_epoch() function converts a microsecond-level Unix timestamp to a zoned datetime. |
|
The to_epoch() function converts a zoned datetime to a microsecond-level Unix timestamp. |
|
The duration() function parses a map value into a duration and returns a string in the ISO 8601 format P[nY][nM][nD]T[nH][nM][fS]. |
|
The duration_between() function calculates the duration between two time points and returns the duration as a string. |
Operations Between Time Points and Durations¶
| Statement | Description |
|---|---|
|
Adds a duration to a date. |
|
Subtracts a duration from a date. |
|
Subtracts a duration (less than one day) from a local datetime. |
|
Subtracts a duration (greater than one day) from a local datetime. |
List Functions¶
| Statement | Description |
|---|---|
|
The length() function returns the number of elements in a list. |
|
The cardinality() function returns the number of elements in a list or record. |
|
The head() function returns the first element of a list. |
|
The tail() function removes the first element from a list. |
|
The back() function returns the last element of a list. |
|
The range() function returns a list of integers from the start value to the end value, where the difference between any two consecutive values, called the step, is a constant. |
|
The list_slice() function returns a slice of a list from the start value to the end value. |
|
The trim() function returns the list after removing the specified number of elements from the end. |
|
The zip() function pairs the elements at corresponding positions in two lists into sub-lists and then combines these sub-lists into a new list. |
|
The list_distinct() function removes duplicate values from the input list and returns a new list. |
|
The list_except() function returns a list of elements that exist in list x but not in list y, with duplicates removed from the result. |
|
The list_intersect() function returns a list of elements that are the intersection of list x and list y, with duplicates removed from the result. |
|
The list_join() function joins the elements of the input list using the specified delimiter, with an optional string to replace NULL values in the list. |
|
The list_max() function returns the maximum value in the input list. If the list contains NULL values, it returns NULL. |
|
The list_min() function returns the minimum value in the input list. If the list contains NULL values, it returns NULL. |
|
The list_union() function returns a list of elements that are the union of list x and list y, with duplicates removed from the result. |
|
The list_sort() function returns the list sorted in ascending order. |
|
The list_sum() function returns the sum of all non-NULL elements in the list. If there are no non-NULL elements in the list, it returns 0.0. |
|
The remove_nulls() function removes all NULL values from the input list. |
Table Functions¶
| Statement | Description |
|---|---|
|
Splits a table and counts the total number of rows. |
|
Splits a table by the specified size. |
|
Iterates over rows in the sub-tables. |
Set Functions¶
| Statement | Description |
|---|---|
|
The set_append() function appends a new element to an existing set. |
|
The set_union() function returns the union of two sets. |
|
The set_intersect() function returns the intersection of two sets. |
|
The set_except() function returns the difference of two sets. |
|
The set_sum() function returns the sum of numeric elements in a set. |
|
The set_max() function returns the maximum value in a set. |
|
The set_min() function returns the minimum value in a set. |
|
The set_filter() function returns a new set containing elements that satisfy the predicate condition. |
|
The set_remove() function removes the specified element from a set. |
|
The remove_nulls() function removes NULL values from a set. |
Map Functions¶
| Statement | Description |
|---|---|
|
The map_append() function appends a new key-value pair to an existing map. |
|
The map_replace() function replaces the value of the specified key in a map. |
|
The element_at() function returns the value of the specified key in a map. |
|
The map_keys() function returns all keys in a map. |
|
The map_values() function returns all values in a map. |
|
The map_union() function returns the union of two maps. |
|
The map_intersect() function returns the intersection of two maps. |
|
The map_except() function returns the difference of two maps. |
|
The map_filter() function returns a new map containing key-value pairs that satisfy the predicate condition. |
|
The map_remove() function removes the key-value pair with the specified key from a map. |
|
The remove_nulls() function removes key-value pairs where both the key and value are NULL from a map. |
Graph Functions¶
| Statement | Description |
|---|---|
|
The element_id() function returns the unique identifier of a node in the graph. |
|
The multiedge_id() function returns a unique identifier for distinguishing a specific parallel edge based on its multi-edge key. If there are no parallel edges, it returns 0. |
|
The left_node_id() function returns the unique identifier of the left node of the specified edge in a given path. |
|
The right_node_id() function returns the unique identifier of the right node of the specified edge in a given path. |
|
The nodes() function returns all nodes in a path as a list. |
|
The edges() or relationships() function returns all edges in a path as a list. |
|
The length() function returns the length of a path. |
|
The cardinality() function returns the number of elements in a path. |
|
The labels() function returns all labels of a graph element. |
|
The all_different() function returns true if all graph elements in the list are distinct from each other. Otherwise, it returns false. |
|
The same() function returns true if all graph elements in the list are the same. Otherwise, it returns false. |
|
The type() function returns the name of the element type to which a graph element belongs. |
Lambda Functions¶
| Statement | Description |
|---|---|
|
The transform() function takes a list and a lambda expression and returns a new list with the transformation applied. |
|
The filter() function takes a list and a lambda expression and returns a new list containing only the elements from the original list that satisfy the lambda expression. |
|
The reduce() function applies a lambda expression to each element in a list for cumulative computation and returns a single value. |
For more information about lambda expressions, see Lambda Expressions.
Vector Functions¶
| Statement | Description |
|---|---|
|
The euclidean() function returns the Euclidean distance between two vectors. |
|
The inner_product() function returns the inner product of two vectors. |
|
The cosine() function returns the cosine similarity between two vectors. |
|
The abs() function returns a vector where each element is the absolute value of the corresponding element in the given vector. |
|
The abs2() function returns a vector where each element is the square of the corresponding element in the given vector. |
|
The sqrt() function returns a vector where each element is the square root of the corresponding element in the given vector. |
|
The ln() function returns a vector where each element is the natural logarithm (base e) of the corresponding element in the given vector. |
|
The log10() function returns a vector where each element is the base-10 logarithm of the corresponding element in the given vector. |
|
The exp() function returns a vector where each element is e raised to the power of the corresponding element in the given vector. |
|
The normalize() function returns a normalized vector, adjusting the vector length to 1 while preserving the original direction. |
|
The accum() function returns the sum of all elements in the given vector. |
|
The mean() function returns the average of all elements in the given vector. |
|
The prod() function returns the product of all elements in the given vector. |
|
The norm() function returns the Euclidean norm of the given vector. |
|
The squared_norm() function returns the squared Euclidean norm of the given vector. |
Vector Arithmetic Operations¶
| Statement | Description |
|---|---|
|
Addition between vectors. |
|
Subtraction between vectors. |
|
Addition of a vector and a number. |
|
Subtraction of a number from a vector. |
|
Multiplication of a vector and a number. |
|
Division of a vector by a number. |
Geospatial Functions¶
| Statement | Description |
|---|---|
|
The ST_Point() function returns a Point based on the given longitude and latitude. |
|
The ST_GeogFromText() / ST_GeogFromWKT() function returns the geospatial value corresponding to the given WKT string. |
|
The ST_ASText() function returns the WKT string corresponding to a geospatial value. |
|
The ST_Centroid() function returns the centroid of a geospatial value, i.e., the geometric center of the shape. |
|
The ST_ISValid() function returns true if the given geospatial value is valid; otherwise, it returns false. |
|
The ST_Intersects() function returns true if the two given geospatial values intersect (share at least one common point); otherwise, it returns false. |
|
The ST_IntersectionPoints() function returns a list of intersection points of the boundaries of two geospatial values. |
|
Given two geospatial values g1 and g2, the ST_Covers(g1, g2) function returns true if g1 completely contains g2 (i.e., all points of g2 lie on the interior or boundary of g1); otherwise, it returns false. |
|
Given two geospatial values g1 and g2, the ST_CoveredBy(g1, g2) function returns true if g2 completely contains g1 (i.e., all points of g1 lie on the interior or boundary of g2); otherwise, it returns false. |
|
The ST_DWithin() function returns true if the distance between at least one point in geospatial value g1 and at least one point in g2 is less than or equal to the given distance threshold; otherwise, it returns false. |
|
The ST_Distance() function returns the shortest distance (in meters) between two geospatial values. |
|
The S2_CellIdFromPoint() function returns the S2 cell ID covering a Point. |
|
The S2_CoveringCellIds() function returns a list of S2 cell IDs covering a geospatial value. |
Full-Text Index Functions¶
| Statement | Description |
|---|---|
|
The ftscore() function returns the relevance score between the STRING value stored in the indexed property and the given query string. |
System Information Functions¶
| Statement | Description |
|---|---|
|
The typeof() function returns the input value type and supports ordinary value types, graph element reference types, and table types. |
Value Expressions¶
Aggregate Expressions¶
| Statement | Description |
|---|---|
|
Calculates the count of distinct values and the sum of all values. |
|
Returns all ratings and the average rating for a movie. |
For more information about aggregate functions, see Aggregate Functions.
Variable Expressions¶
| Statement | Description |
|---|---|
|
Defines variables and returns them. |
|
Returns node variables and edge variables. |
Conditional Expressions¶
| Statement | Description |
|---|---|
|
Returns different values based on conditions. |
|
Returns the first non-NULL value using the coalesce function. |
Constant Expressions¶
| Statement | Description |
|---|---|
|
Returns constant values of different types. |
Construct Expression¶
| Statement | Description |
|---|---|
|
Constructs a list. |
|
Constructs a record. |
Function Expressions¶
| Statement | Description |
|---|---|
|
Calls a function with multiple arguments. |
|
Calls multiple functions. |
|
Calls a function with no arguments. |
For the complete list of functions, see Functions.
Logical Expressions¶
| Statement | Description |
|---|---|
|
Returns the result of a logical OR. |
|
Returns the result of a logical AND. |
Property Expressions¶
| Statement | Description |
|---|---|
|
Gets a field of a record. |
|
Gets the properties of a node and an edge. |
Subquery Expressions¶
| Statement | Description |
|---|---|
|
Returns a single value from a subquery. |
|
Returns a boolean value from a subquery. |
Type Cast Expressions¶
| Statement | Description |
|---|---|
|
Converts a temporal value to a string. |
|
Converts a null value to an integer of type INT16. |
|
Converts decimals in a list to integers of type INT8. |
|
Converts a record of decimals to a record of integers of type INT32. |
Lambda Expressions¶
| Statement | Description |
|---|---|
|
Applies the transform() lambda function to a list. |
|
Applies the filter() lambda function to a list. |
|
Applies the reduce() lambda function to a list. |
For more information about lambda functions, see Lambda Functions.
Predicates¶
Comparison Predicates¶
| Statement | Description |
|---|---|
|
Compares strings. String comparison is based on the UCA algorithm. |
|
Compares boolean values. Boolean comparison is based on the rule that true is greater than false.
|
|
Compares null values. Any comparison with a null value returns null.
|
|
Compares two lists. The comparison returns true if the two lists have the same elements in the same order; otherwise, it returns false.
|
|
Compares time point values. Comparison of time point values is based on chronological order. |
|
Compares duration values. Comparison of duration values is based on duration length. |
|
Compares the field names and values of two records. The comparison returns true if the two records have the same fields and the same field values; otherwise, it returns false.
|
|
Compares two graph elements for equality. The comparison returns true if the two graph elements are the same; otherwise, it returns false.
|
|
Compares two paths for equality. The comparison returns true if the two paths are the same; otherwise, it returns false.
|
EXISTS Predicate¶
| Statement | Description |
|---|---|
|
Checks whether a node pattern exists. |
|
Checks whether an edge pattern exists. |
|
Checks whether a subgraph match is successful. |
NULL Predicate¶
| Statement | Description |
|---|---|
|
Checks whether a value is null.
|
Label Predicates¶
| Statement | Description |
|---|---|
|
Uses IS LABELED to check whether a graph element has a specific label.
|
|
Uses the colon : to check whether a graph element has a specific label.
|
|
Uses IS NOT LABELED to check whether a graph element does not have a specific label.
|
ALL_DIFFERENT Predicate¶
| Statement | Description |
|---|---|
|
Checks whether all graph elements in a list are pairwise distinct. |
SAME Predicate¶
| Statement | Description |
|---|---|
|
Checks whether all graph elements in a list are the same. |
Performance Tuning¶
| Statement | Description |
|---|---|
|
Specifies the option format = "default" to view the optimized execution plan. |
|
Specifies raw to view the unoptimized logical plan. |
|
Specifies the option format = "verbose" to view the detailed optimized execution plan. |
|
Specifies raw and format = "verbose" to view the detailed unoptimized logical plan. |
|
Executes the query and specifies the option format = "default" to view the optimized execution plan. |
|
Executes the query and specifies the option format = "verbose" to view the detailed optimized execution plan. |
Database Administration¶
SHOW¶
| Command | Description |
|---|---|
|
Shows all roles in the current service group. |
|
Shows information about all indexes in the schema of the current session. |
|
Shows all warnings generated by executing GQL statements in the current service group. |
|
Shows all runtime configuration items of the Graph service in the current session. |
|
Shows all runtime configuration items of the specified Storage service in the current session. |
|
Shows the specified runtime configuration item of the connected Graph service in the current session. |
|
Shows the specified runtime configuration item of the specified Storage service. |
|
Shows the statement used to create a specific graph. |
|
Shows the statement used to create a specific graph type. |
|
Shows the statement used to create a specific procedure. |
|
Shows the home schema of the current session. |
|
Shows the session created by the current user. |
|
Shows the date and time formats in the current session. |
|
Shows information about the graph or temporary graph in the current session. |
|
Shows information about the logged-in user of the current session. |
|
Returns the configuration items set for all Graph services in the service group using GLOBAL SET or GLOBAL RESET. |
|
Returns the configuration items set for all Storage services in the service group using GLOBAL SET or GLOBAL RESET. |
|
Shows all functions in the current catalog. |
|
Shows only the functions in the current catalog that match the specified function name. |
|
Shows all graphs in the current catalog. |
|
Shows all graph types in the current catalog. |
|
Shows the indexes created in the specified graph in the current catalog. |
|
Shows all running jobs in the current service group. |
|
Shows a specific job in the current service group. |
|
Shows information about the leader replicas on all Storage services in the current service group. |
|
Shows information about the resource objects owned by the current user. |
|
Shows information about the resource objects owned by a specific user. |
|
Shows all user-defined parameters in the current session. |
|
Shows all partitions on the Storage services in the current service group. |
|
Shows detailed information about the replicas of all partitions on the Storage services in the current service group. |
|
Shows detailed information about all leader replicas on the Storage services in the current service group. |
|
Shows all plugins loaded in the current catalog. |
|
Shows information about a specific plugin loaded in the current catalog. |
|
Shows the privileges granted to a specific user. |
|
Shows the privileges contained in a specific role. |
|
Shows all named procedures in the current catalog. |
|
Shows information about a specific named procedure in the current catalog. |
|
Shows all running queries on the Graph services in the current service group. |
|
Shows the roles granted to the current user. |
|
Shows the roles granted to a specific user. |
|
Shows all schemas in the current catalog. |
|
Shows all services in the current service group. |
|
Shows the configuration items set for the currently connected Graph service. |
|
Shows the configuration items set for the specified Storage service. |
|
Shows information about the service group to which the currently connected Graph service belongs. |
|
Shows information about the Meta services in the current service group. |
|
Shows all active sessions on the Graph services in the current service group. |
|
Shows all configuration items set for the currently connected session using SESSION SET or SESSION RESET. |
|
Shows the statistics of the specified graph. |
|
Shows the TTL settings of a specific graph. |
|
Shows the version information of the currently installed NebulaGraph Database Developer Edition. |
|
Shows the detailed version information of the currently installed NebulaGraph Database Developer Edition. |
|
Shows all users invited to join the current service group. |
|
Shows the warnings generated by the last GQL statement in the current session. |
DESCRIBE¶
| Command | Description |
|---|---|
|
Views graph information. |
|
Views graph type information. |
|
Views node type information. |
|
Views edge type information. |
KILL¶
| Command | Description |
|---|---|
|
Terminates a query. |
|
Terminates a session. |
CLEAR¶
| Command | Description |
|---|---|
|
Clears specific warnings generated by executing GQL statements in the current service group. |
|
Clears all warnings generated by executing GQL statements in the current service group. |
Sessions¶
| Command | Description |
|---|---|
|
Sets a session configuration item. |
|
Sets parameters for the current session. |
|
Unsets the time zone setting in the current session. |
|
Resets a session configuration item. |
|
Deletes the specified session parameters. |
|
Closes the current session. |
|
Shows the session created by the current user. |
|
Shows the date and time formats in the current session. |
|
Shows all active sessions on the Graph services in the current service group. |