r11098: 2006 updates
[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 ;;;; Created:  Apr 2000
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of UMLisp, is
13 ;;;;    Copyright (c) 2000-2006 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 ;;; Paths for files
22
23 (defparameter *umls-path*
24   (make-pathname :directory '(:absolute "home" "kevin" "2006AC"))
25   "Path for base of UMLS data files")
26
27 (defvar *meta-path* 
28     (merge-pathnames 
29      (make-pathname :directory '(:relative "META"))
30      *umls-path*))
31
32 (defvar *lex-path* 
33     (merge-pathnames 
34      (make-pathname :directory '(:relative "LEX"))
35      *umls-path*))
36
37 (defvar *net-path* 
38     (merge-pathnames 
39      (make-pathname :directory '(:relative "NET"))
40      *umls-path*))
41
42 (defun umls-path! (p)
43   (setq *umls-path* p))
44
45
46 ;;; Structures for parsing UMLS text files
47  
48 (defparameter *umls-files* nil 
49   "List of umls file structures. Used when parsing text files.")
50 (defparameter *umls-cols* nil 
51   "List of meta column structures. Used when parsing text files.")
52
53
54 ;; Preliminary objects to replace structures
55
56 (defclass ufile ()
57   ((subdir :initarg :subdir :accessor subdir)
58    (dir :initarg :dir :accessor dir)
59    (fil :initarg :fil :accessor fil)
60    (table :initarg :table :accessor table)
61    (des :initarg :des :accessor des)
62    (fmt :initarg :fmt :accessor fmt)
63    (cls :initarg :cls :accessor cls)
64    (rws :initarg :rws :accessor rws)
65    (bts :initarg :bts :accessor bts)
66    (fields :initarg :fields :accessor fields)
67    (ucols :initarg :ucols :accessor ucols))
68   (:default-initargs :fil nil :table nil :des nil :fmt nil :cls nil :rws nil :bts nil
69                      :fields nil :ucols nil :subdir nil :dir nil)
70   (:documentation "UMLS File"))
71
72 (defclass ucol ()
73   ((col :initarg :col :accessor col)
74    (des :initarg :des :accessor des)
75    (ref :initarg :ref :accessor ref)
76    (min :initarg :min :accessor cmin)
77    (av :initarg :av :accessor av)
78    (max :initarg :max :accessor cmax)
79    (fil :initarg :fil :accessor fil)
80    (sqltype :initarg :sqltype :accessor sqltype)
81    (dty :initarg :dty :accessor dty :documentation "new in 2002: suggested SQL datatype")
82    (parse-fun :initarg :parse-fun :accessor parse-fun)
83    (quote-str :initarg :quote-str :accessor quote-str)
84    (datatype :initarg :datatype :accessor datatype)
85    (custom-value-fun :initarg :custom-value-fun :accessor custom-value-fun))
86   (:default-initargs :col nil :des nil :ref nil :min nil :av nil :max nil :fil nil
87                      :sqltype nil :dty nil :parse-fun nil :datatype nil
88                      :custom-value-fun nil)
89   (:documentation "UMLS column"))
90
91
92 (defmethod print-object ((obj ufile) (s stream))
93   (print-unreadable-object (obj s :type t)
94     (format s "~A" (fil obj))))
95
96 (defmethod print-object ((obj ucol) (s stream))
97   (print-unreadable-object (obj s :type t)
98     (format s "~A" (col obj))))
99
100
101