Skip to content

Commit 7e6e6f9

Browse files
committed
uses the new 'multiplicity' function instead of card[..](..), and changes the terminology accordingly
1 parent f1ae8c4 commit 7e6e6f9

File tree

1 file changed

+44
-28
lines changed

1 file changed

+44
-28
lines changed

spec/index.html

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,8 +3916,8 @@ <h4>DISTINCT</h4>
39163916
<h4>REDUCED</h4>
39173917
<p>While the <code>DISTINCT</code> modifier ensures that duplicate solutions are
39183918
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
39213921
no <code>DISTINCT</code> or <code>REDUCED</code> modifier. For example, using the data
39223922
above, the query</p>
39233923
<div class="queryGroup">
@@ -8880,7 +8880,7 @@ <h4>Converting Solution Modifiers</h4>
88808880
<li>Limit</li>
88818881
</ul>
88828882
<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
88848884
no implied ordering to the sequence; duplicates need not be adjacent.</p>
88858885
<blockquote>
88868886
<p>Let M := ToList(Pattern)</p>
@@ -8993,8 +8993,9 @@ <h4>SPARQL Basic Graph Pattern Matching</h4>
89938993
<p>μ is a <b>solution</b> for BGP from G when there is a pattern instance mapping P such
89948994
that P(BGP) is a subgraph of G and μ is the restriction of P to the query variables in
89958995
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>
89988999
</div>
89999000
<p>If a basic graph pattern is the empty set, then the solution is Ω<sub>0</sub>.</p>
90009001
</section>
@@ -9275,24 +9276,25 @@ <h3>SPARQL Algebra</h3>
92759276
<p>Join(Ω<sub>1</sub>, Ω<sub>2</sub>) = { merge(μ<sub>1</sub>, μ<sub>2</sub>) |
92769277
μ<sub>1</sub> in Ω<sub>1</sub> and μ<sub>2</sub> in Ω<sub>2</sub>, and μ<sub>1</sub> and
92779278
μ<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>
92799280
&nbsp;&nbsp;&nbsp; for each merge(μ<sub>1</sub>, μ<sub>2</sub>), μ<sub>1</sub> in
92809281
Ω<sub>1</sub> and μ<sub>2</sub> in Ω<sub>2</sub> such that μ = merge(μ<sub>1</sub>,
92819282
μ<sub>2</sub>),<br>
92829283
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>
92849285
</div>
92859286
<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&nbsp; μ 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&nbsp; μ is the sum of the multiplicities from all possibilities.</p>
92889289
<div class="defn">
92899290
<p><b>Definition: <span id="defn_algDiff">Diff</span></b></p>
92909291
<p>Let Ω<sub>1</sub> and Ω<sub>2</sub> be multisets of solution mappings and expr be an
92919292
expression. We define:</p>
92929293
<p>Diff(Ω<sub>1</sub>, Ω<sub>2</sub>, expr) = { μ | μ in Ω<sub>1</sub> such that ∀ μ′ in
92939294
Ω<sub>2</sub>, either μ and μ′ are not compatible or μ and μ' are compatible and
92949295
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>
92969298
</div>
92979299
<p>The evaluation of expr(merge(μ, μ')) does not have an effective boolean
92989300
value of true if it evaluates to false or if it raises an error.</p>
@@ -9303,26 +9305,29 @@ <h3>SPARQL Algebra</h3>
93039305
expression. We define:</p>
93049306
<p>LeftJoin(Ω<sub>1</sub>, Ω<sub>2</sub>, expr) = Filter(expr, Join(Ω<sub>1</sub>,
93059307
Ω<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>
93099312
</div>
93109313

93119314
<div class="defn">
93129315
<p><b>Definition: <span id="defn_algUnion">Union</span></b></p>
93139316
<p>Let Ω<sub>1</sub> and Ω<sub>2</sub> be multisets of solution mappings. We define:</p>
93149317
<p>Union(Ω<sub>1</sub>, Ω<sub>2</sub>) = { μ | μ in Ω<sub>1</sub> or μ in Ω<sub>2</sub>
93159318
}</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>
93189322
</div>
93199323
<div class="defn">
93209324
<p><b>Definition: <span id="defn_algMinus">Minus</span></b></p>
93219325
<p>Let Ω<sub>1</sub> and Ω<sub>2</sub> be multisets of solution mappings. We define:</p>
93229326
<p>Minus(Ω<sub>1</sub>, Ω<sub>2</sub>) = { μ | μ in Ω<sub>1</sub> . ∀ μ' in
93239327
Ω<sub>2</sub>, either μ and μ' are not compatible or dom(μ) and dom(μ') are disjoint
93249328
}</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>
93269331
</div>
93279332
<p>The additional restriction on dom(μ) and dom(μ') is added because otherwise if there is
93289333
a solution mapping in Ω<sub>2</sub> that has no variables in common with the solution
@@ -9340,45 +9345,55 @@ <h3>SPARQL Algebra</h3>
93409345
<p>Extend(Ω, var, expr) = { Extend(μ, var, expr) | μ in Ω }</p>
93419346
</div>
93429347
<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>
93449348
<div class="defn">
93459349
<p><b>Definition: <span id="defn_algToList">ToList</span></b></p>
93469350
<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
93489353
μ</p>
9349-
<p>card[ToList(Ω)](μ) = card[Ω](μ)</p>
9354+
<p><a href="#defn_Multiplicity">multiplicity</a>( μ | ToList(Ω) ) =
9355+
<a href="#defn_Multiplicity">multiplicity</a>( μ | Ω )</p>
93509356
</div>
93519357
<div class="defn">
93529358
<p><b>Definition: <span id="defn_algOrdered">OrderBy</span></b></p>
93539359
<p>Let Ψ be a sequence of solution mappings. We define:</p>
93549360
<div id="defn_algOrderBy">
93559361
OrderBy
93569362
</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>
93589365
</div>
93599366
<div class="defn">
93609367
<p><b>Definition: <span id="defn_algProjection">Project</span></b></p>
93619368
<p>Let Ψ be a sequence of solution mappings and PV a set of variables.</p>
93629369
<p>For mapping μ, write Proj(μ, PV) to be the restriction of μ to variables in PV.</p>
93639370
<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>
93659373
<p>The order of Project(Ψ, PV) must preserve any ordering given by OrderBy.</p>
93669374
</div>
93679375
<div class="defn">
93689376
<p><b>Definition: <span id="defn_algDistinct">Distinct</span></b></p>
93699377
<p>Let Ψ be a sequence of solution mappings. We define:</p>
93709378
<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>
93729383
<p>The order of Distinct(Ψ) must preserve any ordering given by OrderBy.</p>
93739384
</div>
93749385
<div class="defn">
93759386
<p><b>Definition: <span id="defn_algReduced">Reduced</span></b></p>
93769387
<p>Let Ψ be a sequence of solution mappings. We define:</p>
93779388
<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>
93799394
<p>The order of Reduced(Ψ) must preserve any ordering given by OrderBy.</p>
93809395
</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>
93829397
<div class="defn">
93839398
<p><b>Definition: <span id="defn_algSlice">Slice</span></b></p>
93849399
<p>Let Ψ be a sequence of solution mappings. We define:</p>
@@ -9390,15 +9405,16 @@ <h3>SPARQL Algebra</h3>
93909405
<p><b>Definition: <span id="defn_algToMultiSet">ToMultiSet</span></b></p>
93919406
<p>Let Ψ be a solution sequence. We define:</p>
93929407
<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>
93949410
</div>
93959411
<p>ListEval is a function which is used to evaluate a list of expressions against a
93969412
solution and return a list of the resulting values.</p>
93979413
<div class="defn">
93989414
<div id="defn_algToMultiset">
93999415
<b>Definition: ToMultiset</b>
94009416
</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
94029418
the sequence. The order of the sequence has no effect on the resulting multiset, and
94039419
duplicates are preserved.</p>
94049420
</div>
@@ -9748,8 +9764,8 @@ <h3>Evaluation Semantics</h3>
97489764
the result is R
97499765
</pre>
97509766
</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
97539769
operation.</p>
97549770
<div class="defn">
97559771
<div id="defn_evalGroup">

0 commit comments

Comments
 (0)