X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql-classes.lisp;h=920ee8df4c4111fa9737b54ab5128903b3afab35;hb=f513e7b50135115f3c56b840c2cb0d1c9c8ffa82;hp=e193f8b89975e5e98daef92295e49b70c056e3e9;hpb=cd8b476663925be5a1ebbeb569a056e2e5b93aba;p=umlisp.git diff --git a/sql-classes.lisp b/sql-classes.lisp index e193f8b..920ee8d 100644 --- a/sql-classes.lisp +++ b/sql-classes.lisp @@ -1,4 +1,4 @@ -;;; $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) @@ -79,9 +79,9 @@ (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*)) @@ -130,10 +130,10 @@ (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)) @@ -358,12 +358,12 @@ (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*)) @@ -391,14 +391,14 @@ (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*)) @@ -526,16 +526,16 @@ (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 () @@ -732,9 +732,9 @@ eliminate duplicates." (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)) @@ -743,15 +743,15 @@ eliminate duplicates." ;;; 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)) @@ -774,10 +774,10 @@ eliminate duplicates." ;; 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) @@ -788,10 +788,10 @@ eliminate duplicates." (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) @@ -802,10 +802,10 @@ eliminate duplicates." (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 @@ -818,10 +818,10 @@ eliminate duplicates." (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 @@ -832,10 +832,10 @@ eliminate duplicates." (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 @@ -847,10 +847,10 @@ eliminate duplicates." (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 @@ -863,10 +863,10 @@ eliminate duplicates." (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 @@ -881,10 +881,10 @@ eliminate duplicates." (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 @@ -896,10 +896,10 @@ eliminate duplicates." (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 @@ -910,10 +910,10 @@ eliminate duplicates." (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 @@ -923,10 +923,10 @@ eliminate duplicates." (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 @@ -937,10 +937,10 @@ eliminate duplicates." (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))))) @@ -948,24 +948,24 @@ eliminate duplicates." ;;; 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)) @@ -974,10 +974,10 @@ eliminate duplicates." (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 @@ -986,10 +986,10 @@ eliminate duplicates." (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 @@ -1001,10 +1001,10 @@ eliminate duplicates." (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) @@ -1014,10 +1014,10 @@ eliminate duplicates." (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)