@@ -9688,10 +9688,10 @@ <h5>Count</h5>
9688
9688
has a bound, non-error value within the aggregate group.</p>
9689
9689
<div class="defn">
9690
9690
<p><b>Definition: <span id="defn_aggCount">Count</span></b></p>
9691
- <pre class="code nohighlight">xsd:integer Count(sequence S )</pre>
9692
- <p>L = <a href="#defn_Flatten">Flatten </a>(S) </p>
9693
- <p>remove error elements from L</p>
9694
- <p>Count(S) = <a href="#defn_Card">Card</a>(L) </p>
9691
+ <pre class="code nohighlight">xsd:integer <var> Count</var> (sequence <var>S</var> )</pre>
9692
+ <p><var>Count</var>(<var>S</var>) = <a href="#defn_Card">Card </a>(<var>L'</var>), </p>
9693
+ <p>where <var>L'</var> is the list <var> L</var> = <a href="#defn_Flatten">Flatten</a>(<var>S</var>)
9694
+ with all error elements removed. </p>
9695
9695
</div>
9696
9696
</section>
9697
9697
<section id="aggSum">
@@ -9729,11 +9729,17 @@ <h5>Avg</h5>
9729
9729
average value for an expression over a group. It is defined in terms of Sum and Count.
9730
9730
<div class="defn">
9731
9731
<p><b>Definition: <span id="defn_aggAvg">Avg</span></b></p>
9732
- <pre class="code nohighlight">numeric Avg(sequence S)</pre>
9733
- <p>Avg(S) = "0"^^xsd:integer if Count(S) = 0</p>
9734
- <p>Avg(S) = Sum(S) / Count(S) if Count(S) > 0</p>
9735
- </div>
9736
- <p>For example, Avg([(1), (2), (3)]) = Sum([(1), (2), (3)])/Count([(1), (2), (3)]) = 6/3 = 2.</p>
9732
+ <pre class="code nohighlight">numeric <var>Avg</var>(sequence <var>S</var>)</pre>
9733
+ <p>If <var><a href="#defn_aggCount">Count</a></var>(<var>S</var>) = 0,
9734
+ then <var>Avg</var>(<var>S</var>) = "0"^^<code>xsd:integer</code>.</p>
9735
+ <p>If <var><a href="#defn_aggCount">Count</a></var>(<var>S</var>) > 0,
9736
+ then <var>Avg</var>(<var>S</var>) =
9737
+ <var><a href="#defn_aggSum">Sum</a></var>(<var>S</var>) /
9738
+ <var><a href="#defn_aggCount">Count</a></var>(<var>S</var>).</p>
9739
+ </div>
9740
+ <p>For example, <var>Avg</var>([(1), (2), (3)]) =
9741
+ <var>Sum</var>([(1), (2), (3)])/<var>Count</var>([(1), (2), (3)])
9742
+ = 6/3 = 2.</p>
9737
9743
</section>
9738
9744
<section id="aggMin">
9739
9745
<h5>Min</h5>
@@ -9830,12 +9836,15 @@ <h5>Sample</h5>
9830
9836
to it.</p>
9831
9837
<div class="defn">
9832
9838
<p><b>Definition: <span id="defn_aggSample">Sample</span></b></p>
9833
- <pre class="code nohighlight">RDFTerm Sample(sequence S)</pre>
9834
- <p>Sample(S) = v, where v in <a href="#defn_Flatten">Flatten</a>(S)</p>
9835
- <p>Sample([]) = error</p>
9836
- </div>
9837
- <p>For example, given Sample([("a"), ("b"), ("c")]), "a", "b", and "c" are all valid return
9838
- values. Note that Sample() is not required to be deterministic for a given input, the
9839
+ <pre class="code nohighlight">RDFTerm <var>Sample</var>(sequence <var>S</var>)</pre>
9840
+ <p>If <a href="#defn_Card">Card</a>(<var>S</var>) = 0, then
9841
+ <var>Sample</var>(<var>S</var>) = error.</p>
9842
+ <p>If <a href="#defn_Card">Card</a>(<var>S</var>) > 0, then
9843
+ <var>Sample</var>(<var>S</var>) = <var>v</var>, where <var>v</var>
9844
+ in <a href="#defn_Flatten">Flatten</a>(<var>S</var>).</p>
9845
+ </div>
9846
+ <p>For example, given <var>Sample</var>([("a"), ("b"), ("c")]), "a", "b", and "c" are all valid return
9847
+ values. Note that the <var>Sample</var> function is not required to be deterministic for a given input. The
9839
9848
only restriction is that the output value must be present in the input sequence.</p>
9840
9849
</section>
9841
9850
</section>
0 commit comments