Tamino XML Server Version 9.7
 —  X-Query Reference Guide  —

EqualityExpr

Check whether two values are equal or not.


Syntax

EqualityExpr

RelationalExpr | EqualityExpr = RelationalExpr | EqualityExpr != RelationalExpr | EqualityExpr ~= RelationalExpr

Top of page

Description

By using the operators = and != you can check if two values are equal or not. In addition, you can test with the help of the contains operator ~= if the left operand contains the word pattern specified by the right operand. The result of the comparison is always one of the Boolean values "true" and "false". If there is a collation defined for either of the operands or if both operands have the same collation defined, then the comparison is based on this collation, otherwise it is character-based (this does not apply for the operator ~=).

When using the white space-separated tokenizer (default), there are also rules for handling character variants such as umlauts or accented characters. As an example the French "é" and "è" will be mapped to "e", before comparison takes place. The German umlauts "ä", "ö", and "ü" will be mapped to "ae", "oe" and "ue" respectively. For a complete and detailed description of how characters are mapped by default and how you can customize this behaviour, please see the section Unicode and Text Retrieval.

Wildcards

With the contains operator you can perform text retrieval including the use of a wildcard character: the value of the right operand is searched word by word regardless of case. The result is "true", if it could be found in the node's value irrespective of its location. A word consists of a non-empty sequence of characters. A wildcard character matches zero or more characters in a word so that a single "*" represents a single word. If the value of the right operand contains more than one word such as in the expression [node ~= "word1 word2"] then it is treated as [node ~= "word1" adj "word2"].

The wildcard character is always the asterisk "*" (Unicode value U+002A).

Top of page

Compatibility

The equality operators = and != correspond to the expression EqualityExpr defined in XPath, Section 3.4, Rule 23. For the additional X-Query operator ~=, there is no equivalent in XPath.

Top of page

Examples

The examples below are distinguished according to the tokenizer used. For a given database, you can set the tokenizer using the Tamino Manager.

Default (white space separated) Tokenizer

Japanese Tokenizer

Examples using the Japanese tokenizer are available in the section Pattern Matching in the XQuery User Guide.

Top of page

Related Expression

RelationalExpr

Top of page