Skip to content

Commit 74b1f52

Browse files
committed
snapshot of addressing #228 in Sec.18.5 'Property Path Patterns'
1 parent b043e84 commit 74b1f52

File tree

1 file changed

+57
-55
lines changed

1 file changed

+57
-55
lines changed

spec/index.html

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9687,45 +9687,49 @@ <h4>Treatment of Blank Nodes</h4>
96879687
<h3>Property Path Patterns</h3>
96889688
<p>This section defines the evaluation of <a href="#defn_PropertyPathPattern">property path
96899689
patterns</a>. A property path pattern is a subject endpoint (an RDF term or a variable), a
9690-
property path express and an object endpoint. The
9691-
<a href="#sparqlTranslatePathExpressions">translation of property path expressions</a> converts some
9692-
forms to other SPARQL expressions, such as converting property paths of length one to triple
9693-
patterns, which in turn are combined into basic graph patterns. This leaves property path
9694-
operators ZeroOrOnePath, ZeroOrMorePath, OneOrMorePath and NegatedPropertySets and also path
9690+
<a href="#defn_PropertyPathExpr">property path expression</a>, and an object endpoint. The
9691+
<a href="#sparqlTranslatePathExpressions">translation of property path expressions</a> converts every
9692+
<a href="#defn_PropertyPathExpr">property path expression</a> into an
9693+
<a href="#defn_AlgebraicPropertyPathExpression">algebraic property path expression</a>.
9694+
Thereafter, <a href="#sparqlTranslatePathPatterns">translation of property path pattern</a> converts
9695+
some of these algebraic property path expressions
9696+
to other SPARQL graph pattern, such as converting property paths of length one to triple
9697+
patterns, which in turn are combined into basic graph patterns.
9698+
This leaves algebraic property path expressions with the operators
9699+
<a href="#defn_ppeZeroOrOnePath" class="ppeOp">ZeroOrOnePath</a>,
9700+
<a href="#defn_ppeZeroOrMorePath" class="ppeOp">ZeroOrMorePath</a>,
9701+
<a href="#defn_ppeOneOrMorePath" class="ppeOp">OneOrMorePath</a>,
9702+
and <a href="#defn_ppeNPS" class="ppeOp">NegatedPropertySets</a>,
9703+
as well as algebraic property path
96959704
expressions contained within these operators.</p>
9696-
<p>All remaining property path expressions are present in the algebra in the form
9697-
<code>Path(X, path, Y)</code> for endpoints X and Y. For example: syntax<code>(:p/:q)*</code>
9698-
is a ZeroOrMorePath expression involving a sequence property path becoming the algebra
9699-
expession <code>ZeroOrMorePath(seq(link(:p), link(:q)))</code>.</p>
9705+
<p>The property path patterns with these remaining algebraic property path expressions
9706+
are present in the <a href="#algebraicSyntax">algebraic syntax</a> in the form
9707+
<a href="#defn_absPath" class="absOp">Path</a>(|X|, |ppe|, |X|) for endpoints |X| and |Y|.
9708+
For example, the <a href="#defn_PropertyPathExpr">property path expression</a> <code>(:p/:q)*</code>
9709+
is a ZeroOrMorePath expression involving a sequence property path,
9710+
and is translated into the algebraic property path expression
9711+
<a href="#defn_ppeZeroOrMorePath" class="ppeOp">ZeroOrMorePath</a>( <a href="#defn_ppeSeq" class="ppeOp">seq</a>(<a href="#defn_ppeLink" class="ppeOp">link</a>(:p), <a href="#defn_ppeLink" class="ppeOp">link</a>(:q)) ).</p>
9712+
<div class="ednote">The example at the end of the previous paragraph fits much better into the first paragraph of the section and, thus, should be moved there.</div>
97009713
<div class="defn">
97019714
<div id="pp-eval-notation">
97029715
<b>Notation</b>
97039716
</div>
9704-
<p>Write</p>
9705-
<pre>eval(Path(X, PP, Y))</pre>
9706-
<p>for the evaluation of the property path patterns. This produces a multiset of solution
9707-
mappings μ, each solution mapping having a binding for variables used (each of X and Y can
9717+
<p>For every <a href="#defn_AlgebraicQueryExpression">algebraic query expression</a> of the form
9718+
<a href="#defn_absPath" class="absOp">Path</a>(|X|, |ppe|, |Y|) we write</p>
9719+
<pre class="nohighlight">ppeval(<var>X</var>, <var>ppe</var>, <var>Y</var>)</pre>
9720+
<p>to denote the evaluation of the property path pattern. This produces a multiset of solution
9721+
mappings, each solution mapping having a binding for variables used (each of |X| and |Y| can
97089722
be a variable). Some operators only produce a set of solution mappings.</p>
97099723
<p>Write</p>
9710-
<pre>
9711-
Var(x<sub>1</sub>, x<sub>2</sub>, ..., x<sub>n</sub>) = { x<sub>i</sub> | i in 1...n and x<sub>i</sub> is a variable
9712-
}
9713-
</pre>
9714-
<p>for the variables in <code>x<sub>1</sub>, x<sub>2</sub>, ..., x<sub>n</sub></code>.</p>
9715-
<p>Write</p>
97169724
<table style="border-collapse: collapse; border-color: #000000; border-spacing: 10px ; border-width: 1px">
97179725
<tbody>
97189726
<tr>
9719-
<td><code>x:term</code></td>
9720-
<td>when <code>x</code> is an RDF term</td>
9727+
<td><code>|x|:term</code></td>
9728+
<td>when <code>|x|</code> is an RDF term</td>
97219729
</tr>
97229730
<tr>
9723-
<td><code>x:var</code></td>
9724-
<td>when <code>x</code> is a variable</td>
9725-
</tr>
9726-
<tr>
9727-
<td><code>x:path</code></td>
9728-
<td>when <code>x</code> is a path expression</td>
9731+
<td><code>|x|:var</code></td>
9732+
<td>when <code>|x|</code> is a variable</td>
97299733
</tr>
97309734
</tbody>
97319735
</table>
@@ -9735,46 +9739,44 @@ <h3>Property Path Patterns</h3>
97359739
in each definition for clarity.</p>
97369740
<div class="defn">
97379741
<p><b>Definition: <span id="defn_evalPP_predicate">Evaluation of Predicate Property Path</span></b></p>
9738-
<p>Let Path(X, link(iri), Y) be an predicate inverse property path pattern, using some IRI
9739-
iri.</p>
9740-
<pre>
9741-
eval(Path(X, link(iri), Y)) = <a href="#BasicGraphPattern">evaluation of basic graph pattern</a> {X iri Y}
9742+
<p>Let |iri| be an IRI.</p>
9743+
<pre class="nohighlight">
9744+
ppeval(<var>X</var>, <a href="#defn_ppeLink" class="ppeOp">link</a>(<var>iri</var>), <var>Y</var>) = <a href="#BasicGraphPattern">evaluation of basic graph pattern</a> {<var>X</var> <var>iri</var> <var>Y</var>}
97429745
</pre>
97439746
</div>
9744-
<p>If both X and Y are variables, this is the same as:</p>
9745-
<pre>
9746-
eval(Path(X:var, link(iri), Y:var)) = { (X, xn) (Y, yn) | xn and yn are RDF terms and triple (xn iri yn) is in the active graph }</pre>
9747-
<p>If X is a variable and Y an RDF term:</p>
9748-
<pre>
9749-
eval(Path(X:var, link(iri), Y:term)) = { (X, xn) | xn is an RDF term and triple (xn iri Y) is in the active graph
9750-
}
9751-
</pre>
9752-
<p>If X is an RDF term and Y is a variable:</p>
9753-
<pre>
9754-
eval(Path(X:term, link(iri), Y:var)) = { (Y, yn) | yn is an RDF term and triple (X iri yn) is in the active graph
9755-
}
9756-
</pre>
9757-
<p>If both X and Y are RDF terms:</p>
9758-
<pre>
9759-
eval(Path(X:term, link(iri), Y:term))
9760-
= { μ<sub>0</sub> } if triple (X iri Y) is in the active graph
9747+
<p>If both |X| and |Y| are variables, this is the same as:</p>
9748+
<pre class="nohighlight">
9749+
ppeval(<var>X</var>:var, <a href="#defn_ppeLink" class="ppeOp">link</a>(<var>iri</var>), <var>Y</var>:var) = { (<var>X</var>, <var>xn</var>) (<var>Y</var>, <var>yn</var>) | <var>xn</var> and <var>yn</var> are RDF terms and triple (<var>xn</var>, <var>iri</var>, <var>yn</var>) is in the active graph }</pre>
9750+
<p>If |X| is a variable and |Y| an RDF term:</p>
9751+
<pre class="nohighlight">
9752+
ppeval(<var>X</var>:var, <a href="#defn_ppeLink" class="ppeOp">link</a>(<var>iri</var>), <var>Y</var>:term) = { (<var>X</var>, <var>xn</var>) | <var>xn</var> is an RDF term and triple (<var>xn</var>, <var>iri</var>, <var>Y</var>) is in the active graph }</pre>
9753+
<p>If |X| is an RDF term and |Y| is a variable:</p>
9754+
<pre class="nohighlight">
9755+
ppeval(<var>X</var>:term, <a href="#defn_ppeLink" class="ppeOp">link</a>(<var>iri</var>), <var>Y</var>:var) = { (<var>Y</var>, <var>yn</var>) | <var>yn</var> is an RDF term and triple (<var>X</var>, <var>iri</var>, <var>yn</var>) is in the active graph }</pre>
9756+
<p>If both |X| and |Y| are RDF terms:</p>
9757+
<pre class="nohighlight">
9758+
ppeval(<var>X</var>:term, <a href="#defn_ppeLink" class="ppeOp">link</a>(<var>iri</var>), <var>Y</var>:term)
9759+
= { μ<sub>0</sub> } if triple (<var>X</var>, <var>iri</var>, <var>Y</var>) is in the active graph
97619760
= { { } } = Ω<sub>0</sub>
97629761

9763-
eval(Path(X:term, link(iri), Y:term)) = { } if triple (X iri Y) is not in the active graph
9762+
ppeval(<var>X</var>:term, <a href="#defn_ppeLink" class="ppeOp">link</a>(<var>iri</var>), <var>Y</var>:term) = { } if triple (<var>X</var>, <var>iri</var>, <var>Y</var>) is not in the active graph
97649763
</pre>
97659764
<p>Informally, evaluating a Predicate Property Path is the same as executing a subquery
9766-
<code>SELECT * { <i>X P Y</i> }</code> at that point in the query evaluation.</p>
9765+
<code>SELECT * { |X| |iri| |Y|</i> }</code> at that point in the query evaluation.</p>
97679766
<div class="defn">
97689767
<p><b>Definition: <span id="defn_evalPP_inverse">Evaluation of Inverse Property Path</span></b></p>
9769-
<p>Let P be a property path expression, then:</p>
9770-
<pre>eval(Path(X, inv(P), Y)) = eval(Path(Y, P, X))</pre>
9768+
<p>Let |ppe| be an <a href="#defn_AlgebraicPropertyPathExpression">algebraic property path expression</a>, then:</p>
9769+
<pre class="nohighlight">ppeval(<var>X</var>, <a href="#defn_ppeInv" class="ppeOp">inv</a>(<var>ppe</var>), <var>Y</var>) = ppeval(<var>Y</var>, <var>ppe</var>, <var>X</var>)</pre>
97719770
</div>
97729771
<div class="defn">
97739772
<p><b>Definition: <span id="defn_evalPP_sequence">Evaluation of Sequence Property Path</span></b></p>
9774-
<p>Let P and Q be property path expressions. Let V be a fresh variable.</p>
9775-
<pre>A = Join( eval(Path(X, P, V)), eval(Path(V, Q, Y)) )</pre>
9776-
<pre>eval(Path(X, seq(P,Q), Y)) = Project(A, Var(X,Y))</pre>
9773+
<p>Let <var>ppe<sub>1</sub></var> and <var>ppe<sub>2</sub></var> be <a href="#defn_AlgebraicPropertyPathExpression">algebraic property path expressions</a>. Let |V| be a fresh variable.</p>
9774+
<pre class="nohighlight"><var>A</var> = <a href="#defn_algJoin" class="algFct">Join</a>( ppeval(<var>X</var>, <var>ppe<sub>1</sub></var>, <var>V</var>), ppeval(<var>V</var>, <var>ppe<sub>2</sub></var>, <var>Y</var>) )</pre>
9775+
<pre class="nohighlight">ppeval(<var>X</var>, <a href="#defn_ppeSeq" class="ppeOp">seq</a>(<var>ppe<sub>1</sub></var>,<var>ppe<sub>2</sub></var>), <var>Y</var>) = <a href="#defn_algProject" class="algFct">Project</a>(<var>A</var>, <var>PV</var>)</pre>
9776+
<p>where |PV| = { |v| ∈ {|X|,|Y|} | |v| is a variable}.</p>
9777+
<div class="issue" data-number="266"><a href="#defn_algJoin" class="algFct">Join</a> produces a multiset of solution mappings but <a href="#defn_algProject" class="algFct">Project</a> expects a sequence as its first argument. Moreover, <a href="#defn_algProject" class="algFct">Project</a> produces a sequence but ppeval(..) should be a multiset.</div>
97779778
</div>
9779+
<div class="ednote">Olaf, continue here!</div>
97789780
<p>Informally, this is the same as:</p>
97799781
<pre>SELECT * { X P _:a . _:a Q Y }</pre>
97809782
<p>using the fact that a blank node <code>_:a</code> acts like a variable (under simple

0 commit comments

Comments
 (0)