              :results query-results
              :results-type (get-results-type query-type)}
      :equal? (or equal-syntax?
-                 (= (normalize-query-results canonical-query-type canonical-results)
-                    (normalize-query-results query-type query-results)))}))
+                 (equal-query-results? canonical-results query-results))}))

  (cond (or (= query-type ::ask) (= query-type ::select)) "application/json"
        (isa? query-type ::construct) "text/turtle"))

(defn serialize-query
  "Serialize SPARQL `query` to string."
  [^Query query]
  (string/trim (.serialize query)))

(defmulti normalize-query-results (fn [query-type _] query-type))

(defmethod normalize-query-results ::ask
  [_ query-results]
  query-results)

(defmethod normalize-query-results ::construct
  [_ query-results]
  query-results)

(defmethod normalize-query-results ::select
  [_ query-results]
  (let [data (parse-string query-results keyword)]
    (cond-> (map (partial map val) (get-in data [:results :bindings]))
      (not (get-in data [:results :ordered])) set ; Unordered bindings are compared as sets 
      )))

(defn sparql-query
  [endpoint query-type query]

            [clj-http.client :as client]
            [clojure.tools.logging :as log]
            [clojure.string :as string]
            [cheshire.core :refer [parse-string]]
            [clojure.java.io :as io])
  (:import [org.apache.jena.query Query QueryFactory]
           [org.apache.jena.rdf.model Model]
           [org.apache.jena.query DatasetFactory]
           [org.apache.jena.riot Lang RDFDataMgr]))

(derive ::describe ::construct)

