Update domain name to kpe.io
[umlisp-orf.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-2004 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-orf)
20
21 ;;; Paths for files
22
23 (defvar *umls-path*
24   (make-pathname :directory '(:absolute "data" "umls" "2003AC"))
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   ((fil :initarg :fil :accessor fil)
58    (table :initarg :table :accessor table)
59    (des :initarg :des :accessor des)
60    (fmt :initarg :fmt :accessor fmt)
61    (cls :initarg :cls :accessor cls)
62    (rws :initarg :rws :accessor rws)
63    (bts :initarg :bts :accessor bts)
64    (fields :initarg :fields :accessor fields)
65    (ucols :initarg :ucols :accessor ucols))
66   (:default-initargs :fil nil :table nil :des nil :fmt nil :cls nil :rws nil :bts nil
67                      :fields nil :ucols nil)
68   (:documentation "UMLS File"))
69
70 (defclass ucol ()
71   ((col :initarg :col :accessor col)
72    (des :initarg :des :accessor des)
73    (ref :initarg :ref :accessor ref)
74    (min :initarg :min :accessor cmin)
75    (av :initarg :av :accessor av)
76    (max :initarg :max :accessor cmax)
77    (fil :initarg :fil :accessor fil)
78    (sqltype :initarg :sqltype :accessor sqltype)
79    (dty :initarg :dty :accessor dty :documentation "new in 2002: suggested SQL datatype")
80    (parse-fun :initarg :parse-fun :accessor parse-fun)
81    (quote-str :initarg :quote-str :accessor quote-str)
82    (datatype :initarg :datatype :accessor datatype)
83    (custom-value-fun :initarg :custom-value-fun :accessor custom-value-fun))
84   (:default-initargs :col nil :des nil :ref nil :min nil :av nil :max nil :fil nil
85                      :sqltype nil :dty nil :parse-fun nil :datatype nil
86                      :custom-value-fun nil)
87   (:documentation "UMLS column"))
88
89
90 (defmethod print-object ((obj ufile) (s stream))
91   (print-unreadable-object (obj s :type t)
92     (format s "~A" (fil obj))))
93
94 (defmethod print-object ((obj ucol) (s stream))
95   (print-unreadable-object (obj s :type t)
96     (format s "~A" (col obj))))
97
98
99