Bug #34
NUC-disjunction fails when one term is unconstrained.
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
fixed
Description
The following is a minimal example that triggers the bug:
<br/>
<br/>
create <<a href="local:///topazproject#test>;">local:///topazproject#test&gt;;</a>
<br/>
insert
<br/>
<foo:one> <p:type> <t:p>
<br/>
<foo:one> <p:hasA> <bar:one>
<br/>
<foo:one> <p:hasB> 'mollusks'
<br/>
<br/>
<foo:two> <p:type> <t:p>
<br/>
<foo:two> <p:hasA> <bar:two>
<br/>
<foo:two> <p:hasB> 'mollusks'
<br/>
<br/>
into <<a href="local:///topazproject#test>;">local:///topazproject#test&gt;;</a>
<br/>
<br/>
select $a $t from <<a href="local:///topazproject#test">local:///topazproject#test</a>> where
<br/>
$b <p:type> <t:p> and
<br/>
$b <p:hasA> $a and
<br/>
(
<br/>
($b <p:hasB> 'mollusks' and $t <<a href="http://mulgara.org/mulgara#is">http://mulgara.org/mulgara#is</a>> '0')
<br/>
or
<br/>
($t <<a href="http://mulgara.org/mulgara#is">http://mulgara.org/mulgara#is</a>> '1')
<br/>
);
<br/>
<br/>
The result is
<br/>
<br/>
QueryException thrown in resolve:
<br/>
org.mulgara.query.QueryException: Failed to resolve query
<br/>
Caused by: org.mulgara.query.TuplesException: Prefix failed to meet defined minimum prefix
<br/>
Updated by Andrae Muys - almost 16 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.
Updated by Andrae Muys - almost 16 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.
Updated by ronald - almost 16 years ago
This works for us. We tested the original query that lead to this bug report. Many thanks.