# Re: SPARQL 1.1 - LeftJoin definition

From: Eric Prud'hommeaux <eric@w3.org>
Date: Mon, 28 Nov 2011 10:24:31 -0500
To: David McNeil <dmcneil@revelytix.com>

Message-ID: <20111128152430.GD29120@w3.org>
```* David McNeil <dmcneil@revelytix.com> [2011-11-28 08:34-0600]
> On Thu, Nov 24, 2011 at 2:32 PM, Eric Prud'hommeaux <eric@w3.org> wrote:
>
> > LeftJoin(Ω1, Ω2, expr) =
> >    { merge(μ1, μ2) | μ1 in Ω1 and μ2 in Ω2, and μ1 and μ2 are compatible
> > and expr(merge(μ1, μ2)) is true }
> > ∪
> >    { μ1 | μ1 in Ω1 | ∄ μ2 in Ω2 | μ1 and μ2 are compatible and
> > expr(merge(μ1, μ2)) is true }
> >
> > ?
> >
>
> Eric -  Doesn't this definition have a problem in the case where there is a
> u1 for which there is a u2 that is compatible and expr(...) is true and
> there is another u2 that is compatible and expr(...) is false? I think the
> definition you gave in this email would only produce a single output for
> u1,

I understand this to be the correct output given:

Diff(Ω1, Ω2, expr) =
{ μ | μ in Ω1 such that ∀ μ′ in Ω2,
either μ and μ′ are not compatible or μ and μ'
are compatible and expr(merge(μ, μ')) has an effective boolean value
of false }

LeftJoin(Ω1, Ω2, expr) = Filter(expr, Join(Ω1,
Ω2)) ∪ Diff(Ω1, Ω2, expr)

that is [[
SELECT ?label
{
{
{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)
}
}
]]
should yield only {(label → "COMPAT PASS")}

>     whereas the main definition of LeftJoin in the SPARQL 1.1 draft would
> have two outputs for u1: one to reflect the u2 where expr(...) is true and
> another to reflect the u2 where expr(...) is false.

I think this comes from a mismatch between the explanatory text and
the definition.

> -David

--
-ericP
```
Received on Monday, 28 November 2011 15:25:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:52:12 UTC