                             {:query-params
                              {"query" query-sparql ;;generated sparql
                               ;;"format" "application/sparql-results+json"}})]
-                              "format" "text"}})
-                              ;;"format" "csv"}})
+                              ;;"format" "text"}})
+                              "format" "csv"}})
               ;;reqvec (csv/parse-csv req)
               reqvec (split (:body req) #"\n")
               header (first reqvec)

         [:tr [:td @curcat1][:td @curcat2][:td (:cat3 catmap)]]
         ))))]))

(defn csv2table-3
"Takes sorted 3-col csv list and outputs html table with empty [:td]  for repeated col1 and vec of col3 vals for repeated col2. [IN PROGRESS!]"
 [lpvs]
(let  [curcat1 (atom "")
      curcat2 (atom "")
      curcat3 (atom "")
       ]
 [:table
(for [lpv lpvs]
 (let [catmap (zipmap [:cat1 :cat2 :cat3] (split lpv #","))
       ;;nextmap (zipmap [:cat1 :cat2 :cat3] (split (first (rest lpvs)) #","))
       ]
   (if (= (:cat1 catmap) @curcat1)

     (if (= (:cat2 catmap) @curcat2)
       ;;(reset! curcat3 (str @curcat3 " " (:cat3 catmap)))
       [:td (:cat3 catmap)]
       (do [:tr [:td] [:td @curcat2][:td @curcat3]]
          (reset! curcat2 (:cat2 catmap))
          (reset! curcat3 (:cat3 catmap))
           ))
       
     (do (reset! curcat1 (:cat1 catmap))
         (reset! curcat2 (:cat2 catmap))
         [:tr [:td @curcat1][:td @curcat2][:td (:cat3 catmap)]]
         ))))]))

(defn csv2table-4
"Takes sorted 3-col csv list and outputs html table with empty [:td]  for repeated col1 and vec of col3 vals for repeated col2. [IN PROGRESS!]"
[lpvs]
(let  [curcat1 (atom "")
      curcat2 (atom "")
      curcat3 (atom [])
       ]
 [:table
(for [lpv lpvs]
 (let [catmap (zipmap [:cat1 :cat2 :cat3] (split lpv #","))
       ]
   (if (= (:cat1 catmap) @curcat1)

     (if (= (:cat2 catmap) @curcat2)
       (swap! curcat3 conj (:cat3 catmap))
       (do [:tr [:td] [:td @curcat2][:td @curcat3]]
           (reset! curcat2 (:cat2 catmap))
           (reset! curcat3 [])
           (swap! curcat3 conj (:cat3 catmap))))
       
    (if (= @curcat1 "")
     (do (reset! curcat1 (:cat1 catmap))
         (reset! curcat2 (:cat2 catmap))
         (swap! curcat3 conj (:cat3 catmap)))
     (do [:tr [:td @curcat1][:td @curcat2][:td @curcat3]]
         (reset! curcat1 (:cat1 catmap))
         (reset! curcat2 (:cat2 catmap))
         (swap! curcat3 conj (:cat3 catmap)))
     ))))]))


;; try (while) -- 
;; cf. "(while (pos? @a) (do (println @a) (swap! a dec)))"


              [:td [:input#submit
                    {:value "Make Language-Property-Value Lists", :name "submit", :type "submit"}]]]]))))

(defn csv2table
"Takes sorted 3-col csv list and outputs html table with empty [:td]  for repeated col1 and vec of col3 vals for repeated col2. [IN PROGRESS!]"
 [lpvs]
