Skip to content

Commit 2670fe7

Browse files
authored
Merge pull request #221 from w3c/Issue217
Consider bnode graph names in evaluation of Graph
2 parents 3c6eb59 + 7646624 commit 2670fe7

File tree

1 file changed

+41
-22
lines changed

1 file changed

+41
-22
lines changed

spec/index.html

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
div.defn p { margin-top: 1ex ; margin-bottom: 1.5ex ;}
108108
div.defn ul { margin-top: 1ex ; margin-bottom: 1.5ex ; }
109109
span.definedTerm {font-weight: bold;}
110+
div.indentedFormula { margin-left: 5ex ; margin-top: 2mm ; margin-bottom: 2mm ; }
110111

111112
div.grammarExtract
112113
{ border: thin solid #888888;
@@ -9472,8 +9473,6 @@ <h3>Basic Graph Patterns</h3>
94729473
<p>Write <var>Ω<sub>0</sub></var> for the multiset consisting of exactly the empty mapping
94739474
<var>μ<sub>0</sub></var>, with multiplicity 1. This is the join identity.</p>
94749475
<p>Write <var>μ</var>(<var>x</var>) for the solution mapping variable <var>x</var> to RDF term <var>t</var> : { (<var>x</var>, <var>t</var>) }.</p>
9475-
<p>Write <var>Ω</var>(<var>x</var>) for the multiset consisting of exactly <var>μ</var>(<var>?x</var>-&gt;<var>t</var>), that is, <code>{ { (x, t) } }</code>
9476-
with multiplicity 1.</p>
94779476
<div class="defn">
94789477
<p><b>Definition: <span id="defn_algCompatibleMapping">Compatible Mappings</span></b></p>
94799478
<p>Two solution mappings μ<sub>1</sub> and μ<sub>2</sub> are compatible if, for every
@@ -10312,9 +10311,8 @@ <h5>Sample</h5>
1031210311
<h3>Evaluation Semantics</h3>
1031310312
<p id="defn_eval">We define <a href="#defn_eval" class="evalFct">eval</a>(|D|(|G|), |A|) as the evaluation of an algebra expression |A| with
1031410313
respect to a <a href="#sparqlDataset">dataset</a> |D| having <a href="#defn_ActiveGraph">active graph</a> |G|. The active graph is initially the default
10315-
graph of |D|. Further symbols and notation used in the following definitions are:</p>
10314+
graph of |D|. Further symbols used in the following definitions are:</p>
1031610315
<ul>
10317-
<li>|D|[|i|] : Denotes the graph with IRI |i| in dataset |D|</li>
1031810316
<li>|P|, <var>P<sub>1</sub></var>, <var>P<sub>2</sub></var> : graph patterns</li>
1031910317
<li>|L| : a solution sequence</li>
1032010318
<li>|F| : an expression</li>
@@ -10368,25 +10366,46 @@ <h3>Evaluation Semantics</h3>
1036810366
</div>
1036910367
<div class="defn">
1037010368
<p><b>Definition: <span id="defn_evalGraph">Evaluation of Graph</span></b></p>
10371-
<pre class="code nohighlight">
10372-
if <var>IRI</var> is a graph name in <var>D</var>
10373-
<a href="#defn_eval" class="evalFct">eval</a>( <var>D</var>(<var>G</var>), Graph(<var>IRI</var>,<var>P</var>) ) = <a href="#defn_eval" class="evalFct">eval</a>( <var>D</var>(<var>D</var>[<var>IRI</var>]), <var>P</var> )
10374-
</pre>
10375-
<pre class="code nohighlight">
10376-
if <var>IRI</var> is not a graph name in <var>D</var>
10377-
<a href="#defn_eval" class="evalFct">eval</a>( <var>D</var>(<var>G</var>), Graph(<var>IRI</var>,<var>P</var>) ) = the empty multiset
10378-
</pre>
10379-
<pre class="code nohighlight">
10380-
<a href="#defn_eval" class="evalFct">eval</a>( <var>D</var>(<var>G</var>), Graph(<var>var</var>,<var>P</var>) ) =
10381-
Let <var>R</var> be the empty multiset
10382-
foreach IRI <var>i</var> in <var>D</var>
10383-
<var>R</var> := <a href="#defn_algUnion" class="algFct">Union</a>(<var>R</var>, <a href="#defn_algJoin" class="algFct">Join</a>( <a href="#defn_eval" class="evalFct">eval</a>(<var>D</var>(<var>D</var>[<var>i</var>]), <var>P</var>) , Ω(<var>var</var>-&gt;<var>i</var>) ) )
10384-
the result is <var>R</var>
10385-
</pre>
10369+
<p>For every |x| that is
10370+
an <a data-cite="RDF12-CONCEPTS#dfn-IRI">IRI</a> or
10371+
a <a href="#defn_QueryVariable">variable</a>,
10372+
<a href="#defn_eval" class="evalFct">eval</a>( |D|(|G|), Graph(|x|, |P|) )
10373+
is defined as follows:</p>
10374+
<ul>
10375+
<li>If |x| is an IRI
10376+
that is a <a data-cite="RDF12-CONCEPTS#dfn-graph-name">graph name</a> in |D|,
10377+
<div class="indentedFormula">
10378+
<a href="#defn_eval" class="evalFct">eval</a>( |D|(|G|), Graph(|x|, |P|) )
10379+
=
10380+
<a href="#defn_eval" class="evalFct">eval</a>( |D|(<var>G<sub>|x|</sub></var>), |P| ),
10381+
</div>
10382+
where <var>G<sub>|x|</sub></var> is the RDF graph of the named graph with name |x| in |D|.
10383+
</li>
10384+
<li>If |x| is an IRI
10385+
that is not a <a data-cite="RDF12-CONCEPTS#dfn-graph-name">graph name</a> in |D|,
10386+
<div class="indentedFormula">
10387+
<a href="#defn_eval" class="evalFct">eval</a>( |D|(|G|), Graph(|x|, |P|) )
10388+
is the empty multiset.
10389+
</div>
10390+
</li>
10391+
<li>If |x| is a variable,
10392+
<div class="indentedFormula">
10393+
<a href="#defn_eval" class="evalFct">eval</a>( |D|(|G|), Graph(|x|, |P|) )
10394+
=
10395+
<var>Ω</var>,
10396+
</div>
10397+
where <var>Ω</var> is the multiset of solution mappings produced by the following algorithm:
10398+
<pre class="code nohighlight" style="font-family: sans-serif;">
10399+
<var>Ω</var> := the empty multiset
10400+
for each <a data-cite="RDF12-CONCEPTS#dfn-graph-name">graph name</a> <var>gn</var> in <var>D</var> (recall that a graph name may be an IRI or a blank node)
10401+
<var>G'</var> := the RDF graph of the named graph with name <var>gn</var> in <var>D</var>
10402+
<var>Ω'</var> := <a href="#defn_eval" class="evalFct">eval</a>( <var>D</var>(<var>G'</var>), <var>P</var> )
10403+
<var>Ω</var> := <a href="#defn_algUnion" class="algFct">Union</a>( <var>Ω</var>, <a href="#defn_algJoin" class="algFct">Join</a>(<var>Ω'</var>, <var>μ</var>) ), where <var>μ</var> = {<var>x</var> → <var>gn</var>}
10404+
the result is <var>Ω</var>
10405+
</pre>
10406+
</li>
10407+
</ul>
1038610408
</div>
10387-
<p>The evaluation of graph uses the <a href="#defn_algUnion" class="algFct">Union</a> operator. The multiplicity of a
10388-
solution mapping is the sum of the multiplicities of that solution mapping in each <a href="#defn_algJoin" class="algFct">Join</a>
10389-
operation.</p>
1039010409
<div class="defn">
1039110410
<div id="defn_evalGroup">
1039210411
<b>Definition: Evaluation of Group</b>

0 commit comments

Comments
 (0)