Project

General

Profile

Bug #34

NUC-disjunction fails when one term is unconstrained.

Added by ronald - about 16 years ago. Updated about 15 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Mulgara
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
fixed

Description

The following is a minimal example that triggers the bug:
<br/>

<br/>
&nbsp;&nbsp;&nbsp;&nbsp;create &lt;<a href="local:///topazproject#test&gt;;">local:///topazproject#test&amp;gt;;</a>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;insert
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo:one&gt; &lt;p:type&gt; &lt;t:p&gt;
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo:one&gt; &lt;p:hasA&gt; &lt;bar:one&gt;
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo:one&gt; &lt;p:hasB&gt; 'mollusks'
<br/>

<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo:two&gt; &lt;p:type&gt; &lt;t:p&gt;
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo:two&gt; &lt;p:hasA&gt; &lt;bar:two&gt;
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo:two&gt; &lt;p:hasB&gt; 'mollusks'
<br/>

<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;into &lt;<a href="local:///topazproject#test&gt;;">local:///topazproject#test&amp;gt;;</a>
<br/>

<br/>
&nbsp;&nbsp;&nbsp;&nbsp;select $a $t from &lt;<a href="local:///topazproject#test">local:///topazproject#test</a>&gt; where
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$b &lt;p:type&gt; &lt;t:p&gt; and
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$b &lt;p:hasA&gt; $a and
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;($b &lt;p:hasB&gt; 'mollusks' and $t &lt;<a href="http://mulgara.org/mulgara#is">http://mulgara.org/mulgara#is</a>&gt; '0')
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;($t &lt;<a href="http://mulgara.org/mulgara#is">http://mulgara.org/mulgara#is</a>&gt; '1')
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
<br/>

<br/>
The result is
<br/>

<br/>
&nbsp;&nbsp;QueryException thrown in resolve:
<br/>
&nbsp;&nbsp;org.mulgara.query.QueryException: Failed to resolve query
<br/>
&nbsp;&nbsp;Caused by: org.mulgara.query.TuplesException: Prefix failed to meet defined minimum prefix
<br/>

#1

Updated by Andrae Muys - over 15 years ago

Testing indicates that this is definately a problem with the handling of non-union compatible disjunction.
<br/>

<br/>
Specifically this bug only shows up in a query that contains a conjunction with at least two normal constraints and a nuc-disj.
<br/>

<br/>
The product/filter implementation currently used to provide correct joins in the presence of nuc-disj suppresses the prefixing of variables that may be unbound in one of the joins arguments.  Unfortunately the join optimisation has committed [[UnboundJoin]] to providing a prefix from the first to the second normal constraint.  The supression of this prefix then triggers the [[TuplesException]] above.
<br/>

<br/>
The base query shape required to trigger this is
<br/>

<br/>
Constraint($var) and Constraint($var) and ( Constraint($var) or Constraint(!var) )
<br/>

<br/>
The Constraint(!var) causes the [[UnboundJoin]] to supress the use of $var in *all* prefixing.
<br/>

<br/>
Fixing this will be fun.
#2

Updated by Andrae Muys - over 15 years ago

Confident now that this bug is fixed and fixed correctly.
<br/>

<br/>
There is code in [[TuplesOperations]] that catches the case where we could assume a prefix inappropriately (via definePrefix) that may not be available due to an unbound variable.
#3

Updated by ronald - over 15 years ago

This works for us. We tested the original query that lead to this bug report. Many thanks.

Also available in: Atom PDF