Fix creation of KCUILUI field
[umlisp.git] / sql-classes.lisp
index 2805b8017172b55291765589176f7d7627c9ec1b..9722be4f830a388f4bb93f694f9412cf07d4bfe0 100644 (file)
@@ -20,7 +20,7 @@
 (defvar *current-srl* nil)
 (defun current-srl ()
   *current-srl*)
-(defun (setf current-srl) (srl)
+(defun set-current-srl (srl)
   (setq *current-srl* srl))
 
 (defmacro query-string (table fields srl where-name where-value
@@ -85,7 +85,7 @@
                  (number "='~D'")
                  (null " IS NULL")
                  (t
-                  (if like " LINK '%~A%""='~A'")))
+                  (if like " LIKE '%~A%'" "='~A'")))
                where-value)
        "")
    (if filter (concatenate 'string " AND " filter) nil)
@@ -602,11 +602,11 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
 (defun find-uso-cuisui (cui sui &key (srl *current-srl*))
   (ensure-sui-integer sui)
   (ensure-cui-integer cui)
-  (collect-umlisp-query (mrconso (aui sab code srl tty saui sdui scui lat str)
+  (collect-umlisp-query (mrconso (aui sab code srl tty saui sdui scui lat str ts)
                                  srl kcuisui (make-cuisui cui sui) :lrl srl)
     (make-instance 'uso :aui aui :sab sab :code code :srl srl :tty tty
                    :cui cui :sui sui :saui saui :sdui sdui :scui scui
-                   :lat lat :str str)))
+                   :lat lat :str str :ts ts)))
 
 (defun find-uso-cui (cui &key (srl *current-srl*) (english-only nil) limit)
   (ensure-cui-integer cui)
@@ -691,13 +691,14 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
                    :cxty cxty :ttyl ttyl :atnl atnl :lat lat :cenc cenc
                    :curver curver :sabin sabin :ssn ssn :scit scit)))
 
-(defun find-usab-by-key (key-name key)
+(defun find-usab-by-key (key-name key &key current)
   "Find usab for a key"
   (collect-umlisp-query-eval ('mrsab '(vcui rcui vsab rsab son sf sver vstart
                                        vend imeta rmeta slc scc srl tfr cfr cxty
                                        ttyl atnl lat cenc curver sabin
                                        ssn scit)
-                                     nil key-name key :single t)
+                                     nil key-name key :single t
+                                     :filter (when current "RMETA=''"))
      (make-instance 'usab :vcui (ensure-integer vcui)
                     :rcui (ensure-integer rcui) :vsab vsab :rsab rsab :son son
                     :sf sf :sver sver :vstart vstart :vend vend :imeta imeta
@@ -707,11 +708,11 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
                     :curver curver :sabin sabin
                     :ssn ssn :scit scit)))
 
-(defun find-usab-rsab (rsab)
+(defun find-usab-rsab (rsab &key (current t))
   "Find usab for rsab"
   (find-usab-by-key 'rsab rsab))
 
-(defun find-usab-vsab (vsab)
+(defun find-usab-vsab (vsab &key (current t))
   "Find usab for vsab"
   (find-usab-by-key 'vsab vsab))