             [clojure.java.io :as io]
             [stencil.core :refer [render-file]]
             [stencil.loader :refer [set-cache]])
-  (:import [org.apache.jena.query ARQ DatasetFactory Query QueryExecutionFactory
+  (:import [java.io StringReader]
+           [org.apache.jena.query ARQ DatasetFactory Query QueryExecutionFactory
                                   QueryFactory QueryParseException Syntax]
            [org.apache.jena.update UpdateAction UpdateFactory]
            [org.apache.jena.rdf.model Model ModelFactory]

  [^Query query]
  (string/trim (.serialize query)))

(defn validate-query-syntax
  [^String query]
  (try (QueryFactory/create query Syntax/syntaxSPARQL_11)
       (catch QueryParseException ex
         {:message (.getMessage ex)
          :line (.getLine ex)
          :column (.getColumn ex)})))

(defn normalize-query
  [^Query query]

           [org.apache.jena.sparql.core Var]
           [org.apache.jena.graph Node]
           [org.apache.jena.arq.querybuilder ConstructBuilder]
           [org.topbraid.spin.arq ARQ2SPIN]
           [org.apache.jena.sparql.lang.sparql_11 ParseException SPARQLParser11 Token]))

(def arq-context
  (doto (.copy (ARQ/getContext))
