[redland-dev] [Rasqal RDF Query Library 0000417]: SELECT DISTINCT sometimes returns duplicates

Mantis Bug Tracker mantis-bug-sender at librdf.org
Fri Jan 28 02:29:19 CET 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=417 
====================================================================== 
Reported By:                dbrnz
Assigned To:                
====================================================================== 
Project:                    Rasqal RDF Query Library
Issue ID:                   417
Category:                   api
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Query Language:             SPARQL 
====================================================================== 
Date Submitted:             2011-01-28 01:29
Last Modified:              2011-01-28 01:29
====================================================================== 
Summary:                    SELECT DISTINCT sometimes returns duplicates
Description: 
This happens when a variable has a NULL value (resulting say from an OPTIONAL
clause), because NULL compared with NULL is returning False.

The reason is buried in rasqal_literal.c -- the following patch fixes it:

diff --git a/src/rasqal_literal.c b/src/rasqal_literal.c
index adc11f8..56f69ba 100644
--- a/src/rasqal_literal.c
+++ b/src/rasqal_literal.c
@@ -2452,7 +2452,7 @@ rasqal_literal_equals_flags(rasqal_literal* l1,
rasqal_literal* l2,
   /* NULL literals */
   if(!l1 || !l2) {
     /* if either is not null, the comparison fails */
-    return (l1 || l2);
+    return !(l1 || l2);
   }
 
 #if RASQAL_DEBUG > 1

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-01-28 01:29 dbrnz          New Issue                                    
======================================================================



More information about the redland-dev mailing list