- From: Daniel Hernández <daniel@degu.cl>
- Date: Thu, 14 Jul 2016 11:25:57 -0400
- To: public-sparql-exists@w3.org
Hi all,
With the same data that Andy proposed, another query is:
Query 2:
---------------------
PREFIX : <http://example/>
SELECT * {
?s :p ?o
FILTER EXISTS { SELECT ?p { ?s ?p 1 } }
}
In this case ?s is not in-scope on the inner graph pattern. However,
Virtuoso and rdf4j
assume that ?s in the outer and inner graph patterns are correlated.
That is, the result is
Outcome 1:
-----------------
| s | p | o |
=================
| _:s1 | :p | 1 |
-----------------
I think that substituting a variable that occurs in a basic graph
pattern has some problems
that are originated by the two roles that it has. First, it has the role
of naming a value from
the data. Second, it has the role of using a value from the current
solution mapping.
In the report (http://arxiv.org/abs/1606.01441) we normalize a query
before applying
substitution:
Query 3:
---------------------
PREFIX : <http://example/>
SELECT * {
?s :p ?o
FILTER EXISTS { SELECT ?p { ?z ?p 1 FILTER (!(bound(?z) &&
bound(?s)) || ?z = ?s) } }
}
After the normalization, the inner graph pattern is equivalent with the
previous one, but
the variable ?s does not occur in a basic graph pattern, so it only has
the role of using values.
In this case substitution is safe respect to the issue of blank nodes.
Daniel
Received on Thursday, 14 July 2016 15:26:26 UTC