@@ -3916,8 +3916,8 @@ <h4>DISTINCT</h4>
3916
3916
<h4>REDUCED</h4>
3917
3917
<p>While the <code>DISTINCT</code> modifier ensures that duplicate solutions are
3918
3918
eliminated from the solution set, <code>REDUCED</code> simply permits them to be
3919
- eliminated. The cardinality of any set of variable bindings in a <code>REDUCED</code>
3920
- solution set is at least one and not more than the cardinality of the solution set with
3919
+ eliminated. The multiplicity of any solution in a <code>REDUCED</code>
3920
+ solution set is at least one and not more than the multiplicity of the solution within the solution set with
3921
3921
no <code>DISTINCT</code> or <code>REDUCED</code> modifier. For example, using the data
3922
3922
above, the query</p>
3923
3923
<div class="queryGroup">
@@ -8880,7 +8880,7 @@ <h4>Converting Solution Modifiers</h4>
8880
8880
<li>Limit</li>
8881
8881
</ul>
8882
8882
<p>Step: ToList</p>
8883
- <p>ToList turns a multiset into a sequence with the same elements and cardinality . There is
8883
+ <p>ToList turns a multiset into a sequence with the same elements and multiplicities . There is
8884
8884
no implied ordering to the sequence; duplicates need not be adjacent.</p>
8885
8885
<blockquote>
8886
8886
<p>Let M := ToList(Pattern)</p>
@@ -8993,8 +8993,9 @@ <h4>SPARQL Basic Graph Pattern Matching</h4>
8993
8993
<p>μ is a <b>solution</b> for BGP from G when there is a pattern instance mapping P such
8994
8994
that P(BGP) is a subgraph of G and μ is the restriction of P to the query variables in
8995
8995
BGP.</p>
8996
- <p>card[Ω](μ) = card[Ω](number of distinct RDF instance mappings, σ, such that P = μ(σ)
8997
- is a pattern instance mapping and P(BGP) is a subgraph of G).</p>
8996
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Ω ) =
8997
+ number of distinct RDF instance mappings, σ, such that P = μ(σ)
8998
+ is a pattern instance mapping and P(BGP) is a subgraph of G.</p>
8998
8999
</div>
8999
9000
<p>If a basic graph pattern is the empty set, then the solution is Ω<sub>0</sub>.</p>
9000
9001
</section>
@@ -9275,24 +9276,25 @@ <h3>SPARQL Algebra</h3>
9275
9276
<p>Join(Ω<sub>1</sub>, Ω<sub>2</sub>) = { merge(μ<sub>1</sub>, μ<sub>2</sub>) |
9276
9277
μ<sub>1</sub> in Ω<sub>1</sub> and μ<sub>2</sub> in Ω<sub>2</sub>, and μ<sub>1</sub> and
9277
9278
μ<sub>2</sub> are compatible }</p>
9278
- <p>card[ Join(Ω<sub>1</sub>, Ω<sub>2</sub>)](μ ) =<br>
9279
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Join(Ω<sub>1</sub>, Ω<sub>2</sub>) ) =<br>
9279
9280
for each merge(μ<sub>1</sub>, μ<sub>2</sub>), μ<sub>1</sub> in
9280
9281
Ω<sub>1</sub> and μ<sub>2</sub> in Ω<sub>2</sub> such that μ = merge(μ<sub>1</sub>,
9281
9282
μ<sub>2</sub>),<br>
9282
9283
sum over (μ<sub>1</sub>, μ<sub>2</sub>),
9283
- card[Ω< sub>1</sub>](μ <sub>1</sub>)*card[Ω< sub>2</sub>](μ <sub>2</sub>)</p>
9284
+ <a href="#defn_Multiplicity">multiplicity</a>( μ< sub>1</sub> | Ω <sub>1</sub> ) * <a href="#defn_Multiplicity">multiplicity</a>( μ< sub>2</sub> | Ω <sub>2</sub> )</p>
9284
9285
</div>
9285
9286
<p>It is possible that a solution mapping μ in a Join can arise in different solution
9286
- mappings, μ<sub>1</sub> and μ<sub>2</sub> in the multisets being joined. The cardinality
9287
- of μ is the sum of the cardinalities from all possibilities.</p>
9287
+ mappings, μ<sub>1</sub> and μ<sub>2</sub> in the multisets being joined. The multiplicity
9288
+ of μ is the sum of the multiplicities from all possibilities.</p>
9288
9289
<div class="defn">
9289
9290
<p><b>Definition: <span id="defn_algDiff">Diff</span></b></p>
9290
9291
<p>Let Ω<sub>1</sub> and Ω<sub>2</sub> be multisets of solution mappings and expr be an
9291
9292
expression. We define:</p>
9292
9293
<p>Diff(Ω<sub>1</sub>, Ω<sub>2</sub>, expr) = { μ | μ in Ω<sub>1</sub> such that ∀ μ′ in
9293
9294
Ω<sub>2</sub>, either μ and μ′ are not compatible or μ and μ' are compatible and
9294
9295
expr(merge(μ, μ')) does not have an effective boolean value of true }</p>
9295
- <p>card[Diff(Ω<sub>1</sub>, Ω<sub>2</sub>, expr)](μ) = card[Ω<sub>1</sub>](μ)</p>
9296
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Diff(Ω<sub>1</sub>, Ω<sub>2</sub>, expr) ) =
9297
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ω<sub>1</sub> )</p>
9296
9298
</div>
9297
9299
<p>The evaluation of expr(merge(μ, μ')) does not have an effective boolean
9298
9300
value of true if it evaluates to false or if it raises an error.</p>
@@ -9303,26 +9305,29 @@ <h3>SPARQL Algebra</h3>
9303
9305
expression. We define:</p>
9304
9306
<p>LeftJoin(Ω<sub>1</sub>, Ω<sub>2</sub>, expr) = Filter(expr, Join(Ω<sub>1</sub>,
9305
9307
Ω<sub>2</sub>)) ∪ Diff(Ω<sub>1</sub>, Ω<sub>2</sub>, expr)</p>
9306
- <p>card[LeftJoin(Ω<sub>1</sub>, Ω<sub>2</sub>, expr)](μ) = card[Filter(expr,
9307
- Join(Ω<sub>1</sub>, Ω<sub>2</sub>))](μ) + card[Diff(Ω<sub>1</sub>, Ω<sub>2</sub>,
9308
- expr)](μ)</p>
9308
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | LeftJoin(Ω<sub>1</sub>, Ω<sub>2</sub>, expr) ) =
9309
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Filter(expr,Join(Ω<sub>1</sub>, Ω<sub>2</sub>)) ) +
9310
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Diff(Ω<sub>1</sub>, Ω<sub>2</sub>,
9311
+ expr) )</p>
9309
9312
</div>
9310
9313
9311
9314
<div class="defn">
9312
9315
<p><b>Definition: <span id="defn_algUnion">Union</span></b></p>
9313
9316
<p>Let Ω<sub>1</sub> and Ω<sub>2</sub> be multisets of solution mappings. We define:</p>
9314
9317
<p>Union(Ω<sub>1</sub>, Ω<sub>2</sub>) = { μ | μ in Ω<sub>1</sub> or μ in Ω<sub>2</sub>
9315
9318
}</p>
9316
- <p>card[Union(Ω<sub>1</sub>, Ω<sub>2</sub>)](μ) = card[Ω<sub>1</sub>](μ) +
9317
- card[Ω<sub>2</sub>](μ)</p>
9319
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Union(Ω<sub>1</sub>, Ω<sub>2</sub>) ) =
9320
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ω<sub>1</sub> ) +
9321
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ω<sub>2</sub> )</p>
9318
9322
</div>
9319
9323
<div class="defn">
9320
9324
<p><b>Definition: <span id="defn_algMinus">Minus</span></b></p>
9321
9325
<p>Let Ω<sub>1</sub> and Ω<sub>2</sub> be multisets of solution mappings. We define:</p>
9322
9326
<p>Minus(Ω<sub>1</sub>, Ω<sub>2</sub>) = { μ | μ in Ω<sub>1</sub> . ∀ μ' in
9323
9327
Ω<sub>2</sub>, either μ and μ' are not compatible or dom(μ) and dom(μ') are disjoint
9324
9328
}</p>
9325
- <p>card[Minus(Ω<sub>1</sub>, Ω<sub>2</sub>)](μ) = card[Ω<sub>1</sub>](μ)</p>
9329
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Minus(Ω<sub>1</sub>, Ω<sub>2</sub>) ) =
9330
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ω<sub>1</sub> )</p>
9326
9331
</div>
9327
9332
<p>The additional restriction on dom(μ) and dom(μ') is added because otherwise if there is
9328
9333
a solution mapping in Ω<sub>2</sub> that has no variables in common with the solution
@@ -9340,45 +9345,55 @@ <h3>SPARQL Algebra</h3>
9340
9345
<p>Extend(Ω, var, expr) = { Extend(μ, var, expr) | μ in Ω }</p>
9341
9346
</div>
9342
9347
<p>Write [ x | C ] for a sequence of elements where C is a condition on x.</p>
9343
- <p>Write card[L](x) to be the cardinality of x in L.</p>
9344
9348
<div class="defn">
9345
9349
<p><b>Definition: <span id="defn_algToList">ToList</span></b></p>
9346
9350
<p>Let Ω be a multiset of solution mappings. We define:</p>
9347
- <p>ToList(Ω) = a sequence of mappings μ in Ω in any order, with card[Ω](μ) occurrences of
9351
+ <p>ToList(Ω) = a sequence of mappings μ in Ω in any order, with
9352
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ω ) occurrences of
9348
9353
μ</p>
9349
- <p>card[ToList(Ω)](μ) = card[Ω](μ)</p>
9354
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | ToList(Ω) ) =
9355
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ω )</p>
9350
9356
</div>
9351
9357
<div class="defn">
9352
9358
<p><b>Definition: <span id="defn_algOrdered">OrderBy</span></b></p>
9353
9359
<p>Let Ψ be a sequence of solution mappings. We define:</p>
9354
9360
<div id="defn_algOrderBy">
9355
9361
OrderBy
9356
9362
</div>(Ψ, condition) = [ μ | μ in Ψ and the sequence satisfies the ordering condition]
9357
- <p>card[OrderBy(Ψ, condition)](μ) = card[Ψ](μ)</p>
9363
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | OrderBy(Ψ, condition) ) =
9364
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ψ )</p>
9358
9365
</div>
9359
9366
<div class="defn">
9360
9367
<p><b>Definition: <span id="defn_algProjection">Project</span></b></p>
9361
9368
<p>Let Ψ be a sequence of solution mappings and PV a set of variables.</p>
9362
9369
<p>For mapping μ, write Proj(μ, PV) to be the restriction of μ to variables in PV.</p>
9363
9370
<p>Project(Ψ, PV) = [ Proj(μ, PV) | μ in Ψ ]</p>
9364
- <p>card[Project(Ψ, PV)](μ) = sum(card[Ψ](ν) | ν in Ψ such that ν = Proj(μ, PV))</p>
9371
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Project(Ψ, PV) ) =
9372
+ sum( <a href="#defn_Multiplicity">multiplicity</a>( ν | Ψ ) | ν in Ψ such that ν = Proj(μ, PV))</p>
9365
9373
<p>The order of Project(Ψ, PV) must preserve any ordering given by OrderBy.</p>
9366
9374
</div>
9367
9375
<div class="defn">
9368
9376
<p><b>Definition: <span id="defn_algDistinct">Distinct</span></b></p>
9369
9377
<p>Let Ψ be a sequence of solution mappings. We define:</p>
9370
9378
<p>Distinct(Ψ) = [ μ | μ in Ψ ]</p>
9371
- <p>card[Distinct(Ψ)](μ) = 1</p>
9379
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Distinct(Ψ) ) = 1
9380
+ for every μ ∈ Distinct(Ψ)</p>
9381
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Distinct(Ψ) ) = 0
9382
+ for every μ ∉ Distinct(Ψ)</p>
9372
9383
<p>The order of Distinct(Ψ) must preserve any ordering given by OrderBy.</p>
9373
9384
</div>
9374
9385
<div class="defn">
9375
9386
<p><b>Definition: <span id="defn_algReduced">Reduced</span></b></p>
9376
9387
<p>Let Ψ be a sequence of solution mappings. We define:</p>
9377
9388
<p>Reduced(Ψ) = [ μ | μ in Ψ ]</p>
9378
- <p>card[Reduced(Ψ)](μ) is between 1 and card[Ψ](μ)</p>
9389
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Reduced(Ψ) ) is
9390
+ between 1 and <a href="#defn_Multiplicity">multiplicity</a>( μ | Ψ )
9391
+ for every μ ∈ Reduced(Ψ)</p>
9392
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | Reduced(Ψ) ) = 0
9393
+ for every μ ∉ Reduced(Ψ)</p>
9379
9394
<p>The order of Reduced(Ψ) must preserve any ordering given by OrderBy.</p>
9380
9395
</div>
9381
- <p>The Reduced solution sequence modifier does not guarantee a defined cardinality .</p>
9396
+ <p>The Reduced solution sequence modifier does not guarantee a defined multiplicity .</p>
9382
9397
<div class="defn">
9383
9398
<p><b>Definition: <span id="defn_algSlice">Slice</span></b></p>
9384
9399
<p>Let Ψ be a sequence of solution mappings. We define:</p>
@@ -9390,15 +9405,16 @@ <h3>SPARQL Algebra</h3>
9390
9405
<p><b>Definition: <span id="defn_algToMultiSet">ToMultiSet</span></b></p>
9391
9406
<p>Let Ψ be a solution sequence. We define:</p>
9392
9407
<p>ToMultiSet(Ψ) = { μ | μ in Ψ }</p>
9393
- <p>card[ToMultiSet(Ψ)](μ) = card[Ψ](μ)</p>
9408
+ <p><a href="#defn_Multiplicity">multiplicity</a>( μ | ToMultiSet(Ψ) ) =
9409
+ <a href="#defn_Multiplicity">multiplicity</a>( μ | Ψ )</p>
9394
9410
</div>
9395
9411
<p>ListEval is a function which is used to evaluate a list of expressions against a
9396
9412
solution and return a list of the resulting values.</p>
9397
9413
<div class="defn">
9398
9414
<div id="defn_algToMultiset">
9399
9415
<b>Definition: ToMultiset</b>
9400
9416
</div>
9401
- <p>ToMultiset turns a sequence into a multiset with the same elements and cardinality as
9417
+ <p>ToMultiset turns a sequence into a multiset with the same elements and multiplicities as
9402
9418
the sequence. The order of the sequence has no effect on the resulting multiset, and
9403
9419
duplicates are preserved.</p>
9404
9420
</div>
@@ -9748,8 +9764,8 @@ <h3>Evaluation Semantics</h3>
9748
9764
the result is R
9749
9765
</pre>
9750
9766
</div>
9751
- <p>The evaluation of graph uses the SPARQL algebra union operator. The cardinality of a
9752
- solution mapping is the sum of the cardinalities of that solution mapping in each join
9767
+ <p>The evaluation of graph uses the SPARQL algebra union operator. The multiplicity of a
9768
+ solution mapping is the sum of the multiplicities of that solution mapping in each join
9753
9769
operation.</p>
9754
9770
<div class="defn">
9755
9771
<div id="defn_evalGroup">
0 commit comments