Hitachi

JP1 Version 12 JP1/Automatic Operation Command and API Reference 


2.2.11 Using HQL standard

By specifying HQL (Hitachi Query Language) for HQL::filter, you can filter the target data. A collection refers to data to be filtered.

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

Format

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 a member name defined in a resource.

value-expression displays whether the expression is a string expression, number expression, or Boolean expression. This value is different from the actual data type of the member defined in a resource.

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

Table 2‒17: Relationship between data types and expression formats

Data type

Expression format

integer/long

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 preferential order.

Table 2‒18: Operators supported by HQL

Operator

Description

Specifiable data type

Priority

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

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 operators are not case sensitive.

Usage example

The example below filters the specified line. If you want to specify a character string that cannot be expressed as a URL, use UTF-8 encoding and encode the character string.

Before URL encoding:

...?HQL::filter=instanceID in [1000,1001,1002] and status = 'running'

After URL encoding:

...?HQL::filter=instanceID%20in%20%5b1000%2c1001%2c1002%5d%20and%20status%20%3d%20%27running%27