egonw / rrdf

R package for handling RDF data.
Other
29 stars 11 forks source link

result rows may be missing, out of order #18

Closed alanruttenberg closed 10 years ago

alanruttenberg commented 11 years ago

The issue is that in convertIntoTable, the varNames are taken from the QuerySolution. But suppose you have selected from a variable that has no bindings for the query. Then it will not be included in the results that are provided because it is in no solution. Also, the ordering of variables is not guaranteed in the QuerySolution instances. Instead use the varnames parsed from the XML head element.

    List<String> varnames = results.getResultVars();

private static StringMatrix convertIntoTable( PrefixMapping prefixMap, ResultSet results) { StringMatrix table = new StringMatrix(); int rowCount = 0; --> List resultVarNames = results.getResultVars() while (results.hasNext()) { rowCount++; QuerySolution soln = results.nextSolution();

not this: Iterator varNames = soln.varNames(); instead: Iterator varNames = resultVarNames.iterator();

egonw commented 10 years ago

Applied in 2.0.1.