good afternoon,
On 2014-12-24, at 11:43, Andy Seaborne <[email protected]> wrote:
> That would better. VALUES (?x) causes there to be a solution set to be
> joined in the algebra expression. VALUES is syntax, substitute() works on
> algebra expressions.
>
> substitute() is also affected by scoping which the definition ignores and
> shouldn't. Inner SELECTs and a WHERE with non-projected ?x is really a
> different variable.
this brings up the point which would benefit from more careful wording: how
does the semantics of a service clause compare to that of a subselect. in
particular, given the discussion in the federated query recommendation
regarding the evaluation as a select and the suggested means to propagate
bindings, the binding environment for the bgp within the service clause is
somewhat less than self-evident.
best regards from berlin,
>
> I've put these the W3C SPARQL errata to be fixed whenever.
>
> Thanks
> Andy
>
> On 23/12/14 20:55, Daniel Hernández wrote:
>> The specification says "EVERY occurrence":
>>
>> substitute(pattern, μ) = the pattern formed by replacing every
>> occurrence of a variable v in pattern by μ(v) for each v in dom(μ)
>>
>> However, I guest that it must be only occurrences in basic graph
>> patterns. For example, let us to consider the pattern:
>>
>> P = VALUES (?x) { ("a") }
>>
>> What is the result of substitute(P, {?x: "x"})?
>>
>> If I substitute every occurrence, then I will get:
>>
>> VALUES ("x") { ("a") }
>>
>> But the domain of mappings is limited to variables. So I guest that the
>> result must be:
>>
>> VALUES (?x) { ("a") }
>>
>> Lets consider P2 = {:s :p ?x} . VALUES (?x) { ("a") }. Then, I guest
>> that substitue(P2, {?x: "x"}) must be:
>>
>> {:s :p "x"} . VALUES (?x) { ("a") }
>>
>>
>> On Tue, 2014-12-23 at 20:22 +0000, Andy Seaborne wrote:
>>> 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
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
---
james anderson | [email protected] | http://dydra.com