Skip to main content

Data Types

Identifiers

The identifiers refer to base characteristics of the objects. They are defined as unquoted ASCII alphanumeric sequences; the underscore (_) is also allowed except in the initial position.

note

Reserved words such as and, true, etc. cannot be used as identifiers.

Examples:

  • size
  • object_id
  • recursion_level
  • ctime

See Common Object Data for more examples.

Metadata Keys

Metadata keys refer to specific keys in an object's or its relation metadata, which have a form of key-value entries. The metadata key names are prefixed with $ and are only meant to be used within metadata related functions (such as has_object_meta or match_object_meta).

Examples:

  • $natural_language
  • $iso9660.bootable

Strings

The literal strings are defined as a double quote (") wrapped sequence of Unicode characters. Additionally the following escape sequences are defined (escaped -> unescaped):

  • \" -> " (mandatory escape)
  • \\ -> \ (mandatory escape)
  • \/ -> /
  • \b -> backspace U+0008
  • \f -> form feed U+000c
  • \n -> newline U+000a
  • \r -> carriage return U+000d
  • \t -> horizontal tab U+0009
  • \uNNNN -> single Unicode character NNNN
note

Whitespace is significant inside strings.

Examples:

  • "a string"
  • "another \"string\""

Integer numbers (Integer)

Numeric values are represented as sequences of ASCII digit characters, optionally preceded by a + or - sign.

Examples:

  • 1337
  • +10
  • -42

Floating point numbers (Number)

These floating point numbers are defined as:

  • integer numbers
  • integer numbers followed by a . subsequently followed by a fractional part

The fractional part is expressed as a sequence of ASCII digits optionally followed by an exponent part. The exponent part is expressed as the e letter followed by an integer number.

Examples:

  • 1
  • -123.456
  • 123.456e-7

Date and Time (DateTime)

The time functions accept dates (with optional times) as strings in the following format:

  • "YYYY-MM-DD"
  • "YYYY-MM-DD hh:mm:ss"

Examples:

  • "2024-09-26"
  • "2024-09-26 13:37:00"

Boolean values

The boolean values are either true or false.

note

The above values are both reserved words.

Constant Variables

A constant variable has a form of ${name} and can be assigned any value, and later used in functions or comparisons. The main use case for these variables is to make the query code more readable and avoid repetitions.

Examples:

${variable1} = 1234;
${variable2} = "Text";
${variable3} = pattern("contextal");
${variable4} = datetime("2025-01-01");

size > ${variable1}
&& object_type == ${variable2}
&& @match_pattern(${variable3})
&& @date_since(${variable4})