You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/12/02 22:01:47 UTC

[3/4] jena git commit: Clean up classes in resultset package

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFInput.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFInput.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFInput.java
index b326abf..1832a06 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFInput.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFInput.java
@@ -18,169 +18,153 @@
 
 package org.apache.jena.sparql.resultset;
 
-import java.util.ArrayList ;
-
-import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.query.ResultSet ;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.shared.JenaException ;
-import org.apache.jena.shared.PropertyNotFoundException ;
-import org.apache.jena.sparql.core.Var ;
-import org.apache.jena.sparql.engine.binding.Binding ;
-import org.apache.jena.sparql.engine.binding.BindingFactory ;
-import org.apache.jena.sparql.engine.binding.BindingMap ;
-import org.apache.jena.sparql.vocabulary.ResultSetGraphVocab ;
-import org.apache.jena.vocabulary.RDF ;
-
-
-public class RDFInput extends ResultSetMem
-{
-    /** Process a result set encoded in RDF according to
-     *  <code>@link{http://www.w3.org/2001/sw/DataAccess/tests/result-set}#</code>
+import java.util.ArrayList;
+
+import org.apache.jena.atlas.logging.Log;
+import org.apache.jena.query.ResultSet;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.JenaException;
+import org.apache.jena.shared.PropertyNotFoundException;
+import org.apache.jena.sparql.core.Var;
+import org.apache.jena.sparql.engine.binding.Binding;
+import org.apache.jena.sparql.engine.binding.BindingFactory;
+import org.apache.jena.sparql.engine.binding.BindingMap;
+import org.apache.jena.sparql.vocabulary.ResultSetGraphVocab;
+import org.apache.jena.vocabulary.RDF;
+
+public class RDFInput extends ResultSetMem {
+    /**
+     * Process a result set encoded in RDF according to
+     * <code>@link{http://www.w3.org/2001/sw/DataAccess/tests/result-set}#</code>
      *
      * @param model
      */
-    public RDFInput(Model model)
-    {
+    public RDFInput(Model model) {
         buildFromDumpFormat(model);
     }
 
     // Convert from RDF model to in-memory result set
-    private void buildFromDumpFormat(Model resultsModel)
-    {
-        varNames = new ArrayList<>() ;
-        StmtIterator sIter = resultsModel.listStatements(null, RDF.type, ResultSetGraphVocab.ResultSet) ;
-        for ( ; sIter.hasNext() ;)
-        {
+    private void buildFromDumpFormat(Model resultsModel) {
+        varNames = new ArrayList<>();
+        StmtIterator sIter = resultsModel.listStatements(null, RDF.type, ResultSetGraphVocab.ResultSet);
+        for ( ; sIter.hasNext() ; ) {
             // For each root
-            Statement s = sIter.nextStatement() ;
-            Resource root = s.getSubject() ;
-            buildOneResource(root) ;
+            Statement s = sIter.nextStatement();
+            Resource root = s.getSubject();
+            buildOneResource(root);
         }
-        sIter.close() ;
-        reset() ;
-    }    
-        
-    private void buildOneResource(Resource root)
-    {
-        buildVariables(root) ;
-        int count = buildPreprocess(root) ;
+        sIter.close();
+        reset();
+    }
+
+    private void buildOneResource(Resource root) {
+        buildVariables(root);
+        int count = buildPreprocess(root);
         if ( root.getModel().contains(null, ResultSetGraphVocab.index, (RDFNode)null) )
-            buildRowsOrdered(root, count) ;
+            buildRowsOrdered(root, count);
         else
-            buildRows(root) ;
+            buildRows(root);
     }
-        
-    private void buildVariables(Resource root)
-    {
+
+    private void buildVariables(Resource root) {
         // Variables
-        StmtIterator rVarsIter = root.listProperties(ResultSetGraphVocab.resultVariable) ;
-        for ( ; rVarsIter.hasNext() ; )
-        {
-            String varName = rVarsIter.nextStatement().getString() ;
-            varNames.add(varName) ;
+        StmtIterator rVarsIter = root.listProperties(ResultSetGraphVocab.resultVariable);
+        for ( ; rVarsIter.hasNext() ; ) {
+            String varName = rVarsIter.nextStatement().getString();
+            varNames.add(varName);
         }
-        rVarsIter.close() ;
+        rVarsIter.close();
     }
 
-    private int buildPreprocess(Resource root)
-    {
-        StmtIterator solnIter = root.listProperties(ResultSetGraphVocab.solution) ;
-        int rows = 0 ;
-        int indexed = 0 ;
-        for ( ; solnIter.hasNext() ; )
-        {
-            Resource soln = solnIter.nextStatement().getResource() ;
-            rows++ ;
+    private int buildPreprocess(Resource root) {
+        StmtIterator solnIter = root.listProperties(ResultSetGraphVocab.solution);
+        int rows = 0;
+        int indexed = 0;
+        for ( ; solnIter.hasNext() ; ) {
+            Resource soln = solnIter.nextStatement().getResource();
+            rows++;
             if ( soln.hasProperty(ResultSetGraphVocab.index) )
-                indexed++ ;
+                indexed++;
         }
-        solnIter.close() ;
-        if ( indexed > 0 && rows != indexed )
-        {
-            Log.warn(this, "Rows = "+rows+" but only "+indexed+" indexes" ) ;
-            return rows ;
+        solnIter.close();
+        if ( indexed > 0 && rows != indexed ) {
+            Log.warn(this, "Rows = " + rows + " but only " + indexed + " indexes");
+            return rows;
         }
-        return rows ;
+        return rows;
     }
 
-    private void buildRowsOrdered(Resource root, int count)
-    {
-        Model m  = root.getModel() ;
+    private void buildRowsOrdered(Resource root, int count) {
+        Model m = root.getModel();
         // Assume one result set per file.
-        for ( int index = 1 ; ; index++ )
-        {
-            Literal ind = m.createTypedLiteral(index) ;
-            StmtIterator sIter = m.listStatements(null, ResultSetGraphVocab.index, ind) ;
-            if ( ! sIter.hasNext() )
-                break ;
-            Statement s = sIter.nextStatement() ;
+        for ( int index = 1 ;; index++ ) {
+            Literal ind = m.createTypedLiteral(index);
+            StmtIterator sIter = m.listStatements(null, ResultSetGraphVocab.index, ind);
+            if ( !sIter.hasNext() )
+                break;
+            Statement s = sIter.nextStatement();
             if ( sIter.hasNext() )
-                Log.warn(this, "More than one solution: index = "+index) ;
-            Resource soln = s.getSubject() ;
+                Log.warn(this, "More than one solution: index = " + index);
+            Resource soln = s.getSubject();
 
-            Binding rb = buildBinding(soln) ;
-            rows.add(rb) ;
-            sIter.close() ;
+            Binding rb = buildBinding(soln);
+            rows.add(rb);
+            sIter.close();
         }
         if ( rows.size() != count )
-            Log.warn(this, "Found "+rows.size()+": expected "+count) ;
+            Log.warn(this, "Found " + rows.size() + ": expected " + count);
     }
-    
-    private void buildRows(Resource root)
-    {
+
+    private void buildRows(Resource root) {
         // Now the results themselves
-        int count = 0 ;
-        StmtIterator solnIter = root.listProperties(ResultSetGraphVocab.solution) ;
-        for ( ; solnIter.hasNext() ; )
-        {
-            Resource soln = solnIter.nextStatement().getResource() ;
-            count++ ;
-
-            Binding rb = buildBinding(soln) ;
-            rows.add(rb) ;
+        int count = 0;
+        StmtIterator solnIter = root.listProperties(ResultSetGraphVocab.solution);
+        for ( ; solnIter.hasNext() ; ) {
+            Resource soln = solnIter.nextStatement().getResource();
+            count++;
+
+            Binding rb = buildBinding(soln);
+            rows.add(rb);
         }
-        solnIter.close() ;
-        
-        if ( root.hasProperty(ResultSetGraphVocab.size))
-        {
+        solnIter.close();
+
+        if ( root.hasProperty(ResultSetGraphVocab.size) ) {
             try {
-                int size = root.getRequiredProperty(ResultSetGraphVocab.size).getInt() ;
+                int size = root.getRequiredProperty(ResultSetGraphVocab.size).getInt();
                 if ( size != count )
-                    Log.warn(this, "Warning: Declared size = "+size+" : Count = "+count) ;
-            } catch (JenaException rdfEx) {}
+                    Log.warn(this, "Warning: Declared size = " + size + " : Count = " + count);
+            }
+            catch (JenaException rdfEx) {}
         }
     }
 
-    private Binding buildBinding(Resource soln)
-    {
+    private Binding buildBinding(Resource soln) {
         // foreach row
-        BindingMap rb = BindingFactory.create() ;
-        
-        StmtIterator bindingIter = soln.listProperties(ResultSetGraphVocab.binding) ;
-        for ( ; bindingIter.hasNext() ; )
-        {
-            Resource binding = bindingIter.nextStatement().getResource() ;
-            
-            String var = binding.getRequiredProperty(ResultSetGraphVocab.variable).getString() ;
+        BindingMap rb = BindingFactory.create();
+
+        StmtIterator bindingIter = soln.listProperties(ResultSetGraphVocab.binding);
+        for ( ; bindingIter.hasNext() ; ) {
+            Resource binding = bindingIter.nextStatement().getResource();
+
+            String var = binding.getRequiredProperty(ResultSetGraphVocab.variable).getString();
             try {
-                RDFNode val = binding.getRequiredProperty(ResultSetGraphVocab.value).getObject() ;
-                rb.add(Var.alloc(var), val.asNode()) ;
-            } catch (PropertyNotFoundException ex)
-            {
-                Log.warn(this, "Failed to get value for ?"+var) ;
+                RDFNode val = binding.getRequiredProperty(ResultSetGraphVocab.value).getObject();
+                rb.add(Var.alloc(var), val.asNode());
             }
-            
+            catch (PropertyNotFoundException ex) {
+                Log.warn(this, "Failed to get value for ?" + var);
+            }
+
             // We include the value even if it is the marker term "rs:undefined"
-            //if ( val.equals(ResultSetVocab.undefined))
-            //    continue ;
+            // if ( val.equals(ResultSetVocab.undefined))
+            // continue ;
             // The ResultSetFormatter code equates null (not found) with
-            // rs:undefined.  When Jena JUnit testing, it does not matter if the
+            // rs:undefined. When Jena JUnit testing, it does not matter if the
             // recorded result has the term absent or explicitly undefined.
-            
+
         }
-        bindingIter.close() ;
-        return rb ;
+        bindingIter.close();
+        return rb;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetApply.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetApply.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetApply.java
index acafa13..1411faf 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetApply.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetApply.java
@@ -18,44 +18,38 @@
 
 package org.apache.jena.sparql.resultset;
 
-import org.apache.jena.query.QuerySolution ;
-import org.apache.jena.query.ResultSet ;
-import org.apache.jena.rdf.model.RDFNode ;
+import org.apache.jena.query.QuerySolution;
+import org.apache.jena.query.ResultSet;
+import org.apache.jena.rdf.model.RDFNode;
 
 /** A class to walk a result set. */
 
-public class ResultSetApply
-{
-    ResultSetProcessor proc = null ;
-    ResultSet rs = null ;
-    
-    public ResultSetApply(ResultSet rs, ResultSetProcessor proc)
-    {
-        this.proc = proc ;
-        this.rs = rs ;
+public class ResultSetApply {
+    ResultSetProcessor proc = null;
+    ResultSet          rs   = null;
+
+    public ResultSetApply(ResultSet rs, ResultSetProcessor proc) {
+        this.proc = proc;
+        this.rs = rs;
     }
-    
-    public void apply()
-    {
-        proc.start(rs) ;
-        for ( ; rs.hasNext() ; )
-        {
-            QuerySolution qs = rs.next() ;
-            proc.start(qs) ;
-            for ( String varName : rs.getResultVars()  )
-            {
-                RDFNode node = qs.get(varName) ;
+
+    public void apply() {
+        proc.start(rs);
+        for ( ; rs.hasNext() ; ) {
+            QuerySolution qs = rs.next();
+            proc.start(qs);
+            for ( String varName : rs.getResultVars() ) {
+                RDFNode node = qs.get(varName);
                 // node may be null
-                proc.binding(varName, node) ;
+                proc.binding(varName, node);
             }
-            proc.finish(qs) ;
+            proc.finish(qs);
         }
-        proc.finish(rs) ;
+        proc.finish(rs);
     }
-    
-    public static void apply(ResultSet rs, ResultSetProcessor proc)
-    {
-        ResultSetApply rsa = new ResultSetApply(rs, proc) ;
-        rsa.apply() ;
+
+    public static void apply(ResultSet rs, ResultSetProcessor proc) {
+        ResultSetApply rsa = new ResultSetApply(rs, proc);
+        rsa.apply();
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetMem.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetMem.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetMem.java
index 040ed36..482f0b6 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetMem.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultSetMem.java
@@ -29,17 +29,11 @@ import org.apache.jena.rdf.model.Model ;
 import org.apache.jena.sparql.core.ResultBinding ;
 import org.apache.jena.sparql.engine.binding.Binding ;
 
-/** An in-memory result set.  
- * Also useful for writing input processors which
- * keep the result set in memory.
+/** A result set held in-memory. rewindable.  
  */
 
-
 public class ResultSetMem implements org.apache.jena.query.ResultSetRewindable, ResultSetPeekable
 {
-    // ??? Convert to use a ResultSetProcessor
-    // The result set in memory
-    // .hasPrevious() and .previous()
     protected List<Binding> rows = new ArrayList<>();
     protected List<String> varNames = null ;
 
@@ -51,87 +45,81 @@ public class ResultSetMem implements org.apache.jena.query.ResultSetRewindable,
      *
      * @param imrs2     The other QueryResultsMem object
      */
-
-    public ResultSetMem(ResultSetMem imrs2)
-    {
-        this(imrs2, false) ;
+    public ResultSetMem(ResultSetMem imrs2) {
+        this(imrs2, false);
     }
 
-    /** Create an in-memory result set from another one
+    /**
+     * Create an in-memory result set from another one
      *
-     * @param imrs2     The other ResultSetMem object
-     * @param takeCopy  Should we copy the rows?
+     * @param imrs2
+     *            The other ResultSetMem object
+     * @param takeCopy
+     *            Should we copy the rows?
      */
 
-    public ResultSetMem(ResultSetMem imrs2, boolean takeCopy)
-    {
+    public ResultSetMem(ResultSetMem imrs2, boolean takeCopy) {
         varNames = imrs2.varNames;
         if ( takeCopy )
-            rows.addAll(imrs2.rows) ;
+            rows.addAll(imrs2.rows);
         else
-            // Share results (not the iterator).
-            rows = imrs2.rows ;
-        reset() ;
+                        // Share results (not the iterator).
+                        rows = imrs2.rows;
+        reset();
     }
 
-    /** Create an in-memory result set from any ResultSet object.
-     *  If the ResultSet is an in-memory one already, then no
-     *  copying is done - the necessary internal datastructures
-     *  are shared.  This operation destroys (uses up) a ResultSet
-     *  object that is not an in memory one.
+    /**
+     * Create an in-memory result set from any ResultSet object. If the
+     * ResultSet is an in-memory one already, then no copying is done - the
+     * necessary internal datastructures are shared. This operation destroys
+     * (uses up) a ResultSet object that is not an in memory one.
      */
 
-    public ResultSetMem(ResultSet qr)
-    {
-        model = qr.getResourceModel() ;
-        if (qr instanceof ResultSetMem)
-        {
-            ResultSetMem qrm = (ResultSetMem) qr;
+    public ResultSetMem(ResultSet qr) {
+        model = qr.getResourceModel();
+        if ( qr instanceof ResultSetMem ) {
+            ResultSetMem qrm = (ResultSetMem)qr;
             this.rows = qrm.rows;
             this.varNames = qrm.varNames;
-        }
-        else
-        {
+        } else {
             varNames = qr.getResultVars();
-            while (qr.hasNext())
-            {
+            while (qr.hasNext()) {
                 Binding rb = qr.nextBinding();
                 rows.add(rb);
             }
         }
         reset();
     }
-    
-    /** Create an in-memory result set from an array of 
-     * ResulSets. It is assumed that all the ResultSets 
-     * from the array have the same variables.
+
+    /**
+     * Create an in-memory result set from an array of ResulSets. It is assumed
+     * that all the ResultSets from the array have the same variables.
      * 
-     * @param sets the ResultSet objects to concatenate.
+     * @param sets
+     *            the ResultSet objects to concatenate.
      */
-    
-    public ResultSetMem(ResultSet... sets) 
-    {
+
+    public ResultSetMem(ResultSet... sets) {
         varNames = sets[0].getResultVars();
-        
-        for (ResultSet rs : sets) 
-        {
-        	if ( !varNames.equals(rs.getResultVars()) )
-        		throw new ResultSetException("ResultSet must have the same variables.") ;
-            if (rs instanceof ResultSetMem)
-                rows.addAll(((ResultSetMem) rs).rows);
-            else 
-                while (rs.hasNext()) rows.add(rs.nextBinding());
+
+        for ( ResultSet rs : sets ) {
+            if ( !varNames.equals(rs.getResultVars()) )
+                throw new ResultSetException("ResultSet must have the same variables.");
+            if ( rs instanceof ResultSetMem )
+                rows.addAll(((ResultSetMem)rs).rows);
+            else
+                while (rs.hasNext())
+                    rows.add(rs.nextBinding());
         }
         reset();
     }
 
-    public ResultSetMem()
-    {
-        this.varNames = new ArrayList<>() ;
-        reset() ;
+    public ResultSetMem() {
+        this.varNames = new ArrayList<>();
+        reset();
     }
-    
-   // -------- ResultSet interface ------------------------------
+
+    // -------- ResultSet interface ------------------------------
    /**
      *  @throws UnsupportedOperationException always thrown.
      */

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
index c23cfad..f28a7bd 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
@@ -102,83 +102,84 @@ public class ResultsFormat extends Symbol
 
     }
 
-    public static ResultsFormat guessSyntax(String url) 
-    {
-        return guessSyntax(url, FMT_RS_XML) ;
+    public static ResultsFormat guessSyntax(String url) {
+        return guessSyntax(url, FMT_RS_XML);
     }
-    
-    public static boolean isRDFGraphSyntax(ResultsFormat fmt)
-    {
-        if ( FMT_RDF_N3.equals(fmt) ) return true ;
-        if ( FMT_RDF_TURTLE.equals(fmt) ) return true ;
-        if ( FMT_RDF_XML.equals(fmt) ) return true ;
-        if ( FMT_RDF_NT.equals(fmt) ) return true ;
-        return false ;
+
+    public static boolean isRDFGraphSyntax(ResultsFormat fmt) {
+        if ( FMT_RDF_N3.equals(fmt) )
+            return true;
+        if ( FMT_RDF_TURTLE.equals(fmt) )
+            return true;
+        if ( FMT_RDF_XML.equals(fmt) )
+            return true;
+        if ( FMT_RDF_NT.equals(fmt) )
+            return true;
+        return false;
     }
-    
-    public static boolean isDatasetSyntax(ResultsFormat fmt){
-    	if ( FMT_TRIG.equals(fmt) ) return true ;
-    	return false;
+
+    public static boolean isDatasetSyntax(ResultsFormat fmt) {
+        if ( FMT_TRIG.equals(fmt) )
+            return true;
+        return false;
     }
-    
-    public static ResultsFormat guessSyntax(String url, ResultsFormat defaultFormat)
-    {
+
+    public static ResultsFormat guessSyntax(String url, ResultsFormat defaultFormat) {
         // -- XML
         if ( url.endsWith(".srx") )
-            return FMT_RS_XML ;
+            return FMT_RS_XML;
         if ( url.endsWith(".xml") )
-            return FMT_RS_XML ;
-        
+            return FMT_RS_XML;
+
         // -- Some kind of RDF
         if ( url.endsWith(".rdf") )
-            return FMT_RDF_XML ;
+            return FMT_RDF_XML;
         if ( url.endsWith(".n3") )
-            return FMT_RDF_N3 ;
+            return FMT_RDF_N3;
         if ( url.endsWith(".ttl") )
-            return FMT_RDF_TURTLE ;
-        
+            return FMT_RDF_TURTLE;
+
         // -- JSON
         if ( url.endsWith(".srj") )
-            return FMT_RS_JSON ;
+            return FMT_RS_JSON;
         if ( url.endsWith(".json") )
-            return FMT_RS_JSON ;
+            return FMT_RS_JSON;
         if ( url.endsWith(".yml") )
-            return FMT_RS_JSON ;
-        
+            return FMT_RS_JSON;
+
         // -- Thrift
         if ( url.endsWith(".srt") )
-            return FMT_RS_THRIFT ;
-        
+            return FMT_RS_THRIFT;
+
         // -- SSE : http://jena.apache.org/documentation/notes/sse.html
         if ( url.endsWith(".sse") )
-            return FMT_RS_SSE ;
+            return FMT_RS_SSE;
 
         if ( url.endsWith(".srb") ) // BindingsIO format.
-            return FMT_RS_BIO ;
+            return FMT_RS_BIO;
 
         // Likely to be something completely different!
         if ( url.endsWith(".csv") )
-            return FMT_RS_CSV ;
+            return FMT_RS_CSV;
         if ( url.endsWith(".tsv") )
-            return FMT_RS_TSV ;
-        
+            return FMT_RS_TSV;
+
         // Trig for Dataset
         if ( url.endsWith(".trig") )
-            return FMT_TRIG ;
-        
-        return defaultFormat ;
+            return FMT_TRIG;
+
+        return defaultFormat;
     }
-    
-    
-    /** Look up a short name for a result set FMT_
+
+    /**
+     * Look up a short name for a result set FMT_
      * 
-     * @param s  Short name
-     * @return  ResultSetFormat
+     * @param s
+     *            Short name
+     * @return ResultSetFormat
      */
- 
-    public static ResultsFormat lookup(String s)
-    {
-        return names.lookup(s) ;
+    public static ResultsFormat lookup(String s) {
+        return names.lookup(s);
     }
 
     static Map<ResultsFormat, Lang> mapResultsFormatToLang = new HashMap<>() ;

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SPARQLResult.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SPARQLResult.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SPARQLResult.java
index bbc5c55..fcabe74 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SPARQLResult.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SPARQLResult.java
@@ -27,126 +27,137 @@ import org.apache.jena.sparql.core.Var;
 import org.apache.jena.sparql.engine.binding.BindingMap;
 
 /**
- * The class "ResultSet" is reserved for the SELECT result format.
- * This class can hold a ResultSet, a boolean or a Model.
+ * The class "ResultSet" is reserved for the SELECT result format. This class
+ * can hold a ResultSet, a boolean or a Model.
  */
 
-public class SPARQLResult
-{
-    private boolean hasBeenSet = false ;
-    
-    private ResultSet resultSet = null ;
-    private Boolean booleanResult = null ;
-    private Model model = null ;
-    private Dataset dataset = null ;
-    
+public class SPARQLResult {
+    private boolean   hasBeenSet    = false;
+
+    private ResultSet resultSet     = null;
+    private Boolean   booleanResult = null;
+    private Model     model         = null;
+    private Dataset   dataset       = null;
+
     // Delayed choice of result type.
     protected SPARQLResult() {}
-    
-    public SPARQLResult(Model model)            { set(model) ; }
-    public SPARQLResult(ResultSet resultSet)    { set(resultSet) ;}
-    public SPARQLResult(boolean booleanResult)  { set(booleanResult) ; }
-    public SPARQLResult(Dataset dataset)        { set(dataset) ; }
-    
-    public boolean isResultSet()
-    {
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        return resultSet != null ;
-    }
-    
+
+    public SPARQLResult(Model model) {
+        set(model);
+    }
+
+    public SPARQLResult(ResultSet resultSet) {
+        set(resultSet);
+    }
+
+    public SPARQLResult(boolean booleanResult) {
+        set(booleanResult);
+    }
+
+    public SPARQLResult(Dataset dataset) {
+        set(dataset);
+    }
+
+    public boolean isResultSet() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        return resultSet != null;
+    }
+
     /** Synonym for isGraph */
-    public boolean isModel() { return isGraph() ; }
-
-    public boolean isGraph()
-    {
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        return model != null ;
-    }
-    
-    public boolean isDataset()
-    {
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        return dataset != null ;
-    }
-
-    public boolean isBoolean()
-    {
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        return booleanResult != null ;
-    }
-
-    
-    public ResultSet getResultSet()
-    {
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        if ( ! isResultSet() )
-            throw new ResultSetException("Not a ResultSet result") ;
-        return resultSet ;
-    }
-
-    public boolean getBooleanResult()
-    {
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        if ( ! isBoolean() )
-            throw new ResultSetException("Not a boolean result") ;
+    public boolean isModel() {
+        return isGraph();
+    }
+
+    public boolean isGraph() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        return model != null;
+    }
+
+    public boolean isDataset() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        return dataset != null;
+    }
+
+    public boolean isBoolean() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        return booleanResult != null;
+    }
+
+    public ResultSet getResultSet() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        if ( !isResultSet() )
+            throw new ResultSetException("Not a ResultSet result");
+        return resultSet;
+    }
+
+    public boolean getBooleanResult() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        if ( !isBoolean() )
+            throw new ResultSetException("Not a boolean result");
         return booleanResult;
     }
 
-    public Model getModel() { 
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        if ( ! isModel() )
-            throw new ResultSetException("Not a graph result") ;
-        return model ;
-    }
-    
-    public Dataset getDataset() { 
-        if ( ! hasBeenSet )
-            throw new ResultSetException("Not set") ;
-        if ( ! isDataset() )
-            throw new ResultSetException("Not a dataset result") ;
-        return dataset ;
-    }
-    
-    public boolean isHasBeenSet() { return hasBeenSet; }
-    
-    protected void set(ResultSet rs)
-    { 
-        resultSet = rs ;
-        hasBeenSet = true ;
-    }
-
-    protected void set(Model m)
-    { model = m ; hasBeenSet = true ; }
-    
-    protected void set(Dataset d)
-    { dataset = d ; hasBeenSet = true ; }
-    
-    protected void set(boolean r)
-    { set (new Boolean(r)) ; } 
-    
-    protected void set(Boolean r)
-    { booleanResult  = r ;  hasBeenSet = true ; }
-    
-    static protected void addBinding(BindingMap binding, Var var, Node value)
-    {
-        Node n = binding.get(var) ;
-        if ( n != null )
-        {
+    public Model getModel() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        if ( !isModel() )
+            throw new ResultSetException("Not a graph result");
+        return model;
+    }
+
+    public Dataset getDataset() {
+        if ( !hasBeenSet )
+            throw new ResultSetException("Not set");
+        if ( !isDataset() )
+            throw new ResultSetException("Not a dataset result");
+        return dataset;
+    }
+
+    public boolean isHasBeenSet() {
+        return hasBeenSet;
+    }
+
+    protected void set(ResultSet rs) {
+        resultSet = rs;
+        hasBeenSet = true;
+    }
+
+    protected void set(Model m) {
+        model = m;
+        hasBeenSet = true;
+    }
+
+    protected void set(Dataset d) {
+        dataset = d;
+        hasBeenSet = true;
+    }
+
+    protected void set(boolean r) {
+        set(new Boolean(r));
+    }
+
+    protected void set(Boolean r) {
+        booleanResult = r;
+        hasBeenSet = true;
+    }
+
+    static protected void addBinding(BindingMap binding, Var var, Node value) {
+        Node n = binding.get(var);
+        if ( n != null ) {
             // Same - silently skip.
             if ( n.equals(value) )
-                return ;
-            Log.warn(SPARQLResult.class, 
-                     String.format("Multiple occurences of a binding for variable '%s' with different values - ignored", var.getName())) ;
-            return ;
+                return;
+            Log.warn(SPARQLResult.class,
+                     String.format("Multiple occurences of a binding for variable '%s' with different values - ignored", var.getName()));
+            return;
         }
-        binding.add(var, value) ;
+        binding.add(var, value);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SortedResultSet.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SortedResultSet.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SortedResultSet.java
index 549b9d7..16beddf 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SortedResultSet.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/SortedResultSet.java
@@ -39,9 +39,11 @@ import org.apache.jena.sparql.engine.binding.BindingMap ;
 import org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper ;
 
 
-/** Sort a result set. */
-
-public class SortedResultSet implements ResultSet
+/** Sort a result set.
+ * @deprecated Unused - will be deleted.
+ */
+@Deprecated
+/*package*/ abstract class SortedResultSet implements ResultSet
 {
     // See also QueryIterSort
     // This class processes ResultSet's (which may not come from a query)
@@ -55,7 +57,7 @@ public class SortedResultSet implements ResultSet
     Model model ;
     
     // Caution: this does not have the ful context available so soem conditions 
-    public SortedResultSet(ResultSet rs, List<SortCondition> conditions)
+    private SortedResultSet(ResultSet rs, List<SortCondition> conditions)
     {
         // Caution: this does not have the ful context available so some conditions may get upset. 
         this(rs, new BindingComparator(conditions)) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInput.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInput.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInput.java
index fc45ce7..b05360f 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInput.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInput.java
@@ -45,41 +45,38 @@ public class TSVInput {
 	 * Reads SPARQL Results from TSV format into a {@link ResultSet} instance
 	 * @param in Input Stream
 	 */
-    public static ResultSet fromTSV(InputStream in)
-    {
-    	BufferedReader reader = IO.asBufferedUTF8(in);
+    public static ResultSet fromTSV(InputStream in) {
+        BufferedReader reader = IO.asBufferedUTF8(in);
         List<Var> vars = new ArrayList<>();
         List<String> varNames = new ArrayList<>();
 
-    	String str = null;
-        try 
-        {
-        	//Here we try to parse only the Header Row
-        	str = reader.readLine();
-        	if (str == null ) 
-        	    throw new ARQException("TSV Results malformed, input is empty (no header row)") ;
-        	if ( ! str.isEmpty() )
-        	{
-        	    String[] tokens = pattern.split(str,-1);
-        	    for ( String token : tokens ) 
-        	    {
-        	        Node v ;
-        	        try {
-        	            v = NodeFactoryExtra.parseNode(token) ;
-        	            if ( v == null || ! v.isVariable())
-        	                throw new ResultSetException("TSV Results malformed, not a variable: "+token);
-        	        } catch (RiotException ex)
-        	        { throw new ResultSetException("TSV Results malformed, variable names must begin with a ? in the header: "+token); }
+        String str = null;
+        try {
+            // Here we try to parse only the Header Row
+            str = reader.readLine();
+            if ( str == null )
+                throw new ARQException("TSV Results malformed, input is empty (no header row)");
+            if ( !str.isEmpty() ) {
+                String[] tokens = pattern.split(str, -1);
+                for ( String token : tokens ) {
+                    Node v;
+                    try {
+                        v = NodeFactoryExtra.parseNode(token);
+                        if ( v == null || !v.isVariable() )
+                            throw new ResultSetException("TSV Results malformed, not a variable: " + token);
+                    }
+                    catch (RiotException ex) {
+                        throw new ResultSetException("TSV Results malformed, variable names must begin with a ? in the header: " + token);
+                    }
 
-        	        Var var = Var.alloc(v);
-        	        vars.add(var);
-        	        varNames.add(var.getName());
-            	}
-        	}
-        } 
-        catch ( IOException ex )
-        {
-        	throw new ARQException(ex) ;
+                    Var var = Var.alloc(v);
+                    vars.add(var);
+                    varNames.add(var.getName());
+                }
+            }
+        }
+        catch (IOException ex) {
+            throw new ARQException(ex);
         }
 
         //Generate an instance of ResultSetStream using TSVInputIterator
@@ -92,36 +89,36 @@ public class TSVInput {
      * @param in Input Stream
      * @return boolean
      */
-    public static boolean booleanFromTSV(InputStream in)
-    {
-    	BufferedReader reader = IO.asBufferedUTF8(in);
-    	String str = null;
-    	try
-    	{
-    		//First try to parse the header
-    		str = reader.readLine();
-    		if (str == null) throw new ARQException("TSV Boolean Results malformed, input is empty");
-    		str = str.trim(); //Remove extraneous white space
-    		
-    		//Expect a header row with single ?_askResult variable
-    		if (!str.equals("?_askResult")) throw new ARQException("TSV Boolean Results malformed, did not get expected ?_askResult header row");
-    		
-    		//Then try to parse the boolean result
-    		str = reader.readLine();
-    		if (str == null) throw new ARQException("TSV Boolean Results malformed, unexpected end of input after header row");
-    		str = str.trim();
-    		
-    		if (str.equalsIgnoreCase("true") || str.equalsIgnoreCase("yes")) {
-    			return true;
-    		} else if (str.equalsIgnoreCase("false") || str.equalsIgnoreCase("no")) {
-    			return false;
-    		} else {
-    			throw new ARQException("TSV Boolean Results malformed, expected one of - true yes false no - but got " + str);
-    		}
-    	}
-    	catch (IOException ex)
-    	{
-    		throw new ARQException(ex);
-    	}
+    public static boolean booleanFromTSV(InputStream in) {
+        BufferedReader reader = IO.asBufferedUTF8(in);
+        String str = null;
+        try {
+            // First try to parse the header
+            str = reader.readLine();
+            if ( str == null )
+                throw new ARQException("TSV Boolean Results malformed, input is empty");
+            str = str.trim(); // Remove extraneous white space
+
+            // Expect a header row with single ?_askResult variable
+            if ( !str.equals("?_askResult") )
+                throw new ARQException("TSV Boolean Results malformed, did not get expected ?_askResult header row");
+
+            // Then try to parse the boolean result
+            str = reader.readLine();
+            if ( str == null )
+                throw new ARQException("TSV Boolean Results malformed, unexpected end of input after header row");
+            str = str.trim();
+
+            if ( str.equalsIgnoreCase("true") || str.equalsIgnoreCase("yes") ) {
+                return true;
+            } else if ( str.equalsIgnoreCase("false") || str.equalsIgnoreCase("no") ) {
+                return false;
+            } else {
+                throw new ARQException("TSV Boolean Results malformed, expected one of - true yes false no - but got " + str);
+            }
+        }
+        catch (IOException ex) {
+            throw new ARQException(ex);
+        }
     }
  }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInputIterator.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInputIterator.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInputIterator.java
index e73dca4..58013ae 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInputIterator.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVInputIterator.java
@@ -54,102 +54,104 @@ public class TSVInputIterator extends QueryIteratorBase
 	 * Assumes the Header Row has already been read and that the next row to be read from the reader will be a Result Row
 	 * </p>
 	 */
-	public TSVInputIterator(BufferedReader reader, List<Var> vars)
-	{
-		this.reader = reader;
-		this.expectedItems = vars.size();
-		this.vars = vars;
-	}
-	
-	@Override
-	public void output(IndentedWriter out, SerializationContext sCxt) {
-	    // Not needed - only called as part of printing/debugging query plans.
-		out.println("TSVInputIterator") ;
-	}
-
-	@Override
-	protected boolean hasNextBinding() {
-		if (this.reader != null)
-		{
-			if (this.binding == null)
-				return this.parseNextBinding();
-			else
-				return true;
-		}
-		else
-		{
-			return false;
-		}
-	}
-	
-	private boolean parseNextBinding()
-	{
-	    String line;
-	    try 
-	    {
-	        line = this.reader.readLine();
-	        //Once EOF has been reached we'll see null for this call so we can return false because there are no further bindings
-	        if (line == null) return false;
-	        this.lineNum++;
-	    } 
-	    catch (IOException e) 
-	    { throw new ResultSetException("Error parsing TSV results - " + e.getMessage()); }
-
-	    if ( line.isEmpty() )
-	    {
-	        // Empty input line - no bindings.
-	    	// Only valid when we expect zero/one values as otherwise we should get a sequence of tab characters
-	    	// which means a non-empty string which we handle normally
-	    	if (expectedItems > 1) throw new ResultSetException(format("Error Parsing TSV results at Line %d - The result row had 0/1 values when %d were expected", this.lineNum, expectedItems));
-	        this.binding = BindingFactory.create() ;
-	        return true ;
-	    }
-	    
+    public TSVInputIterator(BufferedReader reader, List<Var> vars) {
+        this.reader = reader;
+        this.expectedItems = vars.size();
+        this.vars = vars;
+    }
+
+    @Override
+    public void output(IndentedWriter out, SerializationContext sCxt) {
+        // Not needed - only called as part of printing/debugging query plans.
+        out.println("TSVInputIterator");
+    }
+
+    @Override
+    protected boolean hasNextBinding() {
+        if ( this.reader != null ) {
+            if ( this.binding == null )
+                return this.parseNextBinding();
+            else
+                return true;
+        } else {
+            return false;
+        }
+    }
+
+    private boolean parseNextBinding() {
+        String line;
+        try {
+            line = this.reader.readLine();
+            // Once EOF has been reached we'll see null for this call so we can
+            // return false because there are no further bindings
+            if ( line == null )
+                return false;
+            this.lineNum++;
+        }
+        catch (IOException e) {
+            throw new ResultSetException("Error parsing TSV results - " + e.getMessage());
+        }
+
+        if ( line.isEmpty() ) {
+            // Empty input line - no bindings.
+            // Only valid when we expect zero/one values as otherwise we should
+            // get a sequence of tab characters
+            // which means a non-empty string which we handle normally
+            if ( expectedItems > 1 )
+                throw new ResultSetException(format("Error Parsing TSV results at Line %d - The result row had 0/1 values when %d were expected",
+                                                    this.lineNum, expectedItems));
+            this.binding = BindingFactory.create();
+            return true;
+        }
+
         String[] tokens = TSVInput.pattern.split(line, -1);
-	    
-        if (tokens.length != expectedItems)
-        	 throw new ResultSetException(format("Error Parsing TSV results at Line %d - The result row '%s' has %d values instead of the expected %d.", this.lineNum, line, tokens.length, expectedItems));
+
+        if ( tokens.length != expectedItems )
+            throw new ResultSetException(format("Error Parsing TSV results at Line %d - The result row '%s' has %d values instead of the expected %d.",
+                                                this.lineNum, line, tokens.length, expectedItems));
         this.binding = BindingFactory.create();
 
-        for ( int i = 0; i < tokens.length; i++ ) 
-        {
+        for ( int i = 0 ; i < tokens.length ; i++ ) {
             String token = tokens[i];
 
-            //If we see an empty string this denotes an unbound value
-            if (token.equals("")) continue; 
+            // If we see an empty string this denotes an unbound value
+            if ( token.equals("") )
+                continue;
 
-            //Bound value so parse it and add to the binding
+            // Bound value so parse it and add to the binding
             try {
-                Node node = NodeFactoryExtra.parseNode(token) ;
+                Node node = NodeFactoryExtra.parseNode(token);
                 if ( !node.isConcrete() )
-                    throw new ResultSetException(format("Line %d: Not a concrete RDF term: %s",lineNum, token)) ;
+                    throw new ResultSetException(format("Line %d: Not a concrete RDF term: %s", lineNum, token));
                 this.binding.add(this.vars.get(i), node);
-            } catch (RiotException ex)
-            {
+            }
+            catch (RiotException ex) {
                 throw new ResultSetException(format("Line %d: Data %s contains error: %s", lineNum, token, ex.getMessage()));
             }
         }
 
         return true;
-	}
-	
-	@Override
-	protected Binding moveToNextBinding() {
-        if (!hasNext()) throw new NoSuchElementException() ;
+    }
+
+    @Override
+    protected Binding moveToNextBinding() {
+        if ( !hasNext() )
+            throw new NoSuchElementException();
         Binding b = this.binding;
-        this.binding = null ;
+        this.binding = null;
         return b;
-	}
-
-	@Override
-	protected void closeIterator() {
-	    IO.close(reader) ;
-	    reader = null;
-	}
-
-	@Override
-	protected void requestCancel() {
-		//Don't need to do anything special to cancel
-		//Superclass should take care of that and call closeIterator() where we do our actual clean up
-	}
+    }
+
+    @Override
+    protected void closeIterator() {
+        IO.close(reader);
+        reader = null;
+    }
+
+    @Override
+    protected void requestCancel() {
+        // Don't need to do anything special to cancel
+        // Superclass should take care of that and call closeIterator() where we
+        // do our actual clean up
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVOutput.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVOutput.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVOutput.java
index 6ec6d25..7987a69 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVOutput.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVOutput.java
@@ -48,75 +48,67 @@ public class TSVOutput extends OutputBase
     static String SEP  = "\t" ;
     
     @Override
-    public void format(OutputStream out, ResultSet resultSet)
-    {
-        //Use a Turtle formatter to format terms
+    public void format(OutputStream out, ResultSet resultSet) {
+        // Use a Turtle formatter to format terms
         NodeFormatterTTL formatter = new NodeFormatterTTL(null, null);
 
-        AWriter w = IO.wrapUTF8(out) ; 
+        AWriter w = IO.wrapUTF8(out);
 
-        String sep = null ;
-        List<String> varNames = resultSet.getResultVars() ;
-        List<Var> vars = new ArrayList<>(varNames.size()) ;
+        String sep = null;
+        List<String> varNames = resultSet.getResultVars();
+        List<Var> vars = new ArrayList<>(varNames.size());
 
         // writes the variables on the first line
-        for( String v : varNames )
-        {
+        for ( String v : varNames ) {
             if ( sep != null )
-                w.write(sep) ;
+                w.write(sep);
             else
-                sep = SEP ;
-            Var var = Var.alloc(v) ;
-            w.write(var.toString()) ; 
-            vars.add(var) ;
+                sep = SEP;
+            Var var = Var.alloc(v);
+            w.write(var.toString());
+            vars.add(var);
         }
-        w.write(NL) ;
+        w.write(NL);
 
         // writes one binding by line
-        for ( ; resultSet.hasNext() ; )
-        {
-            sep = null ;
-            Binding b = resultSet.nextBinding() ;
+        for ( ; resultSet.hasNext() ; ) {
+            sep = null;
+            Binding b = resultSet.nextBinding();
 
-            for( Var v : vars )
-            {
+            for ( Var v : vars ) {
                 if ( sep != null )
-                    w.write(sep) ;
-                sep = SEP ;
+                    w.write(sep);
+                sep = SEP;
 
-                Node n = b.get(v) ;
-                if ( n != null )
-                {
+                Node n = b.get(v);
+                if ( n != null ) {
                     // This will not include a raw tab.
                     formatter.format(w, n);
                 }
             }
-            w.write(NL) ;
+            w.write(NL);
         }
 
-        w.flush() ;
+        w.flush();
     }
 
     static final byte[] headerBytes = StrUtils.asUTF8bytes("?_askResult" + NL);
-    static final byte[] yesBytes = StrUtils.asUTF8bytes("true") ;
-    static final byte[] noBytes = StrUtils.asUTF8bytes("false") ;
-    static final byte[] NLBytes = StrUtils.asUTF8bytes(NL) ;
-    
+    static final byte[] yesBytes    = StrUtils.asUTF8bytes("true");
+    static final byte[] noBytes     = StrUtils.asUTF8bytes("false");
+    static final byte[] NLBytes     = StrUtils.asUTF8bytes(NL);
+
     @Override
-    public void format(OutputStream out, boolean booleanResult)
-    {
-        try
-        {
-        	out.write(headerBytes);
-            if (booleanResult) 
-                out.write(yesBytes) ;
+    public void format(OutputStream out, boolean booleanResult) {
+        try {
+            out.write(headerBytes);
+            if ( booleanResult )
+                out.write(yesBytes);
             else
-                out.write(noBytes) ;
-            out.write(NLBytes) ;
-        } catch (IOException ex)
-        {
-            throw new ARQException(ex) ;
+                out.write(noBytes);
+            out.write(NLBytes);
+        }
+        catch (IOException ex) {
+            throw new ARQException(ex);
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TextOutput.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TextOutput.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TextOutput.java
index 1158a2d..ed8cbab 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TextOutput.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/TextOutput.java
@@ -66,15 +66,13 @@ public class TextOutput extends OutputBase
     { write(outs, resultSet) ; }
 
     /** Writer should be UTF-8 encoded - better to an OutputStream */ 
-    public void format(Writer w, ResultSet resultSet)
-    { 
+    public void format(Writer w, ResultSet resultSet) { 
         PrintWriter pw = new PrintWriter(w) ;
         write(pw, resultSet) ;
         pw.flush() ;
     }
 
-    private int[] colWidths(ResultSetRewindable rs)
-    {
+    private int[] colWidths(ResultSetRewindable rs) {
         int numCols = rs.getResultVars().size() ;
         int numRows = 0 ;
         int[] colWidths = new int[numCols] ;
@@ -84,8 +82,7 @@ public class TextOutput extends OutputBase
             colWidths[i] = (rs.getResultVars().get(i)).length() ;
 
         // Preparation pass : find the maximum width for each column
-        for ( ; rs.hasNext() ; )
-        {
+        for ( ; rs.hasNext() ; ) {
             numRows++ ;
             QuerySolution rBind = rs.nextSolution() ;
             int col = -1 ;
@@ -139,28 +136,25 @@ public class TextOutput extends OutputBase
      *  @param pw         PrintWriter
      *  @param colSep      Column separator
      */
-    public void write(PrintWriter pw, ResultSet resultSet, String colStart, String colSep, String colEnd)
-    {
-        if ( resultSet.getResultVars().size() == 0 )
-        {
-            pw.println("==== No variables ====") ;
-            //return ;
+    public void write(PrintWriter pw, ResultSet resultSet, String colStart, String colSep, String colEnd) {
+        if ( resultSet.getResultVars().size() == 0 ) {
+            pw.println("==== No variables ====");
+            // return ;
         }
 
-        ResultSetRewindable resultSetRewindable = ResultSetFactory.makeRewindable(resultSet) ; 
-        
-        int numCols = resultSetRewindable.getResultVars().size() ;
-        int[] colWidths = colWidths(resultSetRewindable) ;
-
-        String row[] = new String[numCols] ;
-        int lineWidth = 0 ;
-        for ( int col = 0 ; col < numCols ; col++ )
-        {
-            String rVar = resultSet.getResultVars().get(col) ;
-            row[col] = rVar ;
-            lineWidth += colWidths[col] ;
+        ResultSetRewindable resultSetRewindable = ResultSetFactory.makeRewindable(resultSet);
+
+        int numCols = resultSetRewindable.getResultVars().size();
+        int[] colWidths = colWidths(resultSetRewindable);
+
+        String row[] = new String[numCols];
+        int lineWidth = 0;
+        for ( int col = 0 ; col < numCols ; col++ ) {
+            String rVar = resultSet.getResultVars().get(col);
+            row[col] = rVar;
+            lineWidth += colWidths[col];
             if ( col > 0 )
-                lineWidth += colSep.length() ;
+                lineWidth += colSep.length();
         }
         if ( colStart != null )
             lineWidth += colStart.length() ;
@@ -177,15 +171,13 @@ public class TextOutput extends OutputBase
             pw.print('=') ;
         pw.println() ;
 
-        for ( ; resultSetRewindable.hasNext() ; )
-        {
-            QuerySolution rBind = resultSetRewindable.nextSolution() ;
-            for ( int col = 0 ; col < numCols ; col++ )
-            {
-                String rVar = resultSet.getResultVars().get(col) ;
-                row[col] = this.getVarValueAsString(rBind, rVar );
+        for ( ; resultSetRewindable.hasNext() ; ) {
+            QuerySolution rBind = resultSetRewindable.nextSolution();
+            for ( int col = 0 ; col < numCols ; col++ ) {
+                String rVar = resultSet.getResultVars().get(col);
+                row[col] = this.getVarValueAsString(rBind, rVar);
             }
-            printRow(pw, row, colWidths, colStart, colSep, colEnd) ;
+            printRow(pw, row, colWidths, colStart, colSep, colEnd);
         }
         for ( int i = 0 ; i < lineWidth ; i++ )
             pw.print('-') ;
@@ -194,46 +186,42 @@ public class TextOutput extends OutputBase
     }
 
 
-    private void printRow(PrintWriter out, String[] row, int[] colWidths, String rowStart, String colSep, String rowEnd)
-    {
-        out.print(rowStart) ;
-        for ( int col = 0 ; col < colWidths.length ; col++ )
-        {
-            String s = row[col] ;
-            int pad = colWidths[col] ;
-            StringBuffer sbuff = new StringBuffer(120) ;
+    private void printRow(PrintWriter out, String[] row, int[] colWidths, String rowStart, String colSep, String rowEnd) {
+        out.print(rowStart);
+        for ( int col = 0 ; col < colWidths.length ; col++ ) {
+            String s = row[col];
+            int pad = colWidths[col];
+            StringBuffer sbuff = new StringBuffer(120);
 
             if ( col > 0 )
-                sbuff.append(colSep) ;
+                sbuff.append(colSep);
 
-            sbuff.append(s) ;
-            for ( int j = 0 ; j < pad-s.length() ; j++ )
-                sbuff.append(' ') ;
+            sbuff.append(s);
+            for ( int j = 0 ; j < pad - s.length() ; j++ )
+                sbuff.append(' ');
 
-            out.print(sbuff) ;
+            out.print(sbuff);
         }
-        out.print(rowEnd) ;
-        out.println() ;
+        out.print(rowEnd);
+        out.println();
     }
 
-    protected String getVarValueAsString(QuerySolution rBind, String varName)
-    {
-        RDFNode obj = rBind.get(varName) ;
-        
+    protected String getVarValueAsString(QuerySolution rBind, String varName) {
+        RDFNode obj = rBind.get(varName);
+
         if ( obj == null )
-            return notThere ;
+            return notThere;
 
-        return FmtUtils.stringForRDFNode(obj, context) ;
+        return FmtUtils.stringForRDFNode(obj, context);
     }
 
     @Override
-    public void format(OutputStream out, boolean answer)
-    {
-      PrintWriter pw = FileUtils.asPrintWriterUTF8(out) ;
-      if ( answer )
-          pw.write("yes") ;
-      else
-          pw.write("no") ;
-      pw.flush() ;
+    public void format(OutputStream out, boolean answer) {
+        PrintWriter pw = FileUtils.asPrintWriterUTF8(out);
+        if ( answer )
+            pw.write("yes");
+        else
+            pw.write("no");
+        pw.flush();
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLInput.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLInput.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLInput.java
index df4fd15..192e4b3 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLInput.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLInput.java
@@ -18,86 +18,80 @@
 
 package org.apache.jena.sparql.resultset;
 
-import java.io.InputStream ;
-import java.io.Reader ;
+import java.io.InputStream;
+import java.io.Reader;
 
-import org.apache.jena.query.ResultSet ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.sparql.SystemARQ ;
+import org.apache.jena.query.ResultSet;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.sparql.SystemARQ;
 
-/** Code that reads an XML Result Set and builds the ARQ structure for the same. */
+/**
+ * Code that reads an XML Result Set and builds the ARQ structure for the same.
+ */
 
-public class XMLInput
-{
-    public static ResultSet fromXML(InputStream in) 
-    {
-        return fromXML(in, null) ;
+public class XMLInput {
+    public static ResultSet fromXML(InputStream in) {
+        return fromXML(in, null);
     }
-    
-    public static ResultSet fromXML(InputStream in, Model model) 
-    {
-        return make(in, model).getResultSet() ;
+
+    public static ResultSet fromXML(InputStream in, Model model) {
+        return make(in, model).getResultSet();
     }
-    
-    public static ResultSet fromXML(Reader in) 
-    {
-        return fromXML(in, null) ;
+
+    public static ResultSet fromXML(Reader in) {
+        return fromXML(in, null);
     }
-    
-    public static ResultSet fromXML(Reader in, Model model) 
-    {
-        return make(in, model).getResultSet() ;
+
+    public static ResultSet fromXML(Reader in, Model model) {
+        return make(in, model).getResultSet();
     }
-    
 
-    public static ResultSet fromXML(String str) 
-    {
-        return fromXML(str, null) ;
+    public static ResultSet fromXML(String str) {
+        return fromXML(str, null);
     }
 
-    public static ResultSet fromXML(String str, Model model) 
-    {
-        return make(str, model).getResultSet() ;
+    public static ResultSet fromXML(String str, Model model) {
+        return make(str, model).getResultSet();
     }
 
-    public static boolean booleanFromXML(InputStream in)
-    {
-        return make(in, null).getBooleanResult() ;
+    public static boolean booleanFromXML(InputStream in) {
+        return make(in, null).getBooleanResult();
     }
 
-    public static boolean booleanFromXML(String str)
-    {
-        return make(str, null).getBooleanResult() ;
+    public static boolean booleanFromXML(String str) {
+        return make(str, null).getBooleanResult();
     }
 
     // Low level operations
-    
-    public static SPARQLResult make(InputStream in) { return make(in, null) ; }
-    
-    public static SPARQLResult make(InputStream in, Model model)
-    {
+
+    public static SPARQLResult make(InputStream in) {
+        return make(in, null);
+    }
+
+    public static SPARQLResult make(InputStream in, Model model) {
         if ( SystemARQ.UseSAX )
-            return new XMLInputSAX(in, model) ;
-        return new XMLInputStAX(in, model) ;
+            return new XMLInputSAX(in, model);
+        return new XMLInputStAX(in, model);
+    }
+
+    public static SPARQLResult make(Reader in) {
+        return make(in, null);
     }
-    
-    public static SPARQLResult make(Reader in) { return make(in, null) ; }
-    
-    public static SPARQLResult make(Reader in, Model model)
-    {
+
+    public static SPARQLResult make(Reader in, Model model) {
         if ( SystemARQ.UseSAX )
-            return new XMLInputSAX(in, model) ;
-        return new XMLInputStAX(in, model) ;
+            return new XMLInputSAX(in, model);
+        return new XMLInputStAX(in, model);
     }
 
+    public static SPARQLResult make(String str) {
+        return make(str, null);
+    }
 
-    public static SPARQLResult make(String str) { return make(str, null) ; }
-    
-    public static SPARQLResult make(String str, Model model)
-    {
+    public static SPARQLResult make(String str, Model model) {
         if ( SystemARQ.UseSAX )
-            return new XMLInputSAX(str, model) ;
-        return new XMLInputStAX(str, model) ;
+            return new XMLInputSAX(str, model);
+        return new XMLInputStAX(str, model);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutput.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutput.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutput.java
index d9243af..a30d5ae 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutput.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutput.java
@@ -29,27 +29,27 @@ public class XMLOutput extends OutputBase
     boolean includeXMLinst = true ;
     
     public XMLOutput() {}
-    public XMLOutput(String stylesheetURL)
-    { setStylesheetURL(stylesheetURL) ; }
 
-    public XMLOutput(boolean includeXMLinst)
-    { setIncludeXMLinst(includeXMLinst) ; }
-    
-    public XMLOutput(boolean includeXMLinst, String stylesheetURL)
-    { 
-        setStylesheetURL(stylesheetURL) ; 
-        setIncludeXMLinst(includeXMLinst) ;
+    public XMLOutput(String stylesheetURL) {
+        setStylesheetURL(stylesheetURL);
     }
 
+    public XMLOutput(boolean includeXMLinst) {
+        setIncludeXMLinst(includeXMLinst);
+    }
     
+    public XMLOutput(boolean includeXMLinst, String stylesheetURL) {
+        setStylesheetURL(stylesheetURL);
+        setIncludeXMLinst(includeXMLinst);
+    }
+
     @Override
-    public void format(OutputStream out, ResultSet resultSet)
-    {
-        XMLOutputResultSet xOut =  new XMLOutputResultSet(out) ;
-        xOut.setStylesheetURL(stylesheetURL) ;
-        xOut.setXmlInst(includeXMLinst) ;
-        ResultSetApply a = new ResultSetApply(resultSet, xOut) ;
-        a.apply() ;
+    public void format(OutputStream out, ResultSet resultSet) {
+        XMLOutputResultSet xOut = new XMLOutputResultSet(out);
+        xOut.setStylesheetURL(stylesheetURL);
+        xOut.setXmlInst(includeXMLinst);
+        ResultSetApply a = new ResultSetApply(resultSet, xOut);
+        a.apply();
     }
 
     /** @return Returns the includeXMLinst. */
@@ -69,9 +69,8 @@ public class XMLOutput extends OutputBase
     { this.stylesheetURL = stylesheetURL ; }
     
     @Override
-    public void format(OutputStream out, boolean booleanResult)
-    {
-        XMLOutputASK xOut = new XMLOutputASK(out) ;
-        xOut.exec(booleanResult) ;
+    public void format(OutputStream out, boolean booleanResult) {
+        XMLOutputASK xOut = new XMLOutputASK(out);
+        xOut.exec(booleanResult);
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d4c73a31/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutputASK.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutputASK.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutputASK.java
index cbeda1d..66ffe81 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutputASK.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/XMLOutputASK.java
@@ -18,67 +18,57 @@
 
 package org.apache.jena.sparql.resultset;
 
-import java.io.OutputStream ;
+import java.io.OutputStream;
 
-import org.apache.jena.atlas.io.IndentedWriter ;
+import org.apache.jena.atlas.io.IndentedWriter;
 
 /** XML Output (ASK format) */
 
+public class XMLOutputASK implements XMLResults {
+    String         stylesheetURL = null;
+    IndentedWriter out;
+    int            bNodeCounter  = 0;
+    boolean        xmlInst       = true;
 
-public class XMLOutputASK implements XMLResults
-{
-    String stylesheetURL = null ;
-    IndentedWriter  out ;
-    int bNodeCounter = 0 ;
-    boolean xmlInst = true ;
-    
-    public XMLOutputASK(OutputStream outStream)
-    { this(outStream, null) ; }
-    
-    public XMLOutputASK(OutputStream outStream, String stylesheetURL)
-    {
-        this(new IndentedWriter(outStream), stylesheetURL) ;
+    public XMLOutputASK(OutputStream outStream) {
+        this(outStream, null);
     }
-    
-    public XMLOutputASK(IndentedWriter indentedOut, String stylesheetURL)
-    {
-        out = indentedOut ;
-        this.stylesheetURL = stylesheetURL ;
+
+    public XMLOutputASK(OutputStream outStream, String stylesheetURL) {
+        this(new IndentedWriter(outStream), stylesheetURL);
+    }
+
+    public XMLOutputASK(IndentedWriter indentedOut, String stylesheetURL) {
+        out = indentedOut;
+        this.stylesheetURL = stylesheetURL;
     }
-    
-    public void exec(boolean result)
-    {
-        if ( xmlInst)
-            out.println("<?xml version=\"1.0\"?>") ;
-        
+
+    public void exec(boolean result) {
+        if ( xmlInst )
+            out.println("<?xml version=\"1.0\"?>");
+
         if ( stylesheetURL != null )
-            out.println("<?xml-stylesheet type=\"text/xsl\" href=\""+stylesheetURL+"\"?>") ;
-        
-        out.println("<"+dfRootTag+" xmlns=\""+dfNamespace+"\">") ;
-        out.incIndent(INDENT) ;
-        
+            out.println("<?xml-stylesheet type=\"text/xsl\" href=\"" + stylesheetURL + "\"?>");
+
+        out.println("<" + dfRootTag + " xmlns=\"" + dfNamespace + "\">");
+        out.incIndent(INDENT);
+
         // Head
-        out.println("<"+dfHead+">") ;
-        out.incIndent(INDENT) ;
-        if ( false )
-        {
-            String link = "UNSET" ;
-            out.println("<link href=\""+link+"\"/>") ;
+        out.println("<" + dfHead + ">");
+        out.incIndent(INDENT);
+        if ( false ) {
+            String link = "UNSET";
+            out.println("<link href=\"" + link + "\"/>");
         }
-        out.decIndent(INDENT) ;
-        out.println("</"+dfHead+">") ;
-        
-//        // Results
-//        out.println("<"+dfResults+">") ;
-//        out.incIndent(INDENT) ;
+        out.decIndent(INDENT);
+        out.println("</" + dfHead + ">");
+
         if ( result )
-            out.println("<boolean>true</boolean>") ;
+            out.println("<boolean>true</boolean>");
         else
-            out.println("<boolean>false</boolean>") ;
-//        out.decIndent(INDENT) ;
-//        out.println("</"+dfResults+">") ;
-        out.decIndent(INDENT) ;
-        out.println("</"+dfRootTag+">") ;
-        out.flush() ;
+            out.println("<boolean>false</boolean>");
+        out.decIndent(INDENT);
+        out.println("</" + dfRootTag + ">");
+        out.flush();
     }
 }