Strabon

changeset 397:9cb1f1314e7b

fixed bug that was causing SPARQL results to be rendered out of order regarding their respective binding names, when HTML is selected
author Babis Nikolaou <charnik@di.uoa.gr>
date Thu Jun 28 15:50:00 2012 +0300 (2012-06-28)
parents f3b936097b91
children d8e50c09be54
files generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java resultio/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriter.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Jun 28 15:23:41 2012 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Jun 28 15:50:00 2012 +0300
     1.3 @@ -705,7 +705,7 @@
     1.4  				} else {
     1.5  					info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type);
     1.6  					
     1.7 -					// set increaseIndex to <tt>true</tt> for geometries onlye (see commend below)
     1.8 +					// set increaseIndex to <tt>true</tt> for geometries only (see commend below)
     1.9  					if (type == ResultType.WKB) {
    1.10  						increaseIndex = true;
    1.11  					}
     2.1 --- a/resultio/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriter.java	Thu Jun 28 15:23:41 2012 +0300
     2.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriter.java	Thu Jun 28 15:50:00 2012 +0300
     2.3 @@ -2,6 +2,7 @@
     2.4  
     2.5  import java.io.IOException;
     2.6  import java.io.OutputStream;
     2.7 +import java.util.LinkedList;
     2.8  import java.util.List;
     2.9  
    2.10  import org.openrdf.model.BNode;
    2.11 @@ -28,6 +29,11 @@
    2.12  	 */
    2.13  	private stSPARQLXMLWriter xmlWriter;
    2.14  	
    2.15 +	/**
    2.16 +	 * The ordered list of binding names of the result.
    2.17 +	 */
    2.18 +	private List<String> bindingNames;
    2.19 +	
    2.20  	public stSPARQLResultsHTMLWriter(OutputStream out) {
    2.21  		this(new stSPARQLXMLWriter(out));
    2.22  	}
    2.23 @@ -42,6 +48,9 @@
    2.24  			throws TupleQueryResultHandlerException {
    2.25  		
    2.26  		try {
    2.27 +			// keep the order of binding names
    2.28 +			this.bindingNames = bindingNames;
    2.29 +			
    2.30  			// write Table header containing the bindings
    2.31  			xmlWriter.startTag(TABLE_ROW_TAG);
    2.32  			for (String bindingName: bindingNames) {
    2.33 @@ -72,7 +81,8 @@
    2.34  			StringBuilder value = new StringBuilder();
    2.35  			
    2.36  			xmlWriter.startTag(TABLE_ROW_TAG);
    2.37 -			for (Binding binding : bindingSet) {
    2.38 +			for (String bindingName : bindingNames) {
    2.39 +				Binding binding = bindingSet.getBinding(bindingName);
    2.40  				value.append(binding.getValue().stringValue());
    2.41  				
    2.42  				if (binding.getValue() instanceof BNode) {