Fork me on GitHub

So I was playing around with Apache Jena's class (in order to work with the SPARQL Protocol). Each method accepts either a or a boolean, and since the latter was easier to work with I was using that. And here are the results:

(defmacro ->format-str
  "Macro to work with ResultSetFormatter to return strings."
  [f this]
  `(with-open [~'baos (]
     (~f ~'baos ~this)
     (String. (.toByteArray ~'baos))))

(->format-str ResultSetFormatter/outputAsJSON true)

; Result: "{ \n  \"head\" : { } ,\n  \"boolean\" : true\n}\n"

(->format-str ResultSetFormatter/outputAsXML true)

; Result: "<?xml version=\"1.0\"?>\n<sparql xmlns=\"\">\n  <head>\n  </head>\n  <boolean>true</boolean>\n</sparql>\n"

(->format-str ResultSetFormatter/outputAsCSV true)

; Result: ""


As you can see, for JSON and XML the formatted results make sense, but for CSV the result becomes an empty string. This seems "wrong," and I haven't been able to find much documentation on what the result for ASK queries (which return booleans) should be