W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > March 2009

Re: Feature request: IN operator

From: Bob MacGregor <bob.macgregor@gmail.com>
Date: Thu, 5 Mar 2009 08:39:56 -0800
Message-ID: <a0d0f8f70903050839h7e69a92et1b77356e123f2346@mail.gmail.com>
To: Toby Inkster <tai@g5n.co.uk>
Cc: Orri Erling <erling@xs4all.nl>, Simon Gibbs <simon.gibbs@cantorva.com>, public-rdf-dawg-comments@w3.org
Hi Toby,

I'm wondering how literally you mean the phrase
      but rather builds an rdf:List.

One application I worked with had an IN operator that was implemented
to reference  arrays of integer encodings of URIs or Literals.  The lists
often had
tens of thousands of values.  A real rdf:List would not cut it.  The point
is,
as Orri mentions, there are very powerful optimizations that can be done
with
the IN operator.   It can be used as a way to compress the answers from one
query, and then forward them into another.  It can be used as a way to
compress a computation done in procedural code (Java, Python) and then
inject
the results into a query.   It would be a shame to downgrade it to something
that only
works well for tiny applications.

Cheers, Bob




On Thu, Mar 5, 2009 at 1:22 AM, Toby Inkster <tai@g5n.co.uk> wrote:

> On Thu, 2009-03-05 at 10:10 +0100, Orri Erling wrote:
>
> > variable IN (<expression_list>)
>
> The way I suggested it would be
>
>        variable1 IN variable2
>
> Where variable2 is an rdf:List. In particular, this could be a list
> specified as part of the SPARQL query as in my original example:
>
> > PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> > SELECT ?thing ?name
> > WHERE {
> >   ?thing ?p ?name .
> >   FILTER (?p IN (foaf:name foaf:nick rdfs:label))
> > }
>
> The inner set of brackets there is not part of the IN operator syntax,
> but rather builds an rdf:List.
>
> So it can just refer to a list defined in the graph itself:
>
> SELECT ?header
> WHERE {
>  ?thing a :httpHeader .
>  FILTER (?thing IN <#responseHeaders>)
> }
>
> --
> Toby Inkster <tai@g5n.co.uk>
>
>


-- 
=====================================
Robert MacGregor
bob.macgregor@gmail.com
Mobile: 310-469-2810
=====================================
Received on Thursday, 5 March 2009 16:40:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 5 March 2009 16:40:32 GMT