Skip to content

Commit 0c735c0

Browse files
committed
presentation improvements in the definitions of the set functions Count, Avg, and Sample
1 parent d4ae227 commit 0c735c0

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

spec/index.html

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9688,10 +9688,10 @@ <h5>Count</h5>
96889688
has a bound, non-error value within the aggregate group.</p>
96899689
<div class="defn">
96909690
<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>
96959695
</div>
96969696
</section>
96979697
<section id="aggSum">
@@ -9729,11 +9729,17 @@ <h5>Avg</h5>
97299729
average value for an expression over a group. It is defined in terms of Sum and Count.
97309730
<div class="defn">
97319731
<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) &gt; 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>) &gt; 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>
97379743
</section>
97389744
<section id="aggMin">
97399745
<h5>Min</h5>
@@ -9830,12 +9836,15 @@ <h5>Sample</h5>
98309836
to it.</p>
98319837
<div class="defn">
98329838
<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>) &gt; 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
98399848
only restriction is that the output value must be present in the input sequence.</p>
98409849
</section>
98419850
</section>

0 commit comments

Comments
 (0)