(defun sql-create-indexes (conn &key (indexes +index-cols+) verbose)
"SQL Databases: create all indexes"
(dolist (idx indexes)
(defun sql-create-indexes (conn &key (indexes +index-cols+) verbose)
"SQL Databases: create all indexes"
(dolist (idx indexes)
(ignore-errors (sql-execute (drop-index-cmd (car idx) (cadr idx)) conn))
(sql-execute (create-index-cmd (car idx) (cadr idx) (caddr idx)) conn)))
(ignore-errors (sql-execute (drop-index-cmd (car idx) (cadr idx)) conn))
(sql-execute (create-index-cmd (car idx) (cadr idx) (caddr idx)) conn)))
(sql-create-indexes conn :indexes +custom-index-cols+ :verbose verbose)
(sql-create-special-tables conn)))
(sql-create-indexes conn :indexes +custom-index-cols+ :verbose verbose)
(sql-create-special-tables conn)))
"SQL Databases: initializes entire database via SQL copy commands.
This is much faster that using create-umls-db-insert."
(when verbose (format t "UMLS Import: Starting.~%"))
(ensure-ucols+ufiles)
(when verbose (format t "UMLS Import: Preparsing files.~%"))
(ensure-preparse)
"SQL Databases: initializes entire database via SQL copy commands.
This is much faster that using create-umls-db-insert."
(when verbose (format t "UMLS Import: Starting.~%"))
(ensure-ucols+ufiles)
(when verbose (format t "UMLS Import: Preparsing files.~%"))
(ensure-preparse)
- (unless skip-translation
- (when verbose (format t "UMLS Import: Converting text UMLS files to optimized format.~%"))
- (translate-all-files extension))
+ (when verbose (format t "UMLS Import: Converting text UMLS files to optimized format.~%"))
+ (translate-all-files :extension extension :verbose verbose :force force-translation)
(sql-execute (funcall copy-cmd file extension) conn))
(When verbose (format t "UMLS Import: Creating SQL indices.~%"))
(sql-create-indexes conn :verbose verbose)
(sql-execute (funcall copy-cmd file extension) conn))
(When verbose (format t "UMLS Import: Creating SQL indices.~%"))
(sql-create-indexes conn :verbose verbose)
-(defun translate-all-files (&optional (extension "-trans"))
- "Copy translated files and return postgresql copy commands to import"
+(defun translate-all-files (&key (extension "-trans") verbose force)
+ "Translate all *umls-files* to optimized import format."
(make-noneng-index-file extension)
(dolist (f (remove "MRXW_NONENG.RRF" *umls-files* :test #'string= :key #'fil))
(make-noneng-index-file extension)
(dolist (f (remove "MRXW_NONENG.RRF" *umls-files* :test #'string= :key #'fil))
(defun verify-translation-file (output-path input-ufiles)
"Returns t if translation file exists and is correct size. Warns and deletes incomplete translation file."
(defun verify-translation-file (output-path input-ufiles)
"Returns t if translation file exists and is correct size. Warns and deletes incomplete translation file."
"Translate a umls file into a format suitable for sql copy cmd"
(let ((output-path (ufile-pathname out-ufile extension)))
"Translate a umls file into a format suitable for sql copy cmd"
(let ((output-path (ufile-pathname out-ufile extension)))
#+(and clisp unicode) :external-format
#+(and clisp unicode) charset:utf-8)
(dolist (input-ufile input-ufiles)
#+(and clisp unicode) :external-format
#+(and clisp unicode) charset:utf-8)
(dolist (input-ufile input-ufiles)
- (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)))