HQL syntax relationships and operators

Ops Center Analyzer REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA003-18

HQL is a query language that can filter collections of data by using various query parameters, including $query and supported operators.

Use UTF-8 encoding and encode characters and symbols that cannot be expressed as a URL.

Syntax

To define a collection of a resource request, use the following expressions:

expression ::= "(" expression ")" | binary-expression | expression junction expression
junction ::= ( "and" | "or" )
 
binary-expression ::= (compare-expression | tuple-expression)
 
compare-expression ::= name-expression compare-operation value-expression
 
name-expression ::= property-name | "[" property-name "]"
compare-operation ::= ( "eq" | "=" | "ne" | "<>" | "!=" | "gt" | ">" | "lt" | "<" | "ge" |">=" | "le" |"<=" | "starts" | "ends" )
value-expression ::= ( string-expression | number-expression | boolean-expression )
 
string-expression ::= "'" ([^'] | [']{2})* "'"
number-expression::= ( "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" )+
boolean-expression::= "true" | "false" |"TRUE" | "FALSE"
 
tuple-expression ::= name-expression tuple-operation tuple-value-expression
 
tuple-value-expression ::= "[" value-expression ("," value-expression)* "]"
 
tuple-operation ::= ( "in" | "not in" )

property-name is an attribute defined in a resource.

value-expression displays a string expression, number expression, or Boolean expression. This value is different from the actual data type of the attribute defined in a resource. The "ISO8601String" type, for example, is dealt with as a string in ISO 8601 format. As a result, it displays as a string-expression.

The following table describes the relationship between the data types and expression formats:

Type

Expression

int/long/float

number-expression

enum

string-expression

String

string-expression

ISO8601String

string-expression

URLString

string-expression

boolean

boolean-expression

The following table lists and describes the operators supported by HQL in priority as indicated in the Priority column.

Operator

Description

Expression

Priority (1-3)

eq

Equal

number-expression,

string-expression (string, enum),

boolean-expression

1

ne

Not equal

number-expression,

string-expression (string, enum),

boolean-expression

1

gt

Greater than

number-expression,

string-expression (string, enum),

1

lt

Smaller than

number-expression,

string-expression (string, enum),

1

ge

Equal or greater than

number-expression,

string-expression (string, enum),

1

le

Equal or smaller than

number-expression,

string-expression (string, enum),

1

starts#

Start value

string-expression (string, excluding ISO8601String)

1

ends#

End value

string-expression (string, excluding ISO8601String)

1

likes#

Included

string-expression (string, excluding ISO8601String)

1

in

Included

number-expression,

string-expression (string, enum),

boolean-expression

1

not in

Not included

number-expression,

string-expression (string, enum),

boolean-expression

1

and

Both true

compare-expression, tuple-expression

2

or

Either of them true

compare-expression, tuple-expression

3

# The operator name is not case sensitive.

Example:

Before URL encoding:

...?$query=instanceID in [1000,1001,1002] and status eq 'Warning'

After URL encoding:

...?$query=instanceID%20in%20%5b1000%2c1001%2c1002%5d%20and%20status%20eq%20%27Warning%27