Skip to content

Commit cefbd53

Browse files
authored
Merge pull request #125 from w3c/FixOfDedupFunction
Fixes a mistake in Dedup function
2 parents 6afce45 + 05521cf commit cefbd53

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

spec/index.html

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9573,33 +9573,53 @@ <h4>Aggregate Algebra</h4>
95739573
&nbsp;&nbsp;M(Ψ) = [ ListEval(exprlist, μ) | μ in Ψ ]<br>
95749574
&nbsp;&nbsp;F(Ψ) = func(M(Ψ), scalarvals), for non-<code>DISTINCT</code><br>
95759575
&nbsp;&nbsp;F(Ψ) = func(Dedup(M(Ψ)), scalarvals), for <code>DISTINCT</code></p>
9576-
<p>with Dedup(M(Ψ)) being an order-preserving, duplicate-free version of the sequence M(Ψ); that is, Dedup(M(Ψ)) is a sequence of RDF terms that has the following four properties.</p>
9576+
<p>with Dedup(M(Ψ)) being an order-preserving, duplicate-free version of the sequence M(Ψ); that is, Dedup(M(Ψ)) is a sequence of lists that has the following four properties
9577+
(where each such list in this sequence may contain RDF terms and
9578+
errors, as it is produced by the ListEval function).</p>
95779579
<ol>
9578-
<li>Every unique element in M(Ψ) is contained in Dedup(M(Ψ)).</li>
9579-
<li>Every element in Dedup(M(Ψ)) is contained in M(Ψ).</li>
9580-
<li>Dedup(M(Ψ)) is free of duplicates. That is, the element at the |i|-th position in Dedup(M(Ψ)) is not the same term as the element at the |j|-th position in Dedup(M(Ψ)) for every two natural numbers |i| and |j| such that |i| &ne; |j|.</li>
9581-
<li>For any two elements <var>e<sub>1</sub></var> and <var>e<sub>2</sub></var> in Dedup(M(Ψ)), the relative order of their first occurrences in M(Ψ) is preserved in Dedup(M(Ψ)). That is, if <var>i<sub>1</sub></var>&nbsp;&lt;&nbsp;<var>i<sub>2</sub></var>, then <var>j<sub>1</sub></var>&nbsp;&lt;&nbsp;<var>j<sub>2</sub></var>, where
9580+
<li>For every list&nbsp;<var>L</var> in M(Ψ) there exists a
9581+
list&nbsp;<var>L'</var> in Dedup(M(Ψ)) such that <var>L</var>
9582+
and <var>L'</var> are the same,
9583+
where two lists <var>L</var> and <var>L'</var> from M(Ψ) are
9584+
considered the same iff they have the same number of elements
9585+
and, for every position&nbsp;<var>k</var> within the two lists,
9586+
any of the following two conditions is true:
95829587
<ul>
9583-
<li><var>i<sub>1</sub></var> is the smallest natural number such that <var>e<sub>1</sub></var> is at the <var>i<sub>1</sub></var>-th position in M(Ψ),</li>
9584-
<li><var>i<sub>2</sub></var> is the smallest natural number such that <var>e<sub>2</sub></var> is at the <var>i<sub>2</sub></var>-th position in M(Ψ),</li>
9585-
<li><var>j<sub>1</sub></var> is the position of <var>e<sub>1</sub></var> in Dedup(M(Ψ)), and</li>
9586-
<li><var>j<sub>2</sub></var> is the position of <var>e<sub>2</sub></var> in Dedup(M(Ψ)).</li>
9588+
<li>either the element at the <var>k</var>-th position of
9589+
<var>L</var> is an RDF term, the element at the <var>k</var>-th
9590+
position of <var>L'</var> is also an RDF term, and these two
9591+
RDF terms are the <a href="#func-sameTerm">same term</a>;</li>
9592+
<li>or the element at the <var>k</var>-th position of <var>L</var>
9593+
is an error and the element at the <var>k</var>-th position of
9594+
<var>L'</var> is also an error.</li>
9595+
</ul>
9596+
</li>
9597+
<li>For every list&nbsp;<var>L</var> in Dedup(M(Ψ)) there exists
9598+
a list&nbsp;<var>L'</var> in M(Ψ) such that <var>L</var> and
9599+
<var>L'</var> are the same.</li>
9600+
<li>Dedup(M(Ψ)) is free of duplicates. That is, the list at the |i|-th position in Dedup(M(Ψ)) is not the same list as the list at the |j|-th position in Dedup(M(Ψ)) for every two natural numbers |i| and |j| such that |i| &ne; |j|.</li>
9601+
<li>For any two lists <var>L<sub>1</sub></var> and <var>L<sub>2</sub></var> in Dedup(M(Ψ)), the relative order of their first occurrences in M(Ψ) is preserved in Dedup(M(Ψ)). That is, if <var>i<sub>1</sub></var>&nbsp;&lt;&nbsp;<var>i<sub>2</sub></var>, then <var>j<sub>1</sub></var>&nbsp;&lt;&nbsp;<var>j<sub>2</sub></var>, where
9602+
<ul>
9603+
<li><var>i<sub>1</sub></var> is the smallest natural number such that <var>L<sub>1</sub></var> is at the <var>i<sub>1</sub></var>-th position in M(Ψ),</li>
9604+
<li><var>i<sub>2</sub></var> is the smallest natural number such that <var>L<sub>2</sub></var> is at the <var>i<sub>2</sub></var>-th position in M(Ψ),</li>
9605+
<li><var>j<sub>1</sub></var> is the position of <var>L<sub>1</sub></var> in Dedup(M(Ψ)), and</li>
9606+
<li><var>j<sub>2</sub></var> is the position of <var>L<sub>2</sub></var> in Dedup(M(Ψ)).</li>
95879607
</ul>
95889608
</li>
95899609
</ol>
95909610

95919611
<p><b>Special Case:</b> when <code>COUNT</code> is used with the expression
95929612
<code>*</code>, then F(Ψ) is the cardinality of the group solution sequence,
95939613
i.e., F(Ψ)&nbsp;=&nbsp;<a href="#defn_Card">Card</a>(Ψ),
9594-
or F(Ψ)&nbsp;=&nbsp;<a href="#defn_Card">Card</a>(Dedup(Ψ))
9614+
or F(Ψ)&nbsp;=&nbsp;<a href="#defn_Card">Card</a>(<a href="#defn_algDistinct">Distinct</a>(Ψ))
95959615
if the <code>DISTINCT</code> keyword is present.</p>
95969616
</div>
95979617
<p><i>scalarvals</i> are used to pass values to the underlying set function, bypassing
95989618
the mechanics of the grouping. For example, the aggregate expression
95999619
<code>GROUP_CONCAT(?x ; separator="|")</code> has a scalarvals argument of { "separator"
96009620
→ "|" }.</p>
96019621
<p>All aggregates may have the <code>DISTINCT</code> keyword as the first token in their
9602-
argument list. If this keyword is present then first argument to func is Distinct(M).</p>
9622+
argument list. If this keyword is present, then first argument to func is Dedup(M(Ψ)).</p>
96039623
<p>Example</p>
96049624
<p>Given a solution sequence Ψ with the following values:</p>
96059625
<table>

0 commit comments

Comments
 (0)