,@(when %%order (list %%order))
(cond
((and ,%single ,%limit)
- (error "Can't set single and limit"))
+ (error "Can't set single (~S) and limit (~S)" ,%single ,%limit))
(,%single
" LIMIT 1")
(,%limit
(let ((query (format nil "SELECT c.cui FROM MRCONSO c,MRXW_ENG x WHERE x.WD ~A '~A' AND x.cui=c.cui AND ~A ~A"
(if like "LIKE" "=")
(clsql-sys::sql-escape-quotes word)
- (typecase sab
+ (etypecase sab
(string
- (format nil " c.sab='" (clsql-sys::sql-escape-quotes sab)))
+ (format nil " c.sab='~A'" (clsql-sys::sql-escape-quotes sab)))
(cons
- (format nil " c.sab IN (~('~A'~^,~))"
+ (format nil " c.sab IN (~{'~A'~^,~})"
(mapcar 'clsql-sys::sql-escape-quotes sab)))
- (t
+ (null
(error "SAB missing")))
(if srl (format nil "AND KCUILRL <= ~A" srl) ""))))
(loop for tuple in (mutex-sql-query query)
- collect (make-instance 'ucon (first tuple)))))
+ collect (make-instance 'ucon :cui (first tuple)))))
(defun find-ustr-word-sab (word &key sab (srl *current-srl*) (like nil))
"Return list of ustr that match word in matching SAB. Optionally, use SQL's LIKE syntax"
(collect-umlisp-query (ustats (name count) nil srl srl :order (name asc))
(make-instance 'ustats :name name :hits (ensure-integer count))))
-
-
-(defun find-bsab-sab (sab)
- (collect-umlisp-query (bonus_sab (name count) nil sab sab :single t)
- (make-instance 'bsab :sab sab :name name :hits (ensure-integer count))))
-
-(defun find-bsab-all ()
- (collect-umlisp-query (bonus_sab (sab name count) nil nil nil :order (sab asc))
- (make-instance 'bsab :sab sab :name name :hits (ensure-integer count))))
-
-(defun find-btty-tty (tty)
- (collect-umlisp-query (bonus_tty (name count) nil tty tty :single t)
- (make-instance 'btty :tty tty :name name :hits (ensure-integer count))))
-
-(defun find-btty-all ()
- (collect-umlisp-query (bonus_tty (tty name count) nil nil nil :order (tty asc))
- (make-instance 'btty :tty tty :name name :hits (ensure-integer count))))
-
-(defun find-brel-rel (rel)
- (collect-umlisp-query (bonus_rel (sab sl rel rela count) nil rel rel)
- (make-instance 'brel :sab sab :sl sl :rel rel :rela rela
- :hits (ensure-integer count))))