                       ;;  {:synsem {:subcat '()}} that makes us try to generate
                       ;; an entire sentence.
                       (throw (Exception. message))))))
-
-        debug (log/debug (str "target surface  : " target-language-surface))
-        debug (log/debug (str "target-semantics:" semantics))
-        
-        ;; 2. generate sentence in source language using semantics of sentence in target language.
-        ;; resolve future
-        source-language-model (if (future? source-language-model)
-                                @source-language-model
-                                source-language-model)
-        debug (log/debug (str "semantics of resulting expression: " semantics))
-        debug (log/trace (str "entire expression: " target-language-sentence))
-
-
-        source-language (:language source-language-model)
         ;; TODO: add warning if semantics of target-expression is merely :top - it's
         ;; probably not what the caller expected. Rather it should be something more
         ;; specific, like {:pred :eat :subj {:pred :antonio}} ..etc.

   (exec-raw [(str "TRUNCATE " table)])))
;; catch exceptions when trying to populate

(defn expression-single [model spec]
  (let [no-language (if (nil? model)
                             (throw (Exception. "No target language model was supplied.")))

        ;; 1. generate sentence in target language.
        ;; resolve future
        model (if (future? model)
                @model
                model)

        sentence (engine/generate spec model :enrich true)
        
        sentence (if (:morph-walk-tree model)
                   (merge ((:morph-walk-tree model) sentence)
                          sentence)

               [canonical (str (serialize lexeme))
                language]]))

(defn populate-with-language [num model spec]
  (let [spec (if spec spec :top)
        language (:language model)
        debug (log/debug (str "populate-with-language: spec: " spec "; language: " language))]
    (dotimes [n num]
      (let [sentence (expression model spec)
            fo (:morph model)
            surface (fo sentence)]
        (if (empty? surface)
          (let [err-mesg (str "Surface was empty for expression generated from spec: " spec)]
            (log/error err-mesg)
            (log/error (str " expression with empty surface has structure: " (strip-refs sentence)))
            (throw (Exception. err-mesg))))
        (log/info (str "populate-with-language:" language ": surface='"
                       surface "'"))
        (log/debug (str "populate-with-language:" language ": spec='"
                       spec "'"))
        (insert-expression sentence ;; underlying structure
                           surface ;; text of expression
                           "expression" ;; table in database
                           language
                           (:name model)) ;; name of language model; e.g.: 'small','medium'
        ))))

;; TODO: use named optional parameters.
(defn populate [num source-language-model target-language-model & [ spec table ]]
  (let [spec (if spec spec :top)
