Sequence Expression of XQuery Expression (SEQUENCE EXPRESSION)

xiaoxiao2021-03-19  194

First we need to understand the composition of XQuery, and the sequence in XQuery is composed of a series of items (Item), the item can be the node of XML (Node),

It is also possible to be atomic types (including integer, floating point, string, etc.). The atomic data type is basically used in the example below. Node is used as item or node and atomic data type

As a sequence of items basically similar.

The sequence expression is mainly referring to the expression of the sequence operation, mainly divided into three categories:

1. Construction sequence

The constructor can be enumerated, such as the following example

(10, 1, 2, 3, 4)

(10, (1, 2), (), (3, 4))

It is to be pointed out that the result of the sequence is not nested, the result of the second example above is (10, 1, 2, 3, 4)

Sequences can also achieve a range to construct through the TO keyword

(10, 1 to 4), return (10, 1, 2, 3, 4)

10 TO 10, only return 10

and

15 TO 13 does not return any returns, that is, an empty sequence.

2. Filter expression

This has been told when the path expression is passed. The classification of the expression in XQuery is somewhat crossed.

3. Combination sequence

The combination sequence contains three operations of Intersect, and (Union) and Poor (Except). They are similar to the collection of integration, and poor, it is easier to understand.

It should be noted that UNION, in addition to the UNION keyword, you can also use | Here are some examples

(1, 3, 5) INTERSECT (2, 3)

(1 to 5) Union (2, 4, 6, 8)

(1, 2) | (3, 4)

(2, 4, 5) Except (2, 3)

转载请注明原文地址:https://www.9cbs.com/read-130249.html

New Post(0)