Closed Bug 305981 Opened 19 years ago Closed 1 year ago

rdf bound tree - doesn't sort correct for <binding> columns, if assertion doesn't exist

Categories

(Core :: XUL, defect)

1.7 Branch
x86
Windows XP
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: u130342, Unassigned)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

in case one has these rdf-triples
s1 -> a -> 1
s1 -> b -> 2
s2 -> a -> 2
s3 -> a -> 3
s4 -> a -> 4
s4 -> b -> 4

and a tree with triple
?uri -> a -> ?a
and a binding
?uri -> b -> ?b

he cannot sort by predicate b because for s2 and s3 there is no triple

I believe the problem resides in nsXULTreeBuilder.cpp
nsXULTreeBuilder::CompareMatches(nsTemplateMatch* aLeft, nsTemplateMatch* aRight)

http://lxr.mozilla.org/seamonkey/source/content/xul/templates/src/nsXULTreeBuilder.cpp#1843

It only compares resources of same type nsIRDFLiteral/nsIRDFLiteral,
nsIRDFDate/nsIRDFDate, nsIRDFInt/nsIRDFInt, nsIRDFBlob/nsIRDFBlob.

All other combinations result in equal. This terribly affects the quicksort
algorithm.



Reproducible: Always

Steps to Reproduce:
1. create rdf with missing assertions
2. create sortable xul-tree
3. sort by column which have missing targets  (?item -> #predicate -> (not
available)


Actual Results:  
sort order incorrect

Expected Results:  
I suggest two things (pseudocode):

1. Comparison with missing nodes:

if l and r are missing   return 0 // l==r
if just l is missing   return -1 // l<r
if just r is missing   return  1 // l>r
compare String(l) with String(r) and return result of comparison

2. Comparison of resources
because targets could be resources as well (web sites), resources should be
compared like literals.


FF1.0.6
DeerPark alpha 2
Attached file possible imlementation
tried to make some code, added the changed code snippet  
(note: just have the source code .. it may contain errors)

Maybe changing it mor solves the bug for unstable sort.
Sort will be stable if it never returns 0. This could be achived by performing
a natural sort of items whenever 0 gets returned at the moment.
You might want to discuss this in newsgroups (netscape.public.dev.xul) or attach
a CVS diff and ask for a review.
Component: General → XP Toolkit/Widgets: XUL
Product: Firefox → Core
QA Contact: general → xptoolkit.xul
Version: unspecified → 1.7 Branch
Depends on: 285631
Seems code moved to
nsXULTemplateQueryProcessorRDF::CompareResults

http://lxr.mozilla.org/seamonkey/source/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp#453
Unfortunately  apples and eggs are still equal :-(
Attachment #194031 - Flags: review?(enndeakin)
Comment on attachment 194031 [details]
possible imlementation

You, or someone, needs to make a patch for this, and against nsXULTemplateQueryProcessorRDF
Attachment #194031 - Flags: review?(enndeakin) → review-
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
QA Whiteboard: qa-not-actionable

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --

Out of date.

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: