Skip to content

Commit

Permalink
Section $orderby
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Sep 23, 2024
1 parent 050188b commit 1fe31c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ <h3 id="312-sameness-and-order"><a id="SamenessandOrder" href="#SamenessandOrder
<p>When transformations are defined in the following sections, the algorithmic description sometimes contains an <em>order-preserving loop</em> over a collection. Such a loop processes the occurrences in an order chosen by the service in such a way that <span class="math inline">\(u_1\)</span> is processed before <span class="math inline">\(u_2\)</span> whenever <span class="math inline">\(u_1\)</span> precedes <span class="math inline">\(u_2\)</span>. Likewise, in an <em>order-preserving sequence</em> <span class="math inline">\(u_1,…,u_n\)</span> we have <span class="math inline">\(i&lt;j\)</span> whenever <span class="math inline">\(u_i\)</span> precedes <span class="math inline">\(u_j\)</span>.</p>
<p>A collection can be <em>stable-sorted</em> by a list of expressions. In the stable-sorted collection an occurrence <span class="math inline">\(u_1\)</span> precedes <span class="math inline">\(u_2\)</span> if and only if either</p>
<ul>
<li><span class="math inline">\(u_1\)</span> precedes <span class="math inline">\(u_2\)</span> according to the rules of <a href="$$$OData-Protocol$$$#SystemQueryOptionorderby">OData-Protocol, section “System Query Option <code>$orderby</code></a> or</li>
<li><span class="math inline">\(u_1\)</span> precedes <span class="math inline">\(u_2\)</span> according to the rules of <a href="https://docs.oasis-open.org/odata/odata/v4.02/odata-v4.02-part1-protocol.html#SystemQueryOptionorderby">OData-Protocol, section 11.2.6.2</a> or</li>
<li>these rules do not determine a precedence in either direction between <span class="math inline">\(u_1\)</span> and <span class="math inline">\(u_2\)</span> but <span class="math inline">\(u_1\)</span> preceded <span class="math inline">\(u_2\)</span> in the collection before the sort.</li>
</ul>
<p>Stable-sorting of an ordered collection produces another ordered collection. A stable-sort does not necessarily produce a total order, the sorted collection may still contain two occurrences whose relative order does not matter. The transformation <a href="#Transformationorderby"><code>orderby</code></a> performs a stable-sort.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ An order of a collection is more precisely defined as follows: Given two differe
When transformations are defined in the following sections, the algorithmic description sometimes contains an _order-preserving loop_ over a collection. Such a loop processes the occurrences in an order chosen by the service in such a way that $u_1$ is processed before $u_2$ whenever $u_1$ precedes $u_2$. Likewise, in an _order-preserving sequence_ $u_1,…,u_n$ we have $i<j$ whenever $u_i$ precedes $u_j$.

A collection can be _stable-sorted_ by a list of expressions. In the stable-sorted collection an occurrence $u_1$ precedes $u_2$ if and only if either
- $u_1$ precedes $u_2$ according to the rules of [OData-Protocol, section "System Query Option `$orderby`]($$$OData-Protocol$$$#SystemQueryOptionorderby) or
- $u_1$ precedes $u_2$ according to the rules of [OData-Protocol, section 11.2.6.2](https://docs.oasis-open.org/odata/odata/v4.02/odata-v4.02-part1-protocol.html#SystemQueryOptionorderby) or
- these rules do not determine a precedence in either direction between $u_1$ and $u_2$ but $u_1$ preceded $u_2$ in the collection before the sort.

Stable-sorting of an ordered collection produces another ordered collection. A stable-sort does not necessarily produce a total order, the sorted collection may still contain two occurrences whose relative order does not matter. The transformation [`orderby`](#Transformationorderby) performs a stable-sort.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ An order of a collection is more precisely defined as follows: Given two differe
When transformations are defined in the following sections, the algorithmic description sometimes contains an _order-preserving loop_ over a collection. Such a loop processes the occurrences in an order chosen by the service in such a way that $u_1$ is processed before $u_2$ whenever $u_1$ precedes $u_2$. Likewise, in an _order-preserving sequence_ $u_1,…,u_n$ we have $i<j$ whenever $u_i$ precedes $u_j$.

A collection can be _stable-sorted_ by a list of expressions. In the stable-sorted collection an occurrence $u_1$ precedes $u_2$ if and only if either
- $u_1$ precedes $u_2$ according to the rules of [OData-Protocol, section "System Query Option `$orderby`]($$$OData-Protocol$$$#SystemQueryOptionorderby) or
- $u_1$ precedes $u_2$ according to the rules of [#OData-Protocol#SystemQueryOptionorderby] or
- these rules do not determine a precedence in either direction between $u_1$ and $u_2$ but $u_1$ preceded $u_2$ in the collection before the sort.

Stable-sorting of an ordered collection produces another ordered collection. A stable-sort does not necessarily produce a total order, the sorted collection may still contain two occurrences whose relative order does not matter. The transformation [`orderby`](#Transformationorderby) performs a stable-sort.
Expand Down

0 comments on commit 1fe31c2

Please sign in to comment.