You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#314: Made focusNode an explicit param of exprEval, SPARQL-based expressions now pre-bind all scope vars (#370)
Closes#314
* #314: Made focusNode an explicit param of exprEval, SPARQL-based expressions now pre-bind all scope vars
* #314: Fixes
* #314: Clarified role of active graph
* #314: active graph -> focus graph
* Apply suggestions from code review
Co-authored-by: Ted Thibodeau Jr <[email protected]>
* Updated sh:expression to [ true ] list instead of "or" semantics
---------
Co-authored-by: Ted Thibodeau Jr <[email protected]>
If <code>s</code> is a <a>shape</a> in a <a>shapes graph</a><code>SG</code> and <code>s</code> has
1360
1360
<a>value</a><code>expr</code> for <code>sh:targetNode</code> in <code>SG</code>,
1361
1361
then the <a>output nodes</a> of <code>expr</code> are <a>targets</a>
1362
-
for the data graph <code>DG</code> as <a>active graph</a>.
1362
+
for the data graph <code>DG</code> as <a>focus graph</a>.
1363
1363
</div>
1364
1364
<p><em>The remainder of this section is informative.</em></p>
1365
1365
<p>
@@ -2406,14 +2406,15 @@ <h2>Node Expressions</h2>
2406
2406
</div>
2407
2407
<divclass="def" id="node-expression-evaluation">
2408
2408
<divclass="def-header">EVALUATION OF NODE EXPRESSIONS</div>
2409
-
The <dfn>evaluation</dfn> of a node expression is defined as a function <code>evalExpr(expr, activeGraph, scope) -> outputNodes</code>
2409
+
The <dfn>evaluation</dfn> of a node expression is defined as a function <code>evalExpr(expr, focusGraph, focusNode, scope) -> outputNodes</code>
2410
2410
where
2411
2411
<ul>
2412
2412
<li><code>expr</code> is a <a>node expression</a> in a <a>shapes graph</a>.
2413
2413
During evaluation, the engine can access <a>triples</a> related to <code>expr</code> in the <a>shapes graph</a>.</li>
2414
-
<li><code>activeGraph</code> is a <a>graph</a>, called the <dfn>active graph</dfn>.</li>
2414
+
<li><code>focusGraph</code> is a <a>graph</a>, called the <dfn>focus graph</dfn>. This is the default query graph for the evaluation of the node expression.</li>
2415
+
<li><code>focusNode</code> is a <a>node</a>, called the <dfn>input focus node</dfn>. This variable may have no value.</li>
2415
2416
<li><code>scope</code> is a map from <ahref="https://www.w3.org/TR/sparql12-query/#defn_QueryVariable">variable names</a> to individual <a>nodes</a>.
2416
-
The value of the variable <code>focusNode</code> (if it exists) is called the <dfn>input focus node</dfn>.
2417
+
The empty map is written as <code>{}</code>.
2417
2418
</li>
2418
2419
</ul>
2419
2420
The result of the evaluation of a node expression is a list of <a>nodes</a> (possibly empty and with duplicates) called the <dfn>output nodes</dfn>.
@@ -2440,7 +2441,7 @@ <h3>IRI Expressions</h3>
2440
2441
The <a>output nodes</a> of an <a>IRI expression</a> are the list consisting of exactly the <a>node expression</a> itself:
<divclass="def-header">EVALUATION OF SELECT EXPRESSIONS</div>
1230
1231
<p>
1231
1232
The <a>output nodes</a> of a <a>select expression</a> are the list <code>resultNodes</code> consisting of exactly the bindings of the (only)
1232
-
variable that is projected from the SELECT clause.
1233
-
If present in the <a>scope</a>, the value of the scope variable <code>focusNode</code> MUST be <a>pre-bound</a> as the value of the SPARQL variable <code>this</code>.
1233
+
variable that is projected from the <code>SELECT</code> clause when the query is evaluated against the <a>focus graph</a>.
1234
+
The value of <code>focusNode</code> is <a>pre-bound</a> as the value of the SPARQL variable <code>this</code>.
1235
+
The value of each scope variable is <a>pre-bound</a> as a SPARQL variable with the same name and value.
1236
+
A <a>failure</a> is produced when one of the scope variables is called <code>this</code>.
<divclass="def-header">EVALUATION OF SPARQL EXPR EXPRESSIONS</div>
1341
1344
<p>
1342
1345
The <a>output nodes</a> of an <a>SPARQL expr expression</a> are the list <code>resultNodes</code> consisting of exactly the bindings of the (only)
1343
-
variable that is projected from the SELECT clause of the <code>select</code> query as defined <ahref="#syntax-rule-SPARQLExprExpression-template">above</a>.
1344
-
If present in the <a>scope</a>, the value of the scope variable <code>focusNode</code> MUST be <a>pre-bound</a> as the value of the SPARQL variable <code>this</code>.
1346
+
variable that is projected from the <code>SELECT</code> clause of the <code>select</code> query as defined <ahref="#syntax-rule-SPARQLExprExpression-template">above</a>
1347
+
when the query is evaluated against the <a>focus graph</a>.
1348
+
The value of <code>focusNode</code> is <a>pre-bound</a> as the value of the SPARQL variable <code>this</code>.
1349
+
The value of each scope variable is <a>pre-bound</a> as a SPARQL variable with the same name and value.
1350
+
A <a>failure</a> is produced when one of the scope variables is called <code>this</code>.
0 commit comments