Conditional Steps
Filter and conditionally select elements in your graph. These operations allow you to filter and select specific elements from your graph based on conditions.
WHERE
Filter elements based on specific conditions.
The condition in the WHERE
step must evaluate to a boolean value.
If the condition is not met, the element will be filtered out.
Example:
Comparison Operations
The following operations can be used to compare values.
String, Boolean, and Number Operations
Operation | Description | Example |
---|---|---|
::EQ(value) | Equals | ::WHERE(_::{status}::EQ("active")) |
::NEQ(value) | Not equals | ::WHERE(_::{age}::NEQ(25)) |
Number Operations
Operation | Description | Example |
---|---|---|
::GT(value) | Greater than | ::WHERE(_::{age}::GT(21)) |
::LT(value) | Less than | ::WHERE(_::{age}::LT(21)) |
::GTE(value) | Greater than or equal to | ::WHERE(_::{age}::GTE(21)) |
::LTE(value) | Less than or equal to | ::WHERE(_::{age}::LTE(21)) |
EXISTS
Returns true if a traversal has any results. Otherwise, it returns false.
Example:
Multiple filter conditions
In the case where you want to filter by multiple conditions, you can use the AND and OR operations to chain the conditions together.
Both AND
and OR
take a list of expressions that evaluate to a boolean value.
AND
and OR
will return a boolean value themselves.
AND
OR
AND Example:
OR Example:
AND & OR Example: