Query Language
Expressions
SCQL expressions are constructed using JSON objects. Below is an example:
{ "$and": [{"direction": {"$eq": "North"}}, {"speed": {"$gt": 25}}]}These expressions are applied to JSON object inputs that describe the state of a device to be evaluated. An example input could look like:
{
"direction": "North",
"speed": 30,
"mode": "drive",
"embeddings": [0.43, 0.67, ...],
}AND Expressions
An AND expression is a conjunction of conditions on fields. An AND expression is a JSON of the form:
{ "$and": [Condition1, Condition2, ...] }For example, to identify when a vehicle is traveling north and in drive mode:
{ "$and": [{"direction": {"$eq": "North"}}, {"mode": {"$eq": "drive"}}]}OR Expressions
An OR expression is a disjunction of conditions:
{ "$or": [Condition1, Condition2, ...] }For example, to identify when a vehicle is traveling faster than 25 miles per hour or is traveling south:
{ "$or": [{"speed": {"$gt": 25}}, {"direction": {"$eq": "South"}}]}NOT Expressions
The not operator negates the value of a condition or expression. For example:
{ "$not": {"location": {"$eq": "San Francisco"}}}Conditions
A condition on a field is a predicate that can perform the following operations:
"$eq" Equal to
"$neq" Not equal to
"$gt" Greater than
"$gte" Greater than or equal to
"$lt" Less than
"$lte" Less than or equal to
"$in" In
These operations are done between a field in the input state and a constant value.
For example, to trigger when the speed is greater than 25 miles per hour:
{"speed": {"$gt": 25}}Or to trigger when the direction is north or south:
{"direction": {"$in": ["North", "South"]}}Auto Tags
Autotags are a special condition in Nucleus can be used as operators in the following format:
{"field": {"$autotag": [<autotag id (str)>, <threshold (float)>]}}For example, the following predicate identifies if the feature embeddings of an image score above a 0.5 for autotag “tag_1”:
{"embeddings": {"$autotag": ["tag_1", 0.5]}}Example Queries
Capturing low confidence predictions
{"model_confidence": {"$lt": 0.91}}
When many objects are in the scene
{"model_objects_detected": {"$gt": 15}}
Using an Auto-Tag to detect pedestrians
{"embeddings": {"$autotag": ["tag_cach81rw3w5g05r1kvwg", -0.5]}}Updated 10 months ago