Re: the LHS of OPTIONAL

Steve Harris wrote:
> 
> 
> On 23 Nov 2006, at 17:37, Fred Zemke wrote:
> 
>>
>> { T1 .
>> T2 . }
>> OPTIONAL { T3 }
>> OPTIONAL { T4 }
>> OPTIONAL { T5 }
> 
> I still prefer it without the extra {}s.
> 
>> and the query processor can effectively supply the rest
>> as shown in your expansion.
>>
>>>
>>> Plus, explaining, and implementing the difference between:
>>>
>>> { T1 . T2 . } OPTIONAL { T3 }
>>>
>>> and
>>>
>>> T1 . { T2 } OPTIONAL { T3 }
>>>
>>> is not something I relish.
>>
>> On that we have no choice, since both are presumably legal
>> in the language, whether we adopt my suggestion or not.
> 
> Yes, though they may or may not mean different things. I'm not clear on 
> that.
> 
> My engine treats both of those as
> 
> T1 . T2 . OPTIONAL { T3 }

The algebra converts that to

T1 join T2 leftjoin T3 left-associatively:

LeftJoin(Join(T1, T2), T3)

> 
> which I suspect is not correct. 

It is correct under the declarative/current semantics because it's everything 
to the left of the OPTIONAL - the whole of the group and

   T1 T2 == T1 { T2 }

[[It's not so straight forward under the constructive semantics because 
inserting {} will make the difference with filters.]]

> Eg. if T1 fails, but T2 succeeds should 
> the OPTIONAL be attempted? 

No, for neither reading.  If T1 fails, then the group fails regardless of 
anything else.

	Andy

>If T1 fails in my engine then T2 and the 
> OPTIONAL will be shortcutted.

As does ARQ in both the engine for the current situation and the engine for 
the algebra, so I hope it right :-)  But it's not really the OPTIONAL that 
makes the different, its the fact the T1 failing causes the group to fail.

	Andy

> 
> - Steve
> 

Received on Thursday, 23 November 2006 19:42:13 UTC