X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql-classes.lisp;h=9e71b0f7b09972c0dcc41a68fce99b222e31857a;hb=dff3199405205cf99782dd3abf9d9dde187f5494;hp=6e62db214a273c52f4837b2f74e240b971f78aec;hpb=cc0d0f58d7261d12a8d6a89153f58ea693618e79;p=umlisp.git diff --git a/sql-classes.lisp b/sql-classes.lisp index 6e62db2..9e71b0f 100644 --- a/sql-classes.lisp +++ b/sql-classes.lisp @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: sql-classes.lisp,v 1.71 2003/05/06 01:34:57 kevin Exp $ +;;;; $Id: sql-classes.lisp,v 1.75 2003/05/07 22:53:36 kevin Exp $ ;;;; ;;;; This file, part of UMLisp, is ;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D. @@ -59,16 +59,15 @@ 'string (format nil "select ~A~{~:@(~A~)~^,~} from ~:@(~A~)" (if distinct "distinct " "") fields table) + (if where-name (format nil " where ~:@(~A~)" where-name) "") (if where-name (format nil (typecase where-value - (number " where ~A=~D") - (null " where ~A is null") + (number "=~D") + (null " is null") (t - (if like - " where ~A like '%~A%'" - " where ~A='~A'"))) - where-name where-value) + (if like " like '%~A%""='~A'"))) + where-value) "") (if srl (format nil " and ~:@(~A~)<=~D" lrl srl) "") (if order (format nil " order by ~{~:@(~A~) ~(~A~)~^,~}" order) "") @@ -271,14 +270,14 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" :mg mg :pfstr2 kpfstr2))) (defun find-ucon-rel-cui2 (cui2 &key (srl *current-srl*)) - (mapcar - #'(lambda (cui) (find-ucon-cui cui :srl srl)) - (remove-duplicates (mapcar #'cui1 (find-urel-cui2 cui2 :srl srl))))) + (loop for cui in (remove-duplicates + (mapcar #'cui1 (find-urel-cui2 cui2 :srl srl))) + collect (find-ucon-cui cui :srl srl))) (defun find-ucoc-cui (cui &key (srl *current-srl*)) "Return a list of ucoc for cui" (with-umlisp-query (mrcoc (cui2 soc cot cof coa kpfstr2) srl cui1 - (parse-cui cui) :lrl "KSRL" :order (cof asc)) + (parse-cui cui) :lrl klrl :order (cof asc)) (setq cui2 (ensure-integer cui2)) (when (zerop cui2) (setq cui2 nil)) (make-instance 'ucoc :cui1 (parse-cui cui) :cui2 (ensure-integer cui2) @@ -288,7 +287,7 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" (defun find-ucoc-cui2 (cui2 &key (srl *current-srl*)) "Return a list of ucoc for cui2" (with-umlisp-query (mrcoc (cui1 soc cot cof coa kpfstr2) srl cui2 - (parse-cui cui2) :lrl "KSRL" :order (cof asc)) + (parse-cui cui2) :lrl klrl :order (cof asc)) (setq cui2 (ensure-integer cui2)) (when (zerop cui2) (setq cui2 nil)) (make-instance 'ucoc :cui1 (ensure-integer cui1) :cui2 (parse-cui cui2) @@ -308,11 +307,6 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" (make-instance 'ulo :isn isn :fr (ensure-integer fr) :un un :sui (ensure-integer sui) :sna sna :soui soui))) -(defgeneric suistr (lo)) -(defmethod suistr ((lo ulo)) - "Return the string for a ulo object" - (find-string-sui (sui lo))) - (defun find-uatx-cui (cui &key (srl *current-srl*)) "Return a list of uatx for cui" (with-umlisp-query (mratx (sab rel atx) srl cui (parse-cui cui) :lrl ksrl) @@ -506,6 +500,18 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" :order (cui asc sui asc)) (find-ustr-cuisui (ensure-integer cui) (ensure-integer sui) :srl srl))) +(defun find-ucon-noneng-word (word &key (srl *current-srl*) (like nil)) + "Return list of ucons that match non-english word" + (with-umlisp-query-eval ('mrxw_noneng '(cui) srl 'wd word :like like + :distinct t :lrl 'klrl :order '(cui asc)) + (find-ucon-cui cui :srl srl))) + +(defun find-ustr-noneng-word (word &key (srl *current-srl*)) + "Return list of ustrs that match non-english word" + (with-umlisp-query (mrxw_noneng (cui sui) srl wd word :lrl klrl + :order (cui asc sui asc)) + (find-ustr-cuisui (ensure-integer cui) (ensure-integer sui) :srl srl))) + ;; Special tables (defun find-usrl-all ()