                     (dissoc :dag_unify.core/serialized)
                     strip-refs
                     json/write-str)
-                (-> expression serialize vec str)
                 language model-name]])
     (catch Exception e
       (log/error (str "SQL error: " (.printStackTrace (.getNextException(.getSQLException e))))))))

    (exec-raw [(let [insert
                     (str "INSERT INTO " table
                          "(surface, structure, spec, "
                          " serialized, language, model)"
                          " VALUES (?,?::jsonb,?::jsonb,?,?,?)")]
                 (log/trace (str "INSERT IS : " insert))
                 insert)
               [surface

      (throw (Exception. message)))
    ;; else, lexeme is valid for insertion
    (exec-raw [(str "INSERT INTO lexeme 
                                 (canonical, structure, language) 
                          VALUES (?,?::jsonb,?)")
               [canonical
                (json/write-str (dissoc (strip-refs lexeme) :dag_unify.core/serialized))
                language]])))

;; TODO: change all calls to populate-with-language to set source-language if needed
