X-Git-Url: http://git.kpe.io/?p=umlisp.git;a=blobdiff_plain;f=sql-classes.lisp;h=d1e19f3fea74dd3a36293dab1793f3b24250fad4;hp=7736eb6ccc4107bca8f8321d4fa4141bfa75eee4;hb=HEAD;hpb=cd3df5cb167a754ef0d2f9cb21afeb821528f266 diff --git a/sql-classes.lisp b/sql-classes.lisp index 7736eb6..d086fd4 100644 --- a/sql-classes.lisp +++ b/sql-classes.lisp @@ -27,13 +27,13 @@ &key (lrl "KCUILRL") single distinct order like limit filter) (let* ((%%fields (format nil "SELECT ~A~{~:@(~A~)~^,~} FROM ~:@(~A~)" - (if distinct "DISTINCT " "") fields table)) + (if distinct "DISTINCT " "") (sqlname fields) table)) (%%order (if order (format nil " ORDER BY ~{~:@(~A~) ~(~A~)~^,~}" order) "")) (%%lrl (format nil " AND ~:@(~A~)<=" lrl)) (%%where (when where-name - (format nil " WHERE ~:@(~A~)~A" where-name + (format nil " WHERE ~:@(~A~)~A" (sqlname where-name) (if like " like " "")))) (%filter (gensym "FILTER-")) (%single (gensym "SINGLE-")) @@ -77,8 +77,8 @@ (concatenate 'string (format nil "SELECT ~A~{~:@(~A~)~^,~} FROM ~:@(~A~)" - (if distinct "DISTINCT " "") fields table) - (if where-name (format nil " WHERE ~:@(~A~)" where-name) "") + (if distinct "DISTINCT " "") (sqlname fields) table) + (if where-name (format nil " WHERE ~:@(~A~)" (sqlname where-name)) "") (if where-name (format nil (typecase where-value @@ -495,7 +495,7 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" (mapcar #'cui1 (find-urel-cui2 cui2 :srl srl))) collect (find-ucon-cui cui :srl srl))) -(defun find-ucoc-cui (cui &key (srl *current-srl*)) +#+mrcoc (defun find-ucoc-cui (cui &key (srl *current-srl*)) "Return a list of ucoc for cui" (ensure-cui-integer cui) (collect-umlisp-query (mrcoc (aui1 cui2 aui2 sab cot cof coa) srl cui1 @@ -507,7 +507,7 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" :cot cot :cof (ensure-integer cof) :coa coa :sab sab :pfstr2 (find-pfstr-cui cui2)))) -(defun find-ucoc-cui2 (cui2 &key (srl *current-srl*)) +#+mrcoc (defun find-ucoc-cui2 (cui2 &key (srl *current-srl*)) "Return a list of ucoc for cui2" (ensure-cui-integer cui2) (collect-umlisp-query (mrcoc (cui1 aui1 aui2 sab cot cof coa) srl cui2 @@ -518,7 +518,7 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" :sab sab :cot cot :cof (ensure-integer cof) :coa coa :pfstr2 (find-pfstr-cui cui2)))) -(defun find-ucon-coc-cui2 (cui2 &key (srl *current-srl*)) +#+mrcoc (defun find-ucon-coc-cui2 (cui2 &key (srl *current-srl*)) "List of ucon with co-occurance cui2" (ensure-cui-integer cui2) (mapcar @@ -1130,3 +1130,14 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" (defun find-ustats-srl (srl) (collect-umlisp-query (ustats (name count) nil srl srl :order (name asc)) (make-instance 'ustats :name name :hits (ensure-integer count)))) + +(defun find-urank-sab (sab &key (srl *current-srl*)) + (collect-umlisp-query (mrrank (rank sab suppress tty) nil sab sab) + (make-instance 'urank :rank rank :sab sab :tty tty :suppress suppress))) + +(defun find-urank-all (&key (srl *current-srl*)) + (if srl + (collect-umlisp-query (mrrank (rank sab suppress tty) nil ksrl srl) + (make-instance 'urank :rank rank :sab sab :tty tty :suppress suppress)) + (collect-umlisp-query (mrrank (rank sab suppress tty ksrl) nil nil nil) + (make-instance 'urank :rank rank :sab sab :tty tty :suppress suppress))))