Project

General

Profile

Bug #150

OPTIONAL not returning expected results

Added by Paula Gearon over 13 years ago. Updated over 13 years ago.

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

0%

Estimated time:
Resolution:
fixed

Description

Unexpected results on an OPTIONAL clause. The toString on a query that demonstrates the problem is:

SELECT $o1 $o2
FROM http://mulgara.org/local/server1#
WHERE ( optional ( optional ( and
[$s urn:test:pred1 $o1 $-anon-ctx1]
[$-anon-ctx1 rdf:type http://mulgara.org/mulgara#sailModel
http://mulgara.org/mulgara#sailModel]
) ( and
[$s urn:test:pred2 $o2 $-anon-ctx4]
[$-anon-ctx4 rdf:type http://mulgara.org/mulgara#sailModel
http://mulgara.org/mulgara#sailModel]
)
) ( and
[$s urn:test:pred2 $o2 $-anon-ctx7]
[$-anon-ctx7 rdf:type http://mulgara.org/mulgara#sailModel
http://mulgara.org/mulgara#sailModel]
[$s urn:test:pred3 $o1 $-anon-ctx10]
[$-anon-ctx10 rdf:type http://mulgara.org/mulgara#sailModel
http://mulgara.org/mulgara#sailModel]
)
) GIVEN 0 columns: (1 rows
)

The data is generated with:

               con.add(subj1, pred1, obj1);
               con.add(subj1, pred2, obj2);
               con.add(subj1, pred3, obj3);

The results we get are:
var: $o2
tuples:
{$o2     $-anon-ctx10  $o1     $s      $-anon-ctx7  (1 rows)
[000037  000032  000039  000033  000032  ]
}

#1

Updated by Paula Gearon over 13 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

(In r1323) Found and fixed a pair of bugs when all variables are shared between two sides of an
optional join. Also updated optionalJoin to handle left and right sides not sharing
variables (a cartesian product), and now handling projection to extra variables when
the optional part of a join is empty.
Fixes #152
Fixes #150

Also available in: Atom PDF