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

RE: [ISSUE-8] subqueries and datasets

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Fri, 8 May 2009 14:29:52 +0000
To: Steve Harris <steve.harris@garlik.com>, Lee Feigenbaum <lee@thefigtrees.net>
CC: SPARQL Working Group <public-rdf-dawg@w3.org>
Message-ID: <B6CF1054FDC8B845BF93A6645D19BEA362D15FCA84@GVW1118EXC.americas.hpqcorp.net>


> -----Original Message-----
> From: public-rdf-dawg-request@w3.org [mailto:public-rdf-dawg-
> request@w3.org] On Behalf Of Steve Harris
> Sent: 8 May 2009 11:35
> To: Lee Feigenbaum
> Cc: SPARQL Working Group
> Subject: Re: [ISSUE-8] subqueries and datasets
> 
> 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.

+1 - I'm for clarity of overall model here.

Does anyone have a concrete use case for a varying dataset?  I can't think of one that isn't merely constructed for the purpose.

So I advocate as a design starting point that the dataset of the query is the same as subquery.
 
1/ Subqueries can be calculating something like a COUNT that will be used further in the query (in my experience this is the primary use of subqueries).

2/ The protocol can only apply to the whole query.

3/ Only need to analysis the top of the query to see which graphs are accessible to the query.


(Using GRAPH can get at the other graphs in the dataset)

Note the case of:

GRAPH <foo> {
 ....
 { SELECT * .... }
}

This is a compositionality argument that the default graph of the subSELCT should be the same graph as is named <foo> in the dataset.  But then the default graph is not accessible except by name if it has one).

> 
> 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:

Yes - you would be able to put graph into the dataset at the top.  Databases like it that way,

	Andy


> 
> 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.
> 
> - Steve
> 
> --
> Steve Harris
> Garlik Limited, 2 Sheen Road, Richmond, TW9 1AE, UK
> +44(0)20 8973 2465  http://www.garlik.com/

> Registered in England and Wales 535 7233 VAT # 849 0517 11
> Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10
> 9AD
> 

Received on Friday, 8 May 2009 14:31:17 GMT

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