bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Building Queries and Data Views

Comparison Operators

XQuery has operators that are specific to comparisons operations. The following operators are available:

- eq

- ge

- gt

- le

- lt

- ne

eq

Returns true if Parameter1 is exactly equal to Parameter2.

Data Types

- Parameter1 data type: xsext:anyValue?

- Parameter2 data type: xsext:anyValue?

- Returned data type: xs:boolean?

Notes

This is a comparison operator that you can use as a function to compare operands.

If either operand is a node, Liquid Data extracts its typed value first, then performs a type check to ensure that the type of one operand is promotable to the other type; otherwise Liquid Data generates an error.

If either operand is an empty list, the function returns an empty list.

XQuery Specification Compliance

- Liquid Data does not cast xs:anySimpleType to any other supported type.

- Liquid Data does not support these data types: xs:yearMonthDuration, xs:dayTimeDuration, gregorian, xs:hexBinary, xs:base64Binary, xs:anyURI, xs:QName, or xs:NOTATION values.

Examples

- 45 eq 45.0 returns the boolean value true.

- 170 eq 34 returns the boolean value false.

- 3 eq "3" generates an error because the decimal value 3 cannot be promoted to the string value "3."

- 1 eq xf:true() generates an error because the decimal value 1 cannot be promoted to the boolean value true.

- "abc" eq "abc" returns the boolean value true.

- (1, ()) eq 1 evaluates to the boolean value true because there is exactly one value in the leftmost list and that value is equal to the rightmost value.

- (1, 2) eq 1 generates a compile-time error because the operator does not evaluate lists.

ge

Returns true if Parameter1 is greater than or equal to Parameter2.

Data Types

- Parameter1 data type: xsext:anyValue?

- Parameter2 data type: xsext:anyValue?

- Returned data type: xs:boolean?

Notes

This is a comparison operator that you can use as a function to compare operands.

If either operand is a node, Liquid Data extracts its typed value first, then performs a type check to ensure that the type of one operand is promotable to the other type; otherwise Liquid Data generates an error.

If either operand is an empty list, the function returns an empty list.

XQuery Specification Compliance

- Liquid Data does not cast xs:anySimpleType to any other supported type.

- Liquid Data does not support these data types: xs:yearMonthDuration, xs:dayTimeDuration, gregorian, xs:hexBinary, xs:base64Binary, xs:anyURI, xs:QName, or xs:NOTATION values.

Examples

See the examples for "eq" operator (previous entry in this table).

gt

Returns true if Parameter1 is greater than Parameter2.

Data Types

- Parameter1 data type: xsext:anyValue?

- Parameter2 data type: xsext:anyValue?

- Returned data type: xs:boolean?

Notes

This is a comparison operator that you can use as a function to compare operands.

If either operand is a node, Liquid Data extracts its typed value first, then performs a type check to ensure that the type of one operand is promotable to the other type; otherwise Liquid Data generates an error.

If either operand is an empty list, the function returns an empty list.

XQuery Specification Compliance

Liquid Data does not cast xs:anySimpleType to any other supported type.

Liquid Data does not support these data types: xs:yearMonthDuration, xs:dayTimeDuration, gregorian, xs:hexBinary, xs:base64Binary, xs:anyURI, xs:QName, or xs:NOTATION values.

Examples

See the examples for the "eq" operator (previous entry in this table).

le

Returns true if Parameter1 is less than or equal to Parameter2.

Data Types

- Parameter1 data type: xsext:anyValue?

- Parameter2 data type: xsext:anyValue?

- Returned data type: xs:boolean?

Notes

This is a comparison operator that you can use as a function to compare operands.

If either operand is a node, Liquid Data extracts its typed value first, then performs a type check to ensure that the type of one operand is promotable to the other type; otherwise Liquid Data generates an error.

If either operand is an empty list, the function returns an empty list.

XQuery Specification Compliance

Liquid Data does not cast xs:anySimpleType to any other supported type.

Liquid Data does not support these data types: xs:yearMonthDuration, xs:dayTimeDuration, gregorian, xs:hexBinary, xs:base64Binary, xs:anyURI, xs:QName, or xs:NOTATION values.

Examples

See the examples for the "eq" operator (previous entry in this table).

lt

Returns true if Parameter1 is less than or equal to Parameter2.

Data Types

- Parameter1 data type: xsext:anyValue?

- Parameter2 data type: xsext:anyValue?

- Returned data type: xs:boolean?

Notes

This is a comparison operator that you can use as a function to compare operands.

If either operand is a node, Liquid Data extracts its typed value first, then performs a type check to ensure that the type of one operand is promotable to the other type; otherwise Liquid Data generates an error.

If either operand is an empty list, the function returns an empty list.

XQuery Specification Compliance

Liquid Data does not cast xs:anySimpleType to any other supported type.

Liquid Data does not support these data types: xs:yearMonthDuration, xs:dayTimeDuration, gregorian, xs:hexBinary, xs:base64Binary, xs:anyURI, xs:QName, or xs:NOTATION values.

Examples

See the examples for the "eq" operator (previous entry in this table).

ne

The result is false if both values are false and true if at least one of the values is true. Parameter2 is not evaluated if Parameter1 evaluates to true.

Data Types

- Parameter1 data type: xsext:boolean?

- Parameter2 data type: xsext:boolean?

- Returned data type: xs:boolean?

Notes

This is a boolean operator that you can use as a function to return a true or false result. It is not a standard XQuery operator, but necessary to complete certain comparative expressions in Liquid Data.

The arguments and return type are all boolean.

If either operand is a node, Liquid Data extracts its typed value first, then performs a type check to ensure that the type of one operand is promotable to the other type; otherwise Liquid Data generates an error.

If either operand is an empty list, the function returns an empty list.

XQuery Specification Compliance

Liquid Data does not support these data types: xs:yearMonthDuration, xs:dayTimeDuration, gregorian, xs:hexBinary, xs:base64Binary, xs:anyURI, xs:QName, or xs:NOTATION values.

Examples

See the examples for the "eq" operator (previous entry in this table).