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

Key: SES-237
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Gunnar Aastrand Grimnes
Votes: 0
Watchers: 0
Operations

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

Ordering of query.getColumnHeaders is wrong when select * queries are used.

Created: 13/Feb/06 06:58 PM   Updated: 22/Jan/07 11:39 PM
Component/s: SeRQL, SPARQL
Affects Version/s: 2.0-alpha-3
Fix Version/s: 2.0-alpha-4

Environment: n/a


 Description   
Hi,

Not 100% sure about this, but it seems that given a query like:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT * WHERE { ?x foaf:name ?name.}

The query class will return the result-tuples in the order x,name...
but calling Query.getColumnHeaders will return [name,x]
I've not tried for queries with more variables, so I can't confirm whether this is always in the reverse order, or just plain wrong.

For queries where the variables are listed in the select clause this works fine.

Cheers


 All   Comments   Change History      Sort Order:
Comment by Ron Alford [17/Feb/06 06:08 PM]
(disclaimer: I have nothing to do with Sesame)
From http://www.w3.org/TR/rdf-sparql-XMLres/#head it states:
"""
The order of the variable names in the sequence is the order of the variable names given to the argument of the SELECT statement in the SPARQL query. If SELECT * is used, the order of the names is undefined.
"""

It would seem that Sesame's behavior is correct (in that the behavior is undefined).

I dont care what order they come back in - I just care that I can map the results to the right variables.
I.e. I'm not after the same order as the one they appear in the triple patterns, but i'm after consistency between the arraylists returned by evaluate and the names returned by getColumnHeaders.


Comment by Jeen Broekstra [29/Jun/06 03:15 PM]
FWIW in Sesame 2-alpha-4 we have introduced a completely new QueryResult interface which explicitly works with variable bindings. getColumnHeaders() is replaced by QueryResult.getBindingNames() and one gets actual values by giving their binding name (rather than an integer index). So solution tuples are no longer ordered with respect to the original query.