W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > November 2011

Re: SPARQL 1.1 - LeftJoin definition

From: Eric Prud'hommeaux <eric@w3.org>
Date: Mon, 28 Nov 2011 12:10:16 -0500
To: David McNeil <dmcneil@revelytix.com>
Cc: public-rdf-dawg-comments@w3.org
Message-ID: <20111128171015.GG29120@w3.org>
* David McNeil <dmcneil@revelytix.com> [2011-11-28 10:13-0600]
> On Mon, Nov 28, 2011 at 9:24 AM, Eric Prud'hommeaux <eric@w3.org> wrote:
> 
> > I think this comes from a mismatch between the explanatory text and
> > the definition.
> >
> 
> Eric - Ah yes, it seems I was confused. So a few questions
> 
> 1) if the example you provided was changed to select the ?match variable as
> well as ?label, then what would the result be?

I expect that to, as you're probably getting at, only change the
projection, i.e. {(label → "COMPAT PASS", match → 1)}
(and likewise test → true).


> 2) it looks like that example is taken from a compatibility test suite, do
> you have a link to that test? I looked but could not find it online.

Nope, just whipped it up. I'm a big fan of making tests easy to
read. To that end, I proposed that BINDINGS be allowed in SPARQL
subqueries, but didn't get traction. [[
  SELECT ?label ?match
  {
      {
          {SELECT*{BIND(1 AS?match)}}
      } OPTIONAL {
          {SELECT*{BIND("COMPAT PASS" AS?label) BIND(1 AS?match)BIND(true  AS?test)}} UNION
          {SELECT*{BIND("COMPAT FAIL" AS?label) BIND(1 AS?match)BIND(false AS?test)}} UNION
          {SELECT*{BIND("INCOMPAT"    AS?label) BIND(2 AS?match)BIND(true  AS?test)}}
          FILTER (?test)
      }
  }
]] becomes [[
  SELECT ?label ?match
  {
      { SELECT*{} BINDINGS (?match) {(1)} }
      OPTIONAL {
          { SELECT*{} BINDINGS (?label ?match ?test) {
              ("COMPAT PASS" 1 true)
              ("COMPAT FAIL" 1 false)
              ("INCOMPAT"    2 true)}
          }
          FILTER (?test)
      }
  }
]] , but then everyone who wants to pass any test has to implement
subqueries (probably not the first thing on their punch list).


> 3) is there a process to get the explanatory text adjusted in the spec?

I think your comment (and to some degree, by reply) is that process.


> 4) Given that definition, can't the Filter be pushed down below the
> LeftJoin? In this way LeftJoin could be simplified because it would no
> longer need to take an expression.

If I understand, that would remove compatible rows with failed
filters, as opposed to retaining the row on the left side of the
optional.


> Thanks for your help.
> -David

-- 
-ericP
Received on Monday, 28 November 2011 17:10:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 28 November 2011 17:10:46 GMT