In SparqlEngine.php function joinOptionalTuples, the initial logic testing for one or more empty result sets seems wrong:
if(!$finalRes && !$res)
return array();
if(!$finalRes)
return $res;
if(!$res)
return $finalRes;
So for an optional join (where the optional results are passed in as $finalRes), if there are no results from the left graph (in which case there should be no optional results added), the entire optional result set is instead returned.
Unless I'm misunderstanding something, this should read instead:
if(!$finalRes && !$res)
return array();
if(!$finalRes || !$res)
return $res;
Logged In: YES
user_id=1857680
Originator: NO
Definitely a big with the handling of OPTIONALs - this fix seems to work for me but haven't tested extensively.
Logged In: YES
user_id=2182283
Originator: NO
Yes, I have the same issue. Your fix seemed to solve the problem.
I've submitted a patch - maybe it'll speed-up the process:
http://sourceforge.net/tracker/index.php?func=detail&aid=2053455&group_id=63257&atid=503363