W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > May 2008

Re: SPARQL and Subqueries

From: Ivan Mikhailov <imikhailov@openlinksw.com>
Date: Mon, 05 May 2008 01:32:44 +0700
To: Danny Ayers <danny.ayers@gmail.com>
Cc: Orri Erling <erling@xs4all.nl>, public-rdf-dawg-comments@w3.org
Message-Id: <1209925964.9514.23.camel@master.iv.dev.null>

Hello Danny,

1.
The really useful example is an occurrence of ?ms+>tpcd:has_nation
+>tpcd:has_region+>tpcd:name in a result set or in a filter, meaning
that you don't have to write trivial triple patterns at all.

2.
There's no convenient way of writing chain of nested OPTIONAL clauses,
so ?ms*>tpcd:has_nation*>tpcd:has_region*>tpcd:name
is really shorter than 

OPTIONAL { ?ms tpcd:has_nation ?t1 .
    OPTIONAL { ?t1 tpcd:has_region ?t2 .
        OPTIONAL { ?t2 tpcd:name ?regionname }
in a group pattern and ?regionname in a result set.

3.
The use of +> establish a clear distinction between "interesting" triple
patterns and "boring" retrieval of values from nested data structures.

4.
This is after Polukeev's query language for KOMPASS database, the only
difference is that we use "+>" instead of Polukeev's "." operator. I've
recalled KOMPASS only after the completion of our implementation; now
I'm trying to find that antique KOMPASS textbook, maybe we should
re-invent even more bicycles. Maybe we might introduce "<+" operator to
reproduce ".." KOMPASS operator in SPARQL (and make SPARQL as obfuscated
as KOMPASS language :)

5.
This syntax turns large number of short strings of a query into small
number of long strings so I can better evangelize SPARQL by saying
"look, your whole page of SQL SELECT fits into no more than six lines of
SPARQL-BI" :)

Best Regards,

Ivan Mikhailov,
OpenLink Software.


On Fri, 2008-01-25 at 10:52 +0100, Danny Ayers wrote: 
> On 24/01/2008, Orri Erling <erling@xs4all.nl> wrote:
> 
> > For a second iteration of SPARQL, we propose aggregation and subqueries.
> 
> Yup, I reckon the former is essential and the latter highly desirable
> for increased application of SPARQL.
> 
> > http://virtuoso.openlinksw.com/blog/
> 
> > where I present a sample of an extension for subqueries and aggregates.
> >
> > There is also a syntax sugar for abbreviating chains of joins.
> 
> I'm a little confused:
> 
> [[
> We notice the pattern { ?ms+>tpcd:has_nation+>tpcd:has_region
> tpcd:name 'EUROPE' } which is a shorthand for { ?ms tpcd:has_nation
> ?t1 . ?t1 tpcd:has-region ?t2 . ?t2 tpcd:has_region ?t3 . ?t3
> tpcd:name "EUROPE" }
> ]]
> 
> The ?t variables don't seem to be available from the shorthand
> version, and if you take them out of the example you have:
> 
> { ?ms tpcd:has_nation [ tpcd:has-region [ tpcd:name "EUROPE" ]]] }
> 
> - which isn't exactly verbose. (I assume the extra has_region is a typo).
> 
> Am I missing something?
> 
> > Aside these, there is the issue of discovery and description.  We will
> > implement a little database statistics  graph for distributed query
> > optimization and data discovery. More on this later.
> 
> Looking forward to it.
> 
> Cheers,
> Danny.
> 
Received on Sunday, 4 May 2008 18:35:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 4 May 2008 18:35:49 GMT