Skip to content

Commit ff80086

Browse files
committed
improved definition of Distinct; as per #98 (comment)
1 parent 67ac56e commit ff80086

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

spec/index.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9368,10 +9368,22 @@ <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 Ψ be a sequence of elements which may be either solution mappings or lists of RDF terms. We define:</p>
9372-
<p>Distinct(Ψ) = [ e | e in Ψ ]</p>
9373-
<p>card[Distinct(Ψ)](e) = 1</p>
9374-
<p>The order of Distinct(Ψ) must preserve any ordering given by OrderBy (if any).</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>
93759387
</div>
93769388
<div class="defn">
93779389
<p><b>Definition: <span id="defn_algReduced">Reduced</span></b></p>

0 commit comments

Comments
 (0)