                        (= pos "noun")
                        (sparql/pdgmqry-sparql-noun language2 lpref2 valstring2)
                        :else (sparql/pdgmqry-sparql-fv language2 lpref2 valstring2))
-             ;;query-sparql-pr (replace query-sparql #"<" "&lt;")
         req2 (http/get aama
                        {:query-params
                         {"query" query-sparql2 ;;generated sparql
                          "format" "csv"}})
                          ;;"format" "application/sparql-results+json"}})
                          ;;"format" "text"}})
-        ;;req-pr2 (replace (:body req2) #"<" "&lt;")
-        ;;req-pr4 ( -> (:body req2)
-        ;;             (replace #"[<>]" "\"")
-        ;;             (replace #"\n" " "))
-        ;;lex-form2 (split req-pr4 #" " 2)
-        ;;lex2 (first lex-form2)
-        ;;pdgm2 (rest lex-form2)
         pdgm2 (replace (:body req2) #"\r\n" "%%")
-        ;;pdgmnames (str language1":"valstring1"("lex1")+"language2":"valstring2"("lex2")")
+        pdgm3 (replace (:body req2) #"," "\t\t")
         pdgmnames (str language1":"valstring1"+"language2":"valstring2)
         pdgmstr1 (str pdgm1 pdgm2)
         pdgmstr2 (replace pdgmstr1 #"," "_")
-        ;;pdgms-pr2 (str req-pr3  req-pr4)
-        ;;pdgms-pr2 (str pdgm1  pdgm2)
              ]
   (layout/common
    [:body
       [:h3 "PNames:"]
-       [:pre pdgmnames]
-       ;;[:pre req-pr1]
-       ;;[:pre req-pr2]
+    [:ol
+     [:li (str language1":"valstring1)]
+     [:li (str language2":"valstring2)]]
       [:h3 "Paradigms:"]
       [:p "(csv format)"]
-      [:pre pdgmstr2]
+      [:pre (:body req1)]
+      [:pre (:body req2)]
     [:hr]
       [:h3 "Parallel Display"]
      [:p "Choose PNG Values (comma-separated list)"]

                {:title "PDGMS", :name "pdgmstr"}
                [:option {:value pdgmstr2} "Paradigms"]
                ]]]
         [:tr [:td ]
          [:td [:pre pdgmstr2]]]
         ;;(submit-button "Get pdgm")
         [:tr [:td ]
          [:td [:input#submit

         ;; *nrepl server webapp* buffer (emacs)
         (println pmap )
         [:hr]])
;;      [:p "Enumeration of pngs and pmaps:"]
;;      (for [png pngs]
;;        [:pre png])
;;      [:hr]
      (def npgprint #{})
      [:table
      (for [png pngs]
        [:tr
         (let [pngk (keyword png)]
           (def pngprint false)
          (def pnum 0)
          (for [pmap pmaps] 
            [:div
;;             (def pngprint false)
           (println pngprint)
;;            (let [pnum (inc pnum)]
            (if (pngk pmap)
               (if (false? pngprint)
  ;;               [:div
                (let [npgs (split png #"_")]
                  [:div
                  (for [npg npgs]
                    [:td npg])
;;                   (def pngprint true)
                  ;;needs to be 'while' for pnum > 2
;;                  (if (> pnum 1)
;;                    [:div
;;                    [:td ]
;;                   [:td  (pngk pmap)]])
                [:td (str "a: " (pngk pmap))]
                   (def pngprint true)
                ]
                  )
;;                  ]
               [:td (str "b: " (pngk pmap))]))
;;            )
             ]))])]
;;              (if (true? pgnprint)
                ;;[:td ])]))])))
      [:script {:src "js/goog/base.js" :type "text/javascript"}]
      [:script {:src "js/webapp.js" :type "text/javascript"}]
      [:script {:type "text/javascript"}
       "goog.require('webapp.core');"]])))
    
;; The following is a work-around, limiting the number of pdgms to 2;
;; It will be necessare to generalize this (perhaps along the lines 
;; initiated in handle-pdgmprlldisplay2) to n pdgms.
(defn handle-pdgmprlldisplay3
  [pdgmstr pdgmnames]
  (let [
        pngstring (slurp "pvlists/npg.clj")
        pngs (split pngstring #" ")
        pnames (split pdgmnames #"\+")
        pdgms-sp (split pdgmstr #"%%" 2)
        header (first pdgms-sp)
        pbody (last pdgms-sp)
        pdgms (split pbody (re-pattern (str header "%%")))
        pmaps (for [pdgm pdgms] (pstring2map pdgm))
        pmap1 (first pmaps)
        pmap2 (last pmaps)
        ]
    (layout/common
     [:body
      [:h3 "Parallel Display of Paradigms:" ]
      [:ol
      (for [pname pnames]
        [:li pname])]
      [:hr]
      [:table
       (let [heads (split header #"_")]
         (for [head heads]
           [:th head]))
      (for [png pngs]
        [:tr
         (let [pngk (keyword png)]
            (if (pngk pmap1)
                  [:div
                   (let [npgs (split png #"_")]
                     (for [npg npgs]
                       [:td npg]))
                   [:td (pngk pmap1)]
                   [:td (pngk pmap2)]]
              (if (pngk pmap2)
                  [:div
                   (let [npgs (split png #"_")]
                     (for [npg npgs]
                       [:td npg]))
                   [:td (pngk pmap1)]
                   [:td (pngk pmap2)]]
                  )))])]
      [:script {:src "js/goog/base.js" :type "text/javascript"}]
      [:script {:src "js/webapp.js" :type "text/javascript"}]
      [:script {:type "text/javascript"}
       "goog.require('webapp.core');"]])))
    
(defroutes pdgmcmp-routes
  (GET "/pdgmcmp" [] (pdgmcmp))
  (POST "/pdgmcmpqry" [language1 language2 pos] (handle-pdgmcmpqry language1 language2 pos))
  (POST "/pdgmcmpdisplay" [pos language1 valstring1 language2 valstring2] (handle-pdgmcmpdisplay2 pos language1 valstring1 language2 valstring2))
  (POST "/pdgmprlldisplay" [pdgmstr pdgmnames] (handle-pdgmprlldisplay3 pdgmstr pdgmnames))
  )
