X-Git-Url: http://git.kpe.io/?p=umlisp.git;a=blobdiff_plain;f=create-sql.lisp;h=04bc2b6bed3e0f676ddeb64761509a7360fd39e3;hp=ad46fb4d28c45fc788ad9b2c6f5385a7625e1f8f;hb=e6ef11f4c42de5a6754f73d9a714a0213b3a0133;hpb=d5cdac77d9abe5fbff91ea11e1d2929b082bffbe diff --git a/create-sql.lisp b/create-sql.lisp index ad46fb4..04bc2b6 100644 --- a/create-sql.lisp +++ b/create-sql.lisp @@ -211,7 +211,8 @@ (defun sql-create-indexes (conn &key (indexes +index-cols+) verbose) "SQL Databases: create all indexes" (dolist (idx indexes) - (when verbose (format t "UMLS Import: Creating index ~S.~%" idx)) + (when verbose (format t "UMLS Import: Creating index for column ~A on table ~A.~%" + (first idx) (second idx))) (ignore-errors (sql-execute (drop-index-cmd (car idx) (cadr idx)) conn)) (sql-execute (create-index-cmd (car idx) (cadr idx) (caddr idx)) conn))) @@ -276,9 +277,10 @@ This is much faster that using create-umls-db-insert." (defun translate-all-files (&key (extension "-trans") verbose force) "Translate all *umls-files* to optimized import format." - (make-noneng-index-file extension) + (when verbose (format t "UMLS Import: Translating file ~A.~%" (fil (find-ufile "MRXW_NONENG.RRF")))) + (make-noneng-index-file extension :force force) (dolist (f (remove "MRXW_NONENG.RRF" *umls-files* :test #'string= :key #'fil)) - (when verbose (format t "UMLS Import: translating file ~S.~%" (fil f))) + (when verbose (format t "UMLS Import: Translating file ~A.~%" (fil f))) (translate-umls-file f extension :force force))) (defun translate-umls-file (file extension &key force) @@ -332,6 +334,7 @@ This is much faster that using create-umls-db-insert." (return-from translate-files output-path)) (with-open-file (ostream output-path :direction :output :if-exists :overwrite + :if-does-not-exist :create #+(and clisp unicode) :external-format #+(and clisp unicode) charset:utf-8) (dolist (input-ufile input-ufiles) @@ -420,9 +423,9 @@ This is much faster that using create-umls-db-insert." (declare (optimize (speed 3) (space 0))) (ensure-ucols+ufiles) (let ((max 0)) - (declare (fixnum max)) + (declare (type (integer 0 1000000) max)) (dolist (ucol *umls-cols*) - (when (> (cmax ucol) max) + (when (> (the (integer 0 1000000) (cmax ucol)) max) (setq max (cmax ucol)))) max)) @@ -433,7 +436,11 @@ This is much faster that using create-umls-db-insert." (let ((rowsizes '())) (dolist (file *umls-files*) (let ((row 0)) + (declare (type (integer 0 1000000) row)) (dolist (ucol (ucols file)) - (incf row (1+ (cmax ucol)))) + (let* ((col-max (cmax ucol)) + (max-with-delim (1+ col-max))) + (declare (type (integer 0 1000000) col-max max-with-delim)) + (incf row max-with-delim))) (push row rowsizes))) (car (sort rowsizes #'>))))