r4837: Auto commit for Debian build
[umlisp.git] / data-structures.lisp
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          data-structures.lisp
6 ;;;; Purpose:       Basic data objects for UMLisp
7 ;;;; Author:        Kevin M. Rosenberg
8 ;;;; Date Started:  Apr 2000
9 ;;;;
10 ;;;; $Id: data-structures.lisp,v 1.7 2003/05/06 06:09:29 kevin Exp $
11 ;;;;
12 ;;;; This file, part of UMLisp, is
13 ;;;;    Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
14 ;;;;
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 ;;;; *************************************************************************
18
19 (in-package #:umlisp)
20
21 (eval-when (:compile-toplevel)
22   (declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))))
23
24 ;;; Paths for files
25
26 (defvar *umls-path*
27   (make-pathname :directory '(:absolute "data" "umls" "2003AA"))
28   "Path for base of UMLS data files")
29
30 (defvar *meta-path* 
31     (merge-pathnames 
32      (make-pathname :directory '(:relative "META"))
33      *umls-path*))
34
35 (defvar *lex-path* 
36     (merge-pathnames 
37      (make-pathname :directory '(:relative "LEX"))
38      *umls-path*))
39
40 (defvar *net-path* 
41     (merge-pathnames 
42      (make-pathname :directory '(:relative "NET"))
43      *umls-path*))
44
45 (defun umls-path! (p)
46   (setq *umls-path* p))
47
48
49 ;;; Structures for parsing UMLS text files
50  
51 (defparameter *umls-files* nil 
52   "List of umls file structures. Used when parsing text files.")
53 (defparameter *umls-cols* nil 
54   "List of meta column structures. Used when parsing text files.")
55
56
57 ;; Preliminary objects to replace structures
58
59 (defclass ufile ()
60   ((fil :initarg :fil)
61    (table :initarg :table)
62    (des :initarg :des)
63    (fmt :initarg :fmt)
64    (cls :initarg :cls)
65    (rws :initarg :rws)
66    (bts :initarg :bts)
67    (fields :initarg :fields)
68    (ucols :initarg ucols))
69   (:documentation "A UMLS File"))
70
71 (defclass ucol ()
72   ((col :initarg :col)
73    (des :initarg des)
74    (ref :initarg ref)
75    (min :initarg :min)
76    (av :initarg :av)
77    (max :initarg :max)
78    (fil :initarg :fil)
79    (sqltype :initarg :sqltype)
80    (dty :initarg :dty :documentation "new in 2002: suggested SQL datatype")
81    (parsefunc :initarg :parsefunc)
82    (quotechar :initarg :quotechar)
83    (datatype :initarg :datatype)
84    (custom-value-func :initarg :custom-value-func))
85   (:documentation "A UMLS column"))
86
87 (defstruct (umls-file)
88   "Record for each UMLS File"
89   fil table des fmt cls rws bts fields colstructs)
90
91 (defstruct (umls-col)
92   "Record for each UMLS Column in each file"
93   col des ref min av max fil sqltype
94   dty ;; new in 2002 umls: suggested SQL datatype
95   parsefunc quotechar datatype custom-value-func)
96