Skip to content

Commit d808fb8

Browse files
committed
reverts the change to Distinct and introduces Dedup instead, as suggested in ff80086#commitcomment-118517879 ; additionally addresses the following comments: ff80086#r118402147 ff80086#r118507227 ff80086#r118508717
1 parent ff80086 commit d808fb8

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

spec/index.html

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9368,22 +9368,10 @@ <h3>SPARQL Algebra</h3>
93689368
</div>
93699369
<div class="defn">
93709370
<p><b>Definition: <span id="defn_algDistinct">Distinct</span></b></p>
9371-
<p>Let <var>Ψ</var> be a sequence of elements which may be either solution mappings or lists of RDF terms.</p>
9372-
<p>Distinct(<var>Ψ</var>) is a sequence of elements that has the following properties.</p>
9373-
<ol>
9374-
<li>Every element in <var>Ψ</var> is contained in Distinct(<var>Ψ</var>).</li>
9375-
<li>Every element in Distinct(<var>Ψ</var>) is contained in <var>Ψ</var>.</li>
9376-
<li>Distinct(<var>Ψ</var>) is free of duplicates. That is, the element at the |i|-th position in Distinct(<var>Ψ</var>) is different from the element at the |j|-th position in Distinct(<var>Ψ</var>) for every two natural numbers |i| and |j| such that |i| &ne; |j|.
9377-
</li>
9378-
<li>For every two elements <var>e<sub>1</sub></var> and <var>e<sub>2</sub></var> in Distinct(<var>Ψ</var>), the relative order of their first occurrences in <var>Ψ</var> is preserved in Distinct(<var>Ψ</var>). 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
9379-
<ul>
9380-
<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 <var>Ψ</var>,</li>
9381-
<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 <var>Ψ</var>,</li>
9382-
<li><var>j<sub>1</sub></var> is the position of <var>e<sub>1</sub></var> in Distinct(<var>Ψ</var>), and</li>
9383-
<li><var>j<sub>2</sub></var> is the position of <var>e<sub>2</sub></var> in Distinct(<var>Ψ</var>).</li>
9384-
</ul>
9385-
</li>
9386-
</ol>
9371+
<p>Let Ψ be a sequence of solution mappings. We define:</p>
9372+
<p>Distinct(Ψ) = [ μ | μ in Ψ ]</p>
9373+
<p>card[Distinct(Ψ)](μ) = 1</p>
9374+
<p>The order of Distinct(Ψ) must preserve any ordering given by OrderBy.</p>
93879375
</div>
93889376
<div class="defn">
93899377
<p><b>Definition: <span id="defn_algReduced">Reduced</span></b></p>
@@ -9469,10 +9457,25 @@ <h4>Aggregate Algebra</h4>
94699457
<p>where<br>
94709458
&nbsp;&nbsp;M(Ψ) = [ ListEval(exprlist, μ) | μ in Ψ ]<br>
94719459
&nbsp;&nbsp;F(Ψ) = func(M(Ψ), scalarvals), for non-<code>DISTINCT</code><br>
9472-
&nbsp;&nbsp;F(Ψ) = func(Distinct(M(Ψ)), scalarvals), for <code>DISTINCT</code></p>
9460+
&nbsp;&nbsp;F(Ψ) = func(Dedup(M(Ψ)), scalarvals), for <code>DISTINCT</code></p>
9461+
<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>
9462+
<ol>
9463+
<li>Every unique element in M(Ψ) is contained in Dedup(M(Ψ)).</li>
9464+
<li>Every element in Dedup(M(Ψ)) is contained in M(Ψ).</li>
9465+
<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>
9466+
<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
9467+
<ul>
9468+
<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>
9469+
<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>
9470+
<li><var>j<sub>1</sub></var> is the position of <var>e<sub>1</sub></var> in Dedup(M(Ψ)), and</li>
9471+
<li><var>j<sub>2</sub></var> is the position of <var>e<sub>2</sub></var> in Dedup(M(Ψ)).</li>
9472+
</ul>
9473+
</li>
9474+
</ol>
9475+
94739476
<p><b>Special Case:</b> when <code>COUNT</code> is used with the expression
94749477
<code>*</code> the value of F will be the cardinality of the group solution sequence,
9475-
<code>card[Ψ]</code>, or <code>card[Distinct(Ψ)]</code> if the <code>DISTINCT</code>
9478+
<code>card[Ψ]</code>, or <code>card[Dedup(Ψ)]</code> if the <code>DISTINCT</code>
94769479
keyword is present.</p>
94779480
</div>
94789481
<p><i>scalarvals</i> are used to pass values to the underlying set function, bypassing

0 commit comments

Comments
 (0)