The formal description is the helper operation 'Substitute'

http://www.w3.org/TR/sparql11-query/#defn_substitute

and the evaluation text just below that. SERVICE isn't special in anyway (whether it should be is whole different question!).

        Andy

On 23/12/14 19:50, Daniel Hernández wrote:
The motivation of my question was to confirm that occurrences of ?x must
be replaced by bindings in each of the solutions before sending the
query to another service. But I do not found a simpler way to write that
question. That's all.

Thanks!
Daniel

On Tue, 2014-12-23 at 18:49 +0000, Andy Seaborne wrote:
  >> What will be the result of this query?

Empty.

Firstly - the <a> in the query is highly unlikely to be the same <a> as
the data because the query and data have different base URIs. thsi
appies to the SERVICE and non-SERVICE cases.

The URI resolution of the query is at parse time so <p> inside the
SERVICE is the same <p> in the triple pattern

Adding a stable BASE, I get no results with Fuseki2 because the EXISTS
?x is substituted from the pattern.

The Fuseki2 log shows a call back of:

Query = SELECT  * WHERE   { <http://example/b> <http://example/p>
<http://example/c>}

which I guess is the core of your question?

        Andy

----------------------------
BASE <http://example/>
<a> <p> <b> .
<a> <q> <c> .
----------------------------
BASE <http://example/>

SELECT *
WHERE {
     { <a> <p> ?x }
     FILTER (
       EXISTS { SERVICE <http://localhost:3030/ds/query> { ?x <p> <c> } }
       )
}
----------------------------




On 23/12/14 15:04, Miguel Bento Alves wrote:
Daniel,

what is the point?

You didn’t clear if you have also a local dataset, but I think that the answer 
is the same, the result is empty. Why should be different?

(in this situations, normally, I test. Seeing is believing :) ).

In your dataset, instead of <a> <q> <c> you mean <a> <p> <c>?

Miguel



On 23 Dec 2014, at 14:34, Daniel Hernández <[email protected]> wrote:

Hello,

Let us consider a service <s> which default dataset contains the default
graph:

<a> <p> <b> .
<a> <q> <c> .

Let us consider the following query to be evaluated with the service <s>
described above:

SELECT *
WHERE { { <a> <p> ?x } FILTER ( EXISTS ( ?x <p> <c> ) ) }

I suppose that in this case the filter clause is evaluated for each
solution of the graph pattern on the left. Thus, it is evaluated for
{?x:<b>} and {?x:<c>}. Then the clauses will be:

{?x:<b>} --> EXISTS ( <b> <p> <c> )    (FALSE)
{?x:<c>} --> EXISTS ( <c> <p> <c> )    (FALSE)

Then, the result of this query will be empty.

Let us to consider the following query:

SELECT *
WHERE { { <a> <p> ?x }
         FILTER ( EXISTS ( SERVICE <s> { ?x <p> <c> } ) ) }

What will be the result of this query?

Regards,
Daniel






Reply via email to