History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-198
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Jeen Broekstra
Reporter: Jeen Broekstra
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

DISTINCT filter fails on query with optional clause

Created: 11/Nov/05 02:34 PM   Updated: 07/Feb/06 11:58 AM
Component/s: RDBMS Sail, SeRQL
Affects Version/s: 1.2, 1.2.1, 1.2.2
Fix Version/s: 1.2.3

Environment: Sesame 1.2.x with MySQL/RDBMS backend. See also http://www.openrdf.org/forum/mvnforum/viewthread?thread=750#2998


 Description   
The SeRQL 'DISTINCT' filter sometimes fails for queries incorporating an optional clause.

Sample data:

@prefix x: <URN:com:example#>.
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
x:abc rdf:type x:MyType ;
      skos:prefLabel "aaa" ;
      skos:altLabel "bbb" ;
      skos:altLabel "ccc" .
x:def rdf:type x:MyType ;
      skos:prefLabel "bbb" ;
      skos:altLabel "aaa" .

sample query:

select distinct uri, l1
from {uri} rdf:type {x:MyType};
           skos:prefLabel {l1};
           [skos:altLabel {l2}]
where l1 = "aaa" or l2 = "aaa"
using namespace skos = <http://www.w3.org/2004/02/skos/core#&gt;,
                x = <URN:com:example#>

obtained result:

URN:com:example#abc "aaa"
URN:com:example#abc "aaa"
URN:com:example#def "bbb"

expected result:

URN:com:example#abc "aaa"
URN:com:example#def "bbb"

The problem is likely related to the query optimizer in the MySQL SAIL that (wrongly) assumes the database can handle uniqueness issues on this type of query.

 All   Comments   Change History      Sort Order:
Comment by Jeen Broekstra [14/Nov/05 11:17 AM]
It was indeed the MySQL query optimizer. I have checked in a fix in CVS where queries with optional patterns are still explicitly filtered for duplicates (instead of having the database handling duplicate filtering).