-;;; $Id: sql-classes.lisp,v 1.1 2002/10/08 22:08:56 kevin Exp $
+;;; $Id: sql-classes.lisp,v 1.2 2002/10/09 00:34:47 kevin Exp $
(in-package :umlisp)
(if srl
(string-append ls (format nil " and KCUILRL <= ~d limit 1" srl))
(string-append ls " limit 1"))
- (gu:awhen (car (mutex-sql-query ls))
- (make-instance 'ucon :cui cui :pfstr (car gu::it)
- :lrl (ensure-integer (cadr gu::it)))))
+ (kmrcl:awhen (car (mutex-sql-query ls))
+ (make-instance 'ucon :cui cui :pfstr (car kmrcl::it)
+ :lrl (ensure-integer (cadr kmrcl::it)))))
nil))
(defun find-ucon-lui (lui &key (srl *current-srl*))
(make-cuisui cui sui))))
(when srl
(string-append ls (format nil " and KCUILRL <= ~d" srl)))
- (gu:aif (car (mutex-sql-query ls))
- (make-instance 'ucon :cui (ensure-integer (nth 0 gu::it))
- :pfstr (nth 1 gu::it)
- :lrl (ensure-integer (nth 2 gu::it)))
+ (kmrcl:aif (car (mutex-sql-query ls))
+ (make-instance 'ucon :cui (ensure-integer (nth 0 kmrcl::it))
+ :pfstr (nth 1 kmrcl::it)
+ :lrl (ensure-integer (nth 2 kmrcl::it)))
nil))
nil))
(let ((ls (format nil "select LAT,TS,KLUILRL from MRCON where KCUILUI=~d limit 1" (make-cuilui cui lui))))
(when srl
(string-append ls (format nil " and KLUILRL <= ~d" srl)))
- (gu:aif (car (mutex-sql-query ls))
+ (kmrcl:aif (car (mutex-sql-query ls))
(make-instance 'uterm :cui cui
:lui lui
- :lat (nth 0 gu::it)
- :ts (nth 1 gu::it)
- :lrl (ensure-integer (nth 2 gu::it)))
+ :lat (nth 0 kmrcl::it)
+ :ts (nth 1 kmrcl::it)
+ :lrl (ensure-integer (nth 2 kmrcl::it)))
nil)))
(defun find-ustr-cuilui (cui lui &key (srl *current-srl*))
(make-cuisui cui sui))))
(when srl
(string-append ls (format nil " and LRL <= ~d" srl)))
- (gu:aif (car (mutex-sql-query ls))
+ (kmrcl:aif (car (mutex-sql-query ls))
(make-instance 'ustr :sui sui
:cui cui
:cuisui (make-cuisui cui sui)
- :lui (ensure-integer (nth 0 gu::it))
- :stt (nth 1 gu::it)
- :str (nth 2 gu::it)
- :lrl (ensure-integer (nth 3 gu::it)))
+ :lui (ensure-integer (nth 0 kmrcl::it))
+ :stt (nth 1 kmrcl::it)
+ :str (nth 2 kmrcl::it)
+ :lrl (ensure-integer (nth 3 kmrcl::it)))
nil)))
(defun find-ustr-sui (sui &key (srl *current-srl*))
(defun find-usty-tui (tui)
"Find usty for tui"
(setq tui (parse-tui tui))
- (gu:aif (car (mutex-sql-query
+ (kmrcl:aif (car (mutex-sql-query
(format nil "select STY from MRSTY where TUI=~d limit 1" tui)))
- (make-instance 'usty :tui tui :sty (nth 0 gu::it))
+ (make-instance 'usty :tui tui :sty (nth 0 kmrcl::it))
nil))
(defun find-usty-sty (sty)
"Find usty for a sty"
- (gu:aif (car (mutex-sql-query
+ (kmrcl:aif (car (mutex-sql-query
(format nil "select TUI from MRSTY where STY='~a' limit 1" sty)))
- (make-instance 'usty :tui (ensure-integer (nth 0 gu::it)) :sty sty)
+ (make-instance 'usty :tui (ensure-integer (nth 0 kmrcl::it)) :sty sty)
nil))
(defun find-usty-all ()
(decf score (- nlong nshort)) ;; reduce score for extra words
(dotimes (iword nshort)
(declare (fixnum iword))
- (gu:aif (position (nth iword short-list) long-list :test #'string-equal)
+ (kmrcl:aif (position (nth iword short-list) long-list :test #'string-equal)
(progn
- (incf score (- 10 (abs (- gu::it iword))))
+ (incf score (- 10 (abs (- kmrcl::it iword))))
(decf unmatched))))
(decf score (* 2 unmatched))
score))
;;; LEX SQL functions
(defun find-lexterm-eui (eui)
- (gu:awhen (car (mutex-sql-query
+ (kmrcl:awhen (car (mutex-sql-query
(format nil "select WRD from LRWD where EUI=~d" eui)))
- (make-instance 'lexterm :eui eui :wrd (nth 0 gu:it))))
+ (make-instance 'lexterm :eui eui :wrd (nth 0 kmrcl:it))))
(defun find-lexterm-word (wrd)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select EUI from LRWD where WRD='~a'" wrd))
(let ((terms '()))
- (dolist (tuple gu:it)
+ (dolist (tuple kmrcl:it)
(let ((eui (ensure-integer (nth 0 tuple))))
(push
(make-instance 'lexterm :eui eui :wrd (copy-seq wrd))
;; LEX SQL Read functions
(defun find-labr-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,ABR,EUI2,BAS2 from LRABR where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'labr :eui eui
:bas (nth 0 tuple)
(nreverse results))))
(defun find-labr-bas (bas)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select EUI,ABR,EUI2,BAS2 from LRABR where BAS='~a'" bas))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'labr :eui (ensure-integer (nth 0 tuple))
:bas (copy-seq bas)
(nreverse results))))
(defun find-lagr-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select STR,SCA,AGR,CIT,BAS from LRAGR where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'lagr
:eui eui
(nreverse results))))
(defun find-lcmp-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,SCA,COM from LRCMP where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'lcmp
:eui eui
(nreverse results))))
(defun find-lmod-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,SCA,PSN_MOD,FEA from LRMOD where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'lmod
:eui eui
(nreverse results))))
(defun find-lnom-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,SCA,EUI2,BAS2,SCA2 from LRNOM where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'lnom
:eui eui
(nreverse results))))
(defun find-lprn-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,NUM,GND,CAS,POS,QNT,FEA from LRPRN where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'lprn
:eui eui
(nreverse results))))
(defun find-lprp-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,STR,SCA,FEA from LRPRP where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'lprp
:eui eui
(nreverse results))))
(defun find-lspl-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select SPV,BAS from LRSPL where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'lspl
:eui eui
(defun find-ltrm-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,GEN from LRTRM where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'ltrm
:eui eui
(nreverse results))))
(defun find-ltyp-eui (eui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select BAS,SCA,TYP from LRTYP where EUI=~d" eui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'ltyp
:eui eui
(nreverse results))))
(defun find-lwd-wrd (wrd)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select EUI from LRWD where WRD='~a'" wrd))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push (ensure-integer (nth 0 tuple)) results))
(make-instance 'lwd :wrd wrd
:euilist (nreverse results)))))
;;; Semantic Network SQL access functions
(defun find-sdef-ui (ui)
- (gu:awhen (car (mutex-sql-query
+ (kmrcl:awhen (car (mutex-sql-query
(format nil "select RT,STY_RL,STN_RTN,DEF,EX,UN,RH,ABR,RIN from SRDEF where UI=~d" ui)))
- (make-instance 'sdef :rt (nth 0 gu::it)
+ (make-instance 'sdef :rt (nth 0 kmrcl::it)
:ui ui
- :styrl (nth 1 gu::it)
- :stnrtn (nth 2 gu::it)
- :def (nth 3 gu::it)
- :ex (nth 4 gu::it)
- :un (nth 5 gu::it)
- :rh (nth 6 gu::it)
- :abr (nth 7 gu::it)
- :rin (nth 8 gu::it))))
+ :styrl (nth 1 kmrcl::it)
+ :stnrtn (nth 2 kmrcl::it)
+ :def (nth 3 kmrcl::it)
+ :ex (nth 4 kmrcl::it)
+ :un (nth 5 kmrcl::it)
+ :rh (nth 6 kmrcl::it)
+ :abr (nth 7 kmrcl::it)
+ :rin (nth 8 kmrcl::it))))
(defun find-sstre1-ui (ui)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select UI2,UI3 from SRSTRE1 where UI=~d" ui))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'sstre1 :ui ui
:ui2 (ensure-integer (nth 0 tuple))
(nreverse results))))
(defun find-sstre1-ui2 (ui2)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select UI,UI3 from SRSTRE1 where UI2=~d" ui2))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'sstre1 :ui (ensure-integer (nth 0 tuple))
:ui2 ui2
(nreverse results))))
(defun find-sstr-rl (rl)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select STY_RL,STY_RL2,LS from SRSTRE where RL='~a'" rl))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'sstr
:rl rl
(defun find-sstre2-sty (sty)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select RL,STY2 from SRSTRE2 where STY='~a'" sty))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'sstre2
:sty (copy-seq sty)
(nreverse results))))
(defun find-sstr-styrl (styrl)
- (gu:awhen (mutex-sql-query
+ (kmrcl:awhen (mutex-sql-query
(format nil "select RL,STY_RL2,LS from SRSTR where RL='~a'" styrl))
(let ((results '()))
- (dolist (tuple gu::it)
+ (dolist (tuple kmrcl::it)
(push
(make-instance 'sstr :styrl styrl
:rl (nth 0 tuple)