W3C home > Mailing lists > Public > www-rdf-interest@w3.org > May 2002

Re: Query and storage

From: Geoff Chappell <geoff@sover.net>
Date: Fri, 24 May 2002 10:13:17 -0400
Message-ID: <106001c2032d$269f7030$825ec6d1@goat1>
To: "Dave Reynolds" <der@hplb.hpl.hp.com>, "Dan Brickley" <danbri@w3.org>
Cc: "Graham Klyne" <GK@ninebynine.org>, "Seaborne, Andy" <Andy_Seaborne@hplb.hpl.hp.com>, <www-rdf-interest@w3.org>

----- Original Message -----
From: "Dave Reynolds" <der@hplb.hpl.hp.com>


[...]

> To give a concrete example. I have a simple data set where there are
several
> properties that have multiple values (these are things like comments,
> annotations and ratings by a collection of users of some set of content
items).
> If I just want the values of one property or the values of all properties
then
> reponse-as-query-binding works fine. However, suppose I want to retrieve
the
> value of a specific set properties, such as:
>    ?x ep:comments ?c &
>    ?x ep:annotations ?a &
>    ?x ep:ratings ?r
>
> In an SQL like system I should get all combinations of the binding tuple
> (?x, ?c, ?a, ?r). If there are 10 values of each property then this gives
1000
> binding entries. Whereas all I'm interested in for my application is the
set of
> distinct property values to present to a user, of which there are 30 in
this
> case.

A sufficiently powerful query system would allow you to express exactly what
you want returned. For example if you don't want the combinatorial result in
RDFQL you could say something like:

select ?x ?v ?p using ds where
    ({[ep:comments] ?x ?v} and ?p=[ep:comments]) or
    ({[ep:annotations] ?x ?v} and ?p=[ep:annotations]) or
    ({[ep:ratings] ?x ?v} and ?p=[ep:ratings])
order by ?p asc alpha

or even as (using our newer syntax):

var rs = (select ?x ?p ?l using ds where
       {[rdf:type] ?x [ep:Something]} and {?p ?x ?v} and
           groupby(?x, ?p)(?l=listof(?v)));


At a lower level in our query process there are instances when we do use
simple graph matching. For example in the query above, if the
datasource("ds" in query) being queried is a remote source, the query will
be decomposed into multiple triple queries ( ({[ep:comments] ?x ?v} ,
({[ep:annotations] ?x ?v}, ({[ep:ratings] ?x ?v} ). There are several
reasons for doing this - first to keep a simple interface to data sources
and second so that federated results can be returned when querying against
multiple data sources.


> Dave

-Geoff
Received on Friday, 24 May 2002 09:46:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:54 GMT