    [grafter.rdf.ontologies.sdmx-measure]
    [grafter.rdf.ontologies.sdmx-attribute]
    [grafter.rdf.ontologies.sdmx-concept])
-  (:require [clojure.java.io :as io])
-  (:require [grafter.rdf.protocols :as pr])
-  (:require [grafter.rdf.sesame :as ses])
+  (:require [clojure.java.io :as io]
+            [grafter.tabular :as tab]
+            [grafter.rdf.protocols :as pr]
+            [grafter.rdf.sesame :as ses])
   (:import [grafter.rdf.protocols Triple Quad]
            [grafter.rdf.sesame ISesameRDFConverter])
   (:import [org.openrdf.model Statement Value Resource Literal URI BNode ValueFactory]

  (reduce conj triple-template
          (mapcat vector hash-map)))

(defmacro graphify [row-bindings & forms]
  "Takes a vector in fn binding form (where destructuring is
supported) followed by a series of graph or triplify forms and
concatenates them all together."
  `(fn graphify-rows-fn [rs#]
     (mapcat (fn graphify-row [row-sym#]
               (let [~@row-bindings row-sym#]
                 (->> (concat
                       ~@forms)
                      (map (fn [triple#] (with-meta triple# {:row row-sym#}))))))
             rs#)))

(defn load-triples [my-repo triple-seq]
  (doseq [triple triple-seq]

      (pr/add-statement my-repo triple)
      (catch java.lang.IllegalArgumentException e
        (throw (Exception.
                (str "Problem loading triple: " (print-str triple) " from row: " (-> triple meta ::row)) e)))))
  my-repo)

(def prefixer ontutils/prefixer)
