Boolean types¶
The boolean type is declared with the BOOL or BOOLEAN keyword and can be set to the following values: TRUE, FALSE, and UNKNOWN (equals NULL, indicating the unknown truth value).
Declaration example¶
'''
CREATE GRAPH TYPE IF NOT EXISTS person AS
{ NODE Person
( {
id INT64 PRIMARY KEY,
is_adult BOOL DEFAULT TRUE,
name STRING DEFAULT 'John Doe',
hobbies LIST<STRING> DEFAULT ['reading', 'swimming'],
birthday DATE DEFAULT DATE('1990-01-01')
} )
}
'''
In the preceding example, the property is_adult is of the boolean type (BOOL) with a default value of TRUE.
Predicates¶
A predicate is a logical expression for filtering data in queries. It specifies a condition that evaluates to a boolean value. The following predicates are supported in GQL: