GQL supports various values and types to represent data within the graph database. Understanding these values and types is essential for effective query construction and data manipulation.
Graph Element Types
Graph element types consist of node types and edge types, which are the data types of nodes and edges respectively.
Type | Description |
---|---|
NODE |
Represents the node type, which includes a label and a property type set associated with that label. E.g., NODE User (:User {name string, gender string}) specifies a node type named User with a label :User and properties name and gender . |
EDGE |
Represents the edge type, which includes a label and a property type set associated with that label. E.g., EDGE WorkIn ()-[:WorkIn {startOn datetime}]->() specifies an edge type named WorkIn with the label :WorkIn and a property startOn . |
Property Value Types
A property value type refers to the data type of the values of a property. Ultipa supports the following property value types:
Category | Type | Description | Notes |
---|---|---|---|
Numeric | INT32 |
32-bit signed integer. | Range: -2,147,483,648 to 2,147,483,647 |
UINT32 |
32-bit unsigned integer. | Range: 0 to 4,294,967,295 |
|
INT64 |
64-bit signed integer. | Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
|
UINT64 |
64-bit unsigned integer. | Range: 0 to 18,446,744,073,709,551,615 |
|
FLOAT |
32-bit single-precision floating-point number. | Includes 6 to 7 significant digits (integer and fractional parts, excl. the decimal point). | |
DOUBLE |
64-bit double-precision floating-point number. | Includes 15 to 16 significant digits (integer and fractional parts, excl. the decimal point). | |
DECIMAL |
A number with user-defined precision (1 to 65 ) and scale (0 to 30 ). E.g., DECIMAL(10,4) represents a number with a precision up to 10 and a scale up to 4. |
The precision is the total number of digits (excl. the decimal point), while the scale is the number of digits after the decimal point. | |
Textual | STRING |
A sequence of characters. | The maximum length is 60,000 bytes. This is the default value type when creating a property. |
TEXT |
A sequence of characters. | No length limitation. | |
Temporal Instant | DATE |
An instant date value without any timezone information. E.g., 2025-01-01 , 20250101 . |
The provided date must follow the yyyy-mm-dd or yyyymmdd format. The valid range falls between -9999-12-31 and 9999-12-31 .The provided time must follow the hh:mm:ss[.fraction] or hhmmss[.fraction] format. The valid range falls between 00:00:00.000000000 and 23:59:59.999999999 .The date and time parts are joined by either a space or the letter T . The valid range falls between -9999-01-01 00:00:00.000000000 and 9999-12-31 23:59:59.999999999 .The time zone follows the standard UTC offset range from UTC-15:00 to UTC+15:00 . The provided time zone offset must follow the ±hh:mm or ±hhmm format. The time and time zone parted are joined directly. |
LOCAL DATETIME |
An instant date-time value without any timezone information. E.g., 2025-01-01 12:20:02 , 20250101T122002.55254 . |
||
LOCAL TIME |
An instant time value without any timezone information. E.g., 12:20:02 , 122002.55254 . |
||
ZONED DATETIME |
An instant date-time value that includes timezone information. E.g., 2025-01-01 12:20:02-1030 , 20250101T122002.55254+0900 . |
||
ZONED TIME |
An instant time value that includes timezone information. E.g., 12:20:02-1030 , 122002.55254+0900 . |
||
DATETIME |
An instant date-time value without any timezone information. | ||
TIMESTAMP |
A specific point in time, measured in seconds since 1970-01-01 00:00:00 (UTC). |
If the provided value is in the date or date-time format, it is converted to a timestamp based on the local timezone or the timezone configured via the client or SDK. Likewise, when a timestamp is displayed in date-time format, it is converted using the configured time zone. | |
Temporal Duration | DURATION(YEAR TO MONTH) |
A time duration measured in years and months only. E.g., P2Y5M (2 years and 5 months), -P1Y2M (minus 1 year and 2 months). |
The provided value must follow the unit-based format [-]P[nY][nM] . The valid range is -P178956969Y12M to P178956969Y12M . |
DURATION(DAY TO SECOND) |
A time duration measured in days, hours, minutes, seconds, and optional fractional seconds. E.g., P3DT4H (3 days and 4 hours), -P1DT2H3M4.12S (minus 1 day, 2 hours, 3 minutes, and 4.12 seconds). |
The provided value must follow the unit-based format P[nD][T[nH][nM][nS]] (the letter T is required to join the day and time components). The valid range is -P106750DT23H59M59.999999999S to P106750DT23H59M59.999999999S . |
|
Boolean | BOOL |
Represents two possible values:
|
|
Spatial | POINT |
A two-dimensional geographical coordinate that indicate a specific position. | The coordinate values are stored as DOUBLE . |
List | LIST<subType> |
An ordered collection of elements of the specified subtype. | Supports all of the above types as subtypes, except for BOOL . |
Constructed Value Types
A constructed value type is a data type comprising composite elements. GQL defines the following constructed value types:
Type | Description |
---|---|
PATH |
Represents the path value type. A path value encapsulates nodes and edges that form a path element list[1]. A path value whose path element list comprises a single node is called the single-node path value. |
LIST |
Represents the list value type. A list value is an ordered homogenous or heterogeneous collection of elements. A list value is either a group list value or a regular list value. A group list value originates from a quantified path pattern. A regular list value is a list value that is not a group list value. |
RECORD |
Represents the record type. A record is a set of fields, each such field has a name and a value. The record with zero fields is called the unit record. |
[1] If the ordered sequence of nodes and edges in a path element list forms a path, then the sequence is said to identify a path.
Result Types
A result type refers to the data type of the values returned by a query. Ultipa defines the following result types.

RESULT_TYPE_NODE
This query returns all nodes labeled Paper
bound to the variable n
:
MATCH (n:Paper) RETURN n
Data structure of n
:
{
"data": [
{
"id": "P2",
"uuid": "8718971077612535835",
"schema": "Paper",
"values": {
"title": "Optimizing Queries",
"score": 9
}
},
{
"id": "P1",
"uuid": "8791028671650463770",
"schema": "Paper",
"values": {
"title": "Efficient Graph Search",
"score": 6
}
}
],
"alias": "n",
"type": 2,
"type_desc": "RESULT_TYPE_NODE"
}
RESULT_TYPE_EDGE
This query returns all outgoing edges labeled Cites
bound to the variable e
:
MATCH ()-[e:Cites]->() RETURN e
Data structure of e
:
{
"data": [
{
"from": "P1",
"to": "P2",
"uuid": "1",
"from_uuid": "8791028671650463770",
"to_uuid": "8718971077612535835",
"schema": "Cites",
"values": {
"weight": 2
}
}
],
"alias": "e",
"type": 3,
"type_desc": "RESULT_TYPE_EDGE"
}
RESULT_TYPE_PATH
This query returns all outgoing 1-step paths bound to the variable p
:
MATCH p = ()-[]->() RETURN p
Data structure of p
:
{
"data": [
{
"nodes": [
{
"id": "P1",
"uuid": "8791028671650463770",
"schema": "Paper",
"values": {
"title": "Efficient Graph Search",
"score": 6
}
},
{
"id": "P2",
"uuid": "8718971077612535835",
"schema": "Paper",
"values": {
"title": "Optimizing Queries",
"score": 9
}
}
],
"edges": [
{
"from": "P1",
"to": "P2",
"uuid": "1",
"from_uuid": "8791028671650463770",
"to_uuid": "8718971077612535835",
"schema": "Cites",
"values": {
"weight": 2
}
}
],
"length": 1
}
],
"alias": "p",
"type": 1,
"type_desc": "RESULT_TYPE_PATH"
}
RESULT_TYPE_ATTR
This query returns the title
property of nodes labeled Paper
:
MATCH (n:Paper) RETURN n.title
Data structure of n.title
:
{
"data": {
"alias": "n.title",
"type": 4,
"type_desc": "RESULT_TYPE_ATTR",
"values": [
"Optimizing Queries",
"Efficient Graph Search"
]
},
"alias": "n.title",
"type": 4,
"type_desc": "RESULT_TYPE_ATTR"
}
RESULT_TYPE_TABLE
This query returns a table bound to the variable table
:
MATCH (n:Paper) RETURN table(n.title, n.score) AS table
Data structure of table
:
{
"data": {
"name": "table",
"alias": "table",
"headers": [
"n.title",
"n.score"
],
"rows": [
[
"Optimizing Queries",
"9"
],
[
"Efficient Graph Search",
"6"
]
]
},
"alias": "table",
"type": 5,
"type_desc": "RESULT_TYPE_TABLE"
}
Null Value
The null
value is a special value available in all nullable types. Any non-null value is a material value.
Null Scenarios
The null
values can arise in various contexts, including:
- Default Assignment: When nodes or edges are inserted, nullable properties that lack specified values automatically receive
null
. - Explicit Null Specification: During node or edge insertion, nullable properties can be intentionally set to
null
. - Value Removal: Removing a property’s value sets it to
null
. - New Property Assignment: When adding a new property to a label, any existing nodes or edges with that label are assigned
null
for the new property by default. - Nonexistent Property References: Referencing a property that does not exist returns
null
. - Optional Matching: When the
OPTIONAL
keyword is used with theMATCH
statement, if no result is found for the pattern,MATCH
yieldsnull
instead of empty return. - NULLIF Expression: The
NULLIF
expression returnsnull
if the two compared values are equal.
Null in Comparisons
The null
value is not comparable to any other value due to its inherently unknown nature. Consequently, comparisons involving null
using normal operators such as =
or <>
do not typically yield true or false but rather an unknown result, also represented by null
.
Example | Result |
---|---|
RETURN null = null |
null |
RETURN null > 3 |
null |
RETURN [1,null,2] <> [1,null,2] |
null |
RETURN 3 IN [1,null,2] |
null |
RETURN null IN [1,2] |
null |
RETURN null IN [] |
0 |
Comparisons involving null
require special handling with null predicates (IS NULL
and IS NOT NULL
).
Example | Result |
---|---|
RETURN null IS NULL |
1 |
RETURN null IS NOT NULL |
0 |
Null Treatments
The null
values receive special treatment in some contexts. For instance:
- Aggregate functions typically ignore
null
values. - The
GROUP BY
clause groups allnull
values together. - The
ORDER BY
statement allows for null ordering using theNULLS FIRST
andNULL LAST
keywords.