1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: data-structures.lisp
6 ;;;; Purpose: Basic data objects for UMLisp
7 ;;;; Author: Kevin M. Rosenberg
12 ;;;; This file, part of UMLisp, is
13 ;;;; Copyright (c) 2000-2006 by Kevin M. Rosenberg, M.D.
15 ;;;; UMLisp users are granted the rights to distribute and use this software
16 ;;;; as governed by the terms of the GNU General Public License.
17 ;;;; *************************************************************************
23 (defparameter *release* "2006AD")
25 (defparameter *umls-path*
26 (make-pathname :directory (list :absolute "srv" "umls" *release*))
27 "Path for base of UMLS data files")
29 (defparameter *meta-dir*
30 (make-pathname :directory '(:relative "META")))
32 (defparameter *lex-dir*
33 (make-pathname :directory '(:relative "LEX")))
35 (defparameter *net-dir*
36 (make-pathname :directory '(:relative "NET")))
38 (defparameter *meta-path*
39 (merge-pathnames *meta-dir* *umls-path*))
41 (defparameter *lex-path*
42 (merge-pathnames *lex-dir* *umls-path*))
44 (defparameter *net-path*
45 (merge-pathnames *net-dir* *umls-path*))
48 (setq *umls-path* (etypecase p
49 (string (parse-namestring p))
51 (setq *meta-path* (merge-pathnames *meta-dir* *umls-path*))
52 (setq *lex-path* (merge-pathnames *lex-dir* *umls-path*))
53 (setq *net-path* (merge-pathnames *net-dir* *umls-path*)))
56 ;;; Structures for parsing UMLS text files
58 (defparameter *umls-files* nil
59 "List of umls file structures. Used when parsing text files.")
60 (defparameter *umls-cols* nil
61 "List of meta column structures. Used when parsing text files.")
66 (defvar *has-fixnum-class* (when (ignore-errors (find-class 'fixnum)) t))
68 (defvar *octet-sql-storage* t
69 "Used to deciding field lengths. Use nil if using UTF-8 database encoding. But, UTF-8 will cause MySQL to double the bytes used for fixed field sizes.")
71 ;; Preliminary objects to replace structures
74 ((subdir :initarg :subdir :accessor subdir)
75 (dir :initarg :dir :accessor dir)
76 (fil :initarg :fil :accessor fil)
77 (table :initarg :table :accessor table)
78 (des :initarg :des :accessor des)
79 (fmt :initarg :fmt :accessor fmt)
80 (cls :initarg :cls :accessor cls)
81 (rws :initarg :rws :accessor rws)
82 (bts :initarg :bts :accessor bts)
83 (fields :initarg :fields :accessor fields)
84 (ucols :initarg :ucols :accessor ucols))
85 (:default-initargs :fil nil :table nil :des nil :fmt nil :cls nil :rws nil :bts nil
86 :fields nil :ucols nil :subdir nil :dir nil)
87 (:documentation "UMLS File"))
90 ((col :initarg :col :accessor col)
91 (des :initarg :des :accessor des)
92 (ref :initarg :ref :accessor ref)
93 (min :initarg :min :accessor cmin)
94 (av :initarg :av :accessor av)
95 (max :initarg :max :accessor cmax)
96 (fil :initarg :fil :accessor fil)
97 (sqltype :initarg :sqltype :accessor sqltype)
98 (dty :initarg :dty :accessor dty :documentation "new in 2002: suggested SQL datatype")
99 (parse-fun :initarg :parse-fun :accessor parse-fun)
100 (quote-str :initarg :quote-str :accessor quote-str)
101 (datatype :initarg :datatype :accessor datatype)
102 (custom-value-fun :initarg :custom-value-fun :accessor custom-value-fun))
103 (:default-initargs :col nil :des nil :ref nil :min nil :av nil :max nil :fil nil
104 :sqltype nil :dty nil :parse-fun nil :datatype nil
105 :custom-value-fun nil)
106 (:documentation "UMLS column"))
109 (defmethod print-object ((obj ufile) (s stream))
110 (print-unreadable-object (obj s :type t)
111 (format s "~A" (fil obj))))
113 (defmethod print-object ((obj ucol) (s stream))
114 (print-unreadable-object (obj s :type t)
115 (format s "~A" (col obj))))