RDFLib/rdflibissueplayground — Issue #13: graph.query should return collections.namedtuple
Author: gjhiggins
Created: 2012-02-20 05:28:29+00:00
State: open
Labels: open

gjhigg...@gmail.com, 2010-09-14T20:57:46.000Z
Migrated from rdflib issues, posted by drewpca

graph.query returns a sequence of tuples, but for almost no cost, and full
backward compatibility, they could be collections.namedtuple objects instead.

Then we can write code like this:

for row in graph.query("SELECT ?huge ?list ?of ?vars ..."):
print row.huge, row.vars
print repr(row) # nicer than before

I would expect unbound variables to still be in the tuple, as they are now.

Comment 1 by gromgull
After my recent query result changes this actually is again an rdflib issue - but it's a good idea, and it's simple to implement. I'll have a look.