W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2009

Re: [ISSUE-8] subqueries and datasets

From: Lee Feigenbaum <lee@thefigtrees.net>
Date: Fri, 08 May 2009 10:12:09 -0400
Message-ID: <4A043DB9.7080807@thefigtrees.net>
To: SPARQL Working Group <public-rdf-dawg@w3.org>
Steve Harris wrote:
> On 8 May 2009, at 05:40, Lee Feigenbaum wrote:
>> It seems to me that ARQ's behavior is simple and avoids this problem, 
>> but I'm not sure at what cost. My natural inclination is that its 
>> valuable for queries & their subqueries to be able to target different 
>> graphs.
>>
>> Current recommendation? Unsure.
>>
>> Suggested next steps? Determine whether we have reasonable use cases 
>> to require that subqueries can target different datastes from parent 
>> queries.
> 
> Good summary.
> 
> For the record, I think it makes most sense to ban FROM in subqueries.
> 
> The specification of FROM is a little unclear in my mind, but by my 
> understanding it should be possible to rewrite any sub-FROM'd query 
> using GRAPH, eg. if you want to ask something like:
> 
> FROM <a>
> SELECT ?x WHERE {
>   ?x a :Person .
>   {
>     FROM <b>
>     SELECT ?x, ?z WHERE {
>       ?x :knows ?z
>     }
>   }
> }
> 
> you could also write something like:
> 
> FROM <a>, <b>
> SELECT ?x WHERE {
>   GRAPH <a> { ?x a :Person }
>   {
>     SELECT ?x, ?z WHERE {
>       GRAPH <b> { ?x :knows ?z }
>     }
>   }
> }
> 
> Possibly you need to use FROM NAMED, not FROM.

In this case, yes, but I think if your subquery is relying on the FROM 
merging together multiple graphs, then you can't recast it in this way.

(I can try to come up with an example later, but the key point is that 
FROM lets you write down triple patterns that can span multiple 'input' 
graphs without knowing ahead of time which triple patterns match from 
which graph. FROM NAMED and GRAPH end up requiring that the triple 
patterns inside GRAPH { ... } all match a single named graph.

Lee
Received on Friday, 8 May 2009 14:12:50 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:38 GMT