Overview
Logical expressions describe conditions that return true or false. They are used to control inclusion, matching, or branching logic across datasets. These expressions include basic comparisons, set membership, and pattern matching, as well as operators like $and, $or, and $not for combining multiple checks into structured conditions.
Logical Operators
Logical operators take one or more subexpressions and evaluate them to a boolean result. Each logical expression object must contain only one operator key.
Usage
- Only one key is allowed per logical expression (
$and,$or,$xor,$not) - Operators can be nested to express complex conditional logic
- Inputs must be valid logical expressions or predicate objects
$and
Added in: indicate.dsl.dql@1.0.0
Evaluates to TRUE only if all child expressions are TRUE.
{
"$and": [ Object ( LogicalExpression ) ]
}
$or
Added in: indicate.dsl.dql@1.0.0
Evaluates to TRUE if at least one child expression is TRUE.
{
"$or": [ Object ( LogicalExpression ) ]
}
$xor
Added in: indicate.dsl.dql@1.0.0
Evaluates to TRUE if exactly one child expression is TRUE.
{
"$xor": [ LogicalExpression, ... ]
}
$not
Added in: indicate.dsl.dql@1.0.0
Negates a single logical expression or predicate.
{
"$not": Object ( LogicalExpression )
}
Example: using
$and
- JSON
- SQL
{
"$and": [
{
"$eq": {
"$left": [
{
"$col": {
"$name": "connection_id",
"$table": "t1"
}
}
],
"$right": [
{
"$var": 1234567890
}
]
}
}
]
}
t1.connection_id = 1234567890
$and with $or
- JSON
- SQL
{
"$and": [
{
"$eq": {
"$left": [
{
"$col": { "$name": "connection_id" }
}
],
"$right": [
{
"$var": 1
}
]
}
},
{
"$or": [
{
"$eq": {
"$left": [
{
"$col": { "$name": "status" }
}
],
"$right": [
{
"$var": "active"
}
]
}
},
{
"$eq": {
"$left": [
{
"$col": { "$name": "status" }
}
],
"$right": [
{
"$var": "paused"
}
]
}
}
]
}
]
}
connection_id = 1
AND (
status = 'active'
OR status = 'paused'
)