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

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

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

distinct filter fails on label() function

Created: 05/Jan/05 10:41 AM   Updated: 13/May/05 10:45 PM
Component/s: SeRQL
Affects Version/s: 1.1
Fix Version/s: 1.2-RC1


 Description   
(see http://www.openrdf.org/forum/mvnforum/viewthread?thread=405 )

The DISTINCT filter in queries does not work properly in combination with literal functions (e.g. label()) used in the projection clause, which may sometimes lead to duplicate results even when DISTINCT is used.

Example:

<rdf:RDF
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

<rdf:Property rdf:about="#externalMetadata">
    <rdfs:label xml:lang="en">External Metadata</rdfs:label>
    <rdfs:label>External Metadata</rdfs:label>
  </rdf:Property>
</rdf:RDF>

The query:

select distinct Prop, label(propLabel)
from {Prop} rdf:type {rdf:Property};
             rdfs:label {propLabel}


The result:

my:externalMetadata External Metadata
my:externalMetadata External Metadata

The probable cause is that the check for result equality validates on the actual value of the literal, rather than the result of the label() function. In the above example, one result is the function output of the literal "External Metadata"@en, the other of "External Metadata" (without a language tag).


 All   Comments   Change History      Sort Order:
Comment by Jeen Broekstra [23/Feb/05 10:27 AM]
I've checked in a unit test for this issue:

org.openrdf.sesame.query.serql.SeRQLxmlTableTest, test011.

Current test succeeds for in-memory repositories (so the default implementation is now correct). A fix to the RDBMS query optimizer seems to have solved the issue for RDBMS-based repositories as well.

Comment by Bodo Hüsemann [23/Feb/05 11:59 AM]
Well done! The bug is resolved. I checked the issue with in-memory and rdbms (mysql&postgresql) repositories.

Thanks,
Bartman

Comment by Arjohn Kampman [22/Apr/05 10:35 AM]
Issue still (or again?) exists in combination with an RDBMS Sail (tested with MySQL).

Comment by Arjohn Kampman [22/Apr/05 01:31 PM]
'distinct' flag in GrpahPatternQuery object is no longer disabled if the projection contains "value-transforming functions" like label(), namespace(), etc.