r2947: *** empty log message ***
[umlisp.git] / obj.lisp
1 ;;; $Id: obj.lisp,v 1.1 2002/10/05 20:17:14 kevin Exp $
2 ;;;
3 ;;; UMLS object defintions and printing routines
4
5 (in-package :umlisp)
6 (declaim (optimize (speed 3) (safety 1)))
7
8 (defclass umlsclass ()
9   ()
10   (:metaclass ml-class)
11   (:documentation "Parent class of all UMLS objects"))
12
13
14 (defmethod print-object ((obj umlsclass) (s stream))
15   (print-unreadable-object (obj s :type t :identity t)
16     (let ((fmt (make-instance 'gu.ml::textformat)))
17       (apply #'format 
18              s (funcall (gu.ml::obj-data-fmtstr fmt) obj)
19              (multiple-value-list 
20               (funcall (funcall (gu.ml::obj-data-value-func fmt) obj) obj))))))
21
22
23 (defclass umlisp-user (umlsclass)
24   ((id :type fixnum :initarg :id :reader id)
25    (first-name :type string :initarg :first-name :reader first-name)
26    (last-name :type string :initarg :last-name :reader last-name)
27    (organization :type string :initarg :organization :reader organization)
28    (address1 :type string :initarg :address1 :reader address1)
29    (address2 :type string :initarg :address2 :reader address2)
30    (city :type string :initarg :city :reader city)
31    (state :type string :initarg :state :reader state)
32    (zip :type string :initarg :zip :reader zip)
33    (country :type string :initarg :country :reader country)
34    (licensed :type boolean :initarg :licensed :reader licensed)
35    (occupation :type string :initarg :occupation :reader occupation)
36    (email :type string :initarg :email :reader email)
37    (passwd :type string :initarg :passwd :reader passwd)  
38    (srl :type fixnum :initarg :srl :reader srl)
39    (timeout :type fixnum :initarg :timeout :reader timeout)
40    (maillist :type boolean :initarg :maillist :reader maillist)
41    (datetime-created :type string :initarg :datetime-created 
42                      :reader datetime-created)
43    (datetime-modified :type string :initarg :datetime-modified 
44                       :reader datetime-modified))
45    (:default-initargs 
46     :id nil :first-name nil :last-name nil :email nil :passwd nil :srl nil 
47     :organization nil :address1 nil :address2 nil :city nil :state nil 
48     :zip nil :country nil :licensed nil :occupation nil :maillist nil 
49     :timeout nil :datetime-created nil :datetime-modified nil)
50   (:metaclass ml-class)
51   (:title "UMLisp User")
52   (:fields 
53    (id :fixnum) (first-name :string) (last-name :string) (email :string) 
54    (occupation :string) (organization :string) (address1 :string) 
55    (address2 :string) (city :string) (state :string) (zip :string) 
56    (country :string) (licensed :boolean) (maillist :boolean) (srl :fixnum)
57    (timeout :fixnum) (datetime-created :string) (datetime-modified :string))
58   (:documentation "Class for UMLisp user database"))
59
60 (defclass ustats (umlsclass)
61   ((name :type string :initarg :name :reader name)
62    (hits :type integer :initarg :hits :reader hits)
63    (srl :type fixnum :initarg :srl :reader srl))
64   (:metaclass ml-class)
65   (:default-initargs :name nil :hits nil :srl nil)
66   (:title "UMLS Statistic")
67   (:fields (name :string) (hits :commainteger) (srl :fixnum))
68   (:documentation "Custom Table: UMLS Database statistics."))
69   
70 (defclass usrl (umlsclass)
71   ((sab :type string :initarg :sab :reader sab)
72    (srl :type integer :initarg :srl :reader srl))
73   (:metaclass ml-class)
74   (:default-initargs :sab nil :srl nil)
75   (:title "Source Restriction Level")
76   (:fields (sab :string) (srl :fixnum))
77   (:documentation "Custom Table: Source Restriction Level"))
78   
79 (defclass bsab (umlsclass)
80   ((sab :type string :initarg :sab :reader sab)
81    (name :type string :initarg :name :reader name)
82    (hits :type fixnum :initarg :hits :reader hits))
83   (:metaclass ml-class)
84   (:default-initargs :sab nil :name nil :hits nil)
85   (:title "Source of Abbreviation")
86   (:fields (sab :string) (name :string) (hits :commainteger))
87   (:ref-fields (sab find-ustr-sab (("subobjects" "no"))))
88   (:documentation "Bonus SAB file"))
89   
90 (defclass btty (umlsclass)
91   ((tty :type string :initarg :tty :reader tty)
92    (name :type string :initarg :name :reader name))
93   (:metaclass ml-class)
94   (:default-initargs :tty nil :name nil)
95   (:title "Bonus TTY")
96   (:fields (tty :string) (name :fixnum))
97   (:documentation "Bonus TTY file"))
98   
99 (defclass brel (umlsclass)
100   ((sab :type string :initarg :sab :reader sab)
101    (sl :type string :initarg :sl :reader sl)
102    (rel :type string :initarg :rel :reader rel)
103    (rela :type string :initarg :rela :reader rela)
104    (hits :type fixnum :initarg :hits :reader hits))
105   (:metaclass ml-class)
106   (:default-initargs :sab nil :sl nil :rel nil :rela nil :hits nil)
107   (:title "Bonus REL")
108   (:fields 
109    (sab :string) (sl :string) (rel :string) (rela :string) (hits :commainteger))
110   (:documentation "Bonus REL file"))
111
112 (defclass batn (umlsclass)
113   ((sab :type string :initarg :sab :reader sab)
114    (atn :type string :initarg :atn :reader atn)
115    (hits :type fixnum :initarg :hits :reader hits))
116   (:metaclass ml-class)
117   (:default-initargs :sab nil :atn nil)
118   (:title "Bonus ATN")
119   (:fields (sab :string) (atn :string) (hits :commaninteger))
120   (:documentation "Bonus ATN file"))
121   
122 (defclass urank (umlsclass)
123   ((rank :type fixnum :initarg :rank :reader rank)
124    (sab :type string :initarg :sab :reader sab)
125    (tty :type string :initarg :tty :reader tty)
126    (supres :type string :initarg :supres :reader supres))
127   (:metaclass ml-class)
128   (:default-initargs :rank nil :sab nil :tty nil :supres nil)
129   (:title "Rank")
130   (:fields (rank :fixnum) (sab :string) (tty :string) (supres :string)))
131
132 (defclass udef (umlsclass)
133   ((def :type string :initarg :def :reader def)
134    (sab :type string :initarg :sab :reader sab))
135   (:metaclass ml-class)
136   (:default-initargs :def nil :sab nil)
137   (:title "Definition")
138   (:ref-fields (sab find-bsab-sab))
139   (:fields (sab :string) (def :cdata)))
140
141 (defclass usat (umlsclass)
142   ((sab :type string :initarg :sab :reader sab)
143    (code :type string :initarg :code :reader code)
144    (atn :type string :initarg :atn :reader atn)
145    (atv :type string :initarg :atv :reader atv))
146   (:metaclass ml-class)
147   (:default-initargs :sab nil :code nil :atn nil :atv nil)
148   (:title "Simple Attribute")
149   (:ref-fields (sab find-bsab-sab))
150   (:fields (sab :string) (code :string) (atn :string) (atv :cdata)))
151
152 (defclass uso (umlsclass)
153   ((sab :type string :initarg :sab :reader sab)
154    (code :type string :initarg :code :reader code)
155    (tty :type string :initarg :tty :reader tty)
156    (srl :type fixnum :initarg :srl :reader srl))
157   (:metaclass ml-class)
158   (:default-initargs :sab nil :code nil :tty nil :srl nil)
159   (:title "Source")
160   (:ref-fields (sab find-bsab-sab) (tty find-btty-tty))
161   (:fields (sab :string) (code :string) (tty :string) (srl :fixnum)))
162
163 (defclass ucxt (umlsclass)
164   ((sab :type string :initarg :sab :reader sab)
165    (code :type string :initarg :code :reader code)
166    (rnk :type fixnum :initarg :rnk :reader rnk)
167    (cxn :type fixnum :initarg :cxn :reader cxn)
168    (cxl :type string :initarg :cxl :reader cxl)
169    (cxs :type string :initarg :cxs :reader cxs)
170    (cui2 :type fixnum :initarg :cui2 :reader cui2)
171    (hcd :type string :initarg :hcd :reader hcd)
172    (rela :type string :initarg :rela :reader rela)
173    (xc :type string  :initarg :xc :reader xc))
174   (:metaclass ml-class)
175   (:default-initargs :sab nil :code nil :rnk nil :cxn nil :cxl nil :cxs nil
176                      :cui2 nil :hcd nil :rela nil :xc nil)
177   (:title "Context")
178   (:ref-fields (sab find-bsab-sab) (cui2 find-ucon-cui))
179   (:fields 
180    (sab :string) (code :string) (rnk :fixnum) (cxn :fixnum) (cxl :string)
181    (hcd :string) (rela :string) (xc :string) (cui2 :string fmt-cui) 
182    (cxs :cdata)))
183
184 (defclass ustr (umlsclass)
185   ((sui :type fixnum :initarg :sui :reader sui)
186    (cui :type fixnum :initarg :cui :reader cui)
187    (lui :type fixnum :initarg :lui :reader lui)
188    (cuisui :type integer :initarg :cuisui :reader cuisui )
189    (str :type string :initarg :str :reader str)
190    (lrl :type fixnum :initarg :lrl :reader lrl)
191    (stt :type string :initarg :stt :reader stt)
192    (s#sat :reader s#sat)
193    (s#so :reader s#so)
194    (s#cxt :reader s#cxt))
195   (:metaclass ml-class)
196   (:default-initargs 
197    :sui nil :cui nil :lui nil :cuisui nil :str nil :lrl nil :stt nil)
198   (:title "String")
199   (:subobjects-lists (s#sat usat) (s#so uso) (s#cxt ucxt))
200   (:fields (sui :string fmt-sui) (stt :string) (lrl :fixnum) (str :cdata))
201   (:ref-fields (sui find-ustr-sui)))
202
203 (defclass ulo (umlsclass)
204   ((isn :type string :initarg :isn :reader isn)
205    (fr :type fixnum :initarg :fr :reader fr)
206    (un :type string :initarg :un :reader un)
207    (sui :type fixnum :initarg :sui :reader sui)
208    (sna :type string :initarg :sna :reader sna)
209    (soui :type string :initarg :soui :reader soui))
210   (:metaclass ml-class)
211   (:default-initargs :isn nil :fr nil :un nil :sui nil :sna nil :soui nil)
212   (:title "Locator")
213   (:fields (isn :string) (fr :fixnum) (un :string) (sna :string)
214            (soui :string) (sui :string fmt-sui) (suistr :string)))
215
216 (defclass uterm (umlsclass)
217   ((lui :type fixnum :initarg :lui :reader lui)
218    (cui :type fixnum :initarg :cui :reader cui)
219    (lat :type string :initarg :lat :reader lat)
220    (ts :type string  :initarg :ts :reader ts)
221    (lrl :type fixnum :initarg :lrl :reader lrl)
222    (s#str :reader s#str)
223    (s#sat :reader s#sat))
224   (:metaclass ml-class)
225   (:default-initargs :lui nil :cui nil :lat nil :ts nil :lrl nil)
226   (:title "Term")
227   (:subobjects-lists (s#sat usat) (s#str ustr))
228   (:fields (lui :string fmt-lui) (lat :string) (ts :string) (lrl :fixnum))
229   (:ref-fields (lui find-uterm-lui)))
230
231 (defclass usty (umlsclass)
232   ((tui :type fixnum :initarg :tui :reader tui)
233    (sty :type string :initarg :sty :reader sty))
234   (:metaclass ml-class)
235   (:default-initargs :tui nil :sty nil)
236   (:title "Semantic Type")
237   (:ref-fields (tui find-ucon-tui (("subobjects" "no"))))
238   (:fields (tui :string fmt-tui) (sty :string)))
239
240 (defclass urel (umlsclass)
241   ((rel :type string :initarg :rel :reader rel)
242    (cui1 :type fixnum :initarg :cui1 :reader cui1)
243    (cui2 :type fixnum :initarg :cui2 :reader cui2)
244    (pfstr2 :type string :initarg :pfstr2 :reader pfstr2)
245    (rela :type string :initarg :rela :reader rela)
246    (sab :type string :initarg :sab :reader sab)
247    (sl :type string  :initarg :sl :reader sl)
248    (mg :type string  :initarg :mg :reader mg))
249   (:metaclass ml-class)
250   (:default-initargs 
251    :rel nil :cui1 nil :cui2 nil :pfstr2 nil :rela nil :sab nil :sl nil :mg nil)
252   (:title "Relationship")
253   (:ref-fields (rel find-brel-rel) (sab find-bsab-sab) (cui2 find-ucon-cui))
254   (:fields (rel :string) (rela :string) (sab :string) (sl :string) 
255            (mg :string) (cui2 :string fmt-cui) (pfstr2 :cdata)))
256         
257 (defclass ucoc (umlsclass)
258   ((cui1 :type fixnum :initarg :cui1 :reader cui1)
259    (cui2 :type fixnum :initarg :cui2 :reader cui2)
260    (pfstr2 :type string :initarg :pfstr2 :reader pfstr2)
261    (soc :type string :initarg :soc :reader soc)
262    (cot :type string :initarg :cot :reader cot)
263    (cof :type fixnum :initarg :cof :reader cof)
264    (coa :type string :initarg :coa :reader coa))
265   (:metaclass ml-class)
266   (:default-initargs 
267    :cui1 nil :cui2 nil :pfstr2 nil :soc nil :cot nil :cof nil :coa nil)
268   (:title "Co-occuring Concept")
269   (:ref-fields (cui2 find-ucon-cui))
270   (:fields (soc :string) (cot :string) (cof :fixnum) (coa :cdata)
271            (cui2 :string fmt-cui) (pfstr2 :cdata)))
272
273         
274 (defclass uatx (umlsclass)
275   ((sab :type string :initarg :sab :reader sab)
276    (rel :type string :initarg :rel :reader rel)
277    (atx :type string :initarg :atx :reader atx))
278   (:metaclass ml-class)
279   (:default-initargs :sab nil :rel nil :atx nil)
280   (:title "Associated Expression")
281   (:fields (sab :string) (rel :string) (atx :cdata)))
282
283 (defclass ucon (umlsclass)
284   ((cui :type fixnum :initarg :cui :reader cui )
285    (pfstr :initarg :pfstr :reader pfstr)
286    (lrl :initarg :lrl :reader lrl)
287    (s#term :reader s#term)
288    (s#def :reader s#def)
289    (s#lo :reader s#lo)
290    (s#rel :reader s#rel)
291    (s#coc :reader s#coc)
292    (s#sat :reader s#sat)
293    (s#atx :reader s#atx)
294    (s#sty :reader s#sty))
295   (:metaclass ml-class)
296   (:default-initargs :cui nil :pfstr nil :lrl nil)
297   (:title "Concept")
298   (:subobjects-lists 
299    (s#def udef) (s#sty usty) (s#lo ulo) (s#atx uatx) (s#sat usat) (s#rel urel) 
300    (s#coc ucoc) (s#term uterm))
301   (:fields (cui :string fmt-cui) (lrl :fixum) (pfstr :cdata))
302   (:ref-fields (cui find-ucon-cui)))
303
304 (defclass uxw (umlsclass)
305   ((wd :type string :initarg :wd :reader wd)
306    (cui :type fixnum :initform nil :initarg :cui :reader cui)
307    (lui :type fixnum :initform nil :initarg :lui :reader lui)
308    (sui :type fixnum :initform nil :initarg :sui :reader sui))
309   (:metaclass ml-class)
310   (:default-initargs :wd nil :cui nil :lui nil :sui nil)
311   (:title "XW Index")
312   (:fields (wd :string) (cui :string fmt-cui) (lui :string fmt-lui) 
313            (sui :string fmt-sui)))
314
315 (defclass uxnw (umlsclass)
316   ((lat :type string :initarg :lat :reader lat)
317    (nwd :type string :initarg :nwd :reader nwd)
318   (cuilist :type list :initarg :cuilist :reader uxnw-cuilist))
319   (:metaclass ml-class)
320   (:default-initargs :lat nil :nwd nil :cuilist nil)
321   (:title "XNW Index")
322   (:fields (lat :string) (nwd :string) (cuilist :string)))
323
324 (defclass uxns (umlsclass)
325   ((lat :type string :initarg :lat :reader lat)
326    (nstr :type string :initarg :nstr :reader nstr)
327    (cuilist :type list :initarg :cuilist :reader cuilist))
328   (:metaclass ml-class)
329   (:default-initargs :lat nil :nstr nil :cuilist nil)
330   (:title "XNS Index")
331   (:fields (lat :string) (nstr :string) (cuilist :string)))
332
333
334 ;;; LEX objects
335
336 (defclass lexterm (umlsclass)
337   ((eui :type fixnum :initarg :eui :reader eui)
338    (wrd :type string :initarg :wrd :reader wrd)
339    (s#abr :reader s#abr)
340    (s#agr :reader s#agr)
341    (s#cmp :reader s#cmp)
342    (s#mod :reader s#mod)
343    (s#nom :reader s#nom)
344    (s#prn :reader s#prn)
345    (s#prp :reader s#prp)
346    (s#spl :reader s#spl)
347    (s#trm :reader s#trm)
348    (s#typ :reader s#typ))
349   (:metaclass ml-class)
350   (:default-initargs :eui nil :wrd nil)
351   (:title "Lexical Term")
352   (:subobjects-lists 
353    (s#abr labr) (s#agr lagr) (s#cmp lcmp) (s#mod lmod) (s#nom unom) 
354    (s#prn lprn) (s#prp lprp) (s#spl lspl) (s#trm ltrm) (s#typ ltyp))
355   (:fields (eui :string fmt-eui) (wrd :string))
356   (:ref-fields (eui find-lexterm-eui)))
357
358
359 (defclass labr  (umlsclass)
360   ((eui :type integer :initarg :eui :reader eui)
361    (bas :type string :initarg :bas :reader bas)
362    (abr :type string :initarg :abr :reader abr)
363    (eui2 :type integer :initarg :eui2 :reader eui2)
364    (bas2 :type string :initarg :bas2 :reader bas2))
365   (:metaclass ml-class)
366   (:default-initargs :eui nil :bas nil :abr nil :eui2 nil :bas2 nil)
367   (:title "Abbreviations and Acronyms")
368   (:fields (eui :string fmt-eui) (bas :string) (abr :string) 
369            (eui2 :string fmt-eui) (bas2 :string )))
370
371 (defclass lagr  (umlsclass)
372   ((eui :type integer :initarg :eui :reader eui)
373    (str :type string :initarg :str :reader str)
374    (sca :type string :initarg :sca :reader sca)
375    (agr :type string :initarg :agr :reader agr)
376    (cit :type string :initarg :cit :reader cit)
377    (bas :type string :initarg :bas :reader bas))
378   (:metaclass ml-class)
379   (:default-initargs :eui nil :str nil :sca nil :agr nil :cit nil :bas nil)
380   (:title "Agreement and Inflection")
381   (:fields (eui :string fmt-eui) (str :string) (sca :string) (agr :string)
382            (cit :string) (bas :string)))
383
384 (defclass lcmp  (umlsclass)
385   ((eui :type integer :initarg :eui :reader eui)
386    (bas :type string :initarg :bas :reader bas)
387    (sca :type string :initarg :sca :reader sca)
388    (com :type string :initarg :com :reader com))
389   (:metaclass ml-class)
390   (:default-initargs :eui nil :bas nil :sca nil :com nil)
391   (:title "Complementation")
392   (:fields (eui :string fmt-eui) (bas :string) (sca :string) (com :string)))
393
394 (defclass lmod  (umlsclass)
395   ((eui :type integer :initarg :eui :reader eui)
396    (bas :type string :initarg :bas :reader bas)
397    (sca :type string :initarg :sca :reader sca)
398    (psnmod :type string :initarg :psnmod :reader psnmod)
399    (fea :type string :initarg :fea :reader fea))
400   (:metaclass ml-class)
401   (:default-initargs :eui nil :bas nil :sca nil :psnmod nil :fea nil)
402   (:title "Modifiers")
403   (:fields (eui :string fmt-eui) (bas :string) (sca :string) (psnmod :string) 
404            (fea :string)))
405
406 (defclass lnom  (umlsclass)
407   ((eui :type integer :initarg :eui :reader eui)
408    (bas :type string :initarg :bas :reader bas)
409    (sca :type string :initarg :sca :reader sca)
410    (eui2 :type integer :initarg :eui2 :reader eui2)
411    (bas2 :type string :initarg :bas2 :reader bas2)
412    (sca2 :type string :initarg :sca2 :reader sca2))
413   (:metaclass ml-class)
414   (:default-initargs :eui nil :bas nil :sca nil :eui2 nil :bas2 nil :sca2 nil)
415   (:title "Nominalizations")
416   (:fields (eui :string fmt-eui) (bas :string) (sca :string) 
417            (eui2 :string fmt-eui) (bas2 :string) (sca2 :string)))
418
419 (defclass lprn  (umlsclass)
420   ((eui :type integer :initarg :eui :reader eui)
421    (bas :type string :initarg :bas :reader bas)
422    (num :type string :initarg :num :reader num)
423    (gnd :type string :initarg :gnd :reader gnd)
424    (cas :type string :initarg :cas :reader cas)
425    (pos :type string :initarg :pos :reader pos)
426    (qnt :type string :initarg :qnt :reader qnt)
427    (fea :type string :initarg :fea :reader fea))
428   (:metaclass ml-class)
429   (:default-initargs :eui nil :bas nil :num nil :gnd nil :cas nil
430                      :pos nil :qnt nil :fea nil)
431   (:title "Pronouns")
432   (:fields (eui :string fmt-eui) (bas :string) (num :string) (gnd :string)
433            (cas :string) (pos :string) (qnt :string) (fea :string)))
434
435 (defclass lprp  (umlsclass)
436   ((eui :type integer :initarg :eui :reader eui)
437    (bas :type string :initarg :bas :reader bas)
438    (str :type string :initarg :str :reader str)
439    (sca :type string :initarg :sca :reader sca)
440    (fea :type string :initarg :fea :reader fea))
441   (:metaclass ml-class)
442   (:default-initargs :eui nil :bas nil :str nil :sca nil :fea nil)
443   (:title "Properties")
444   (:fields (eui :string fmt-eui) (bas :string) (str :string) (sca :string) 
445            (fea :string)))
446
447
448 (defclass lspl  (umlsclass)
449   ((eui :type integer :initarg :eui :reader eui)
450    (spv :type string :initarg :spv :reader spv)
451    (bas :type string :initarg :bas :reader bas))
452   (:metaclass ml-class)
453   (:default-initargs :eui nil :spv nil :bas nil)
454   (:title "Spelling Variants")
455   (:fields (eui :string fmt-eui) (spv :string) (bas :string)))
456
457
458
459 (defclass ltrm  (umlsclass)
460   ((eui :type integer :initarg :eui :reader eui)
461    (bas :type string :initarg :bas :reader bas)
462    (gen :type string :initarg :gen :reader gen))
463   (:metaclass ml-class)
464   (:default-initargs :eui nil :bas nil :gen nil)
465   (:title "Trade Marks")
466   (:fields (eui :string fmt-eui) (bas :string) (gen :string)))
467
468 (defclass ltyp  (umlsclass)
469   ((eui :type integer :initarg :eui :reader eui)
470    (bas :type string :initarg :bas :reader bas)
471    (sca :type string :initarg :sca :reader sca)
472    (typ :type string :initarg :typ :reader typ))
473   (:metaclass ml-class)
474   (:default-initargs :eui nil :bas nil :sca nil :typ nil)
475   (:title "Inflection Type")
476   (:fields (eui :string fmt-eui) (bas :string) (sca :string) (typ :string)))
477
478 (defclass lwd (umlsclass)
479   ((wrd :type string :initarg :wrd :reader wrd)
480    (euilist :type list :initarg :euilist :reader euilist))
481   (:metaclass ml-class)
482   (:default-initargs :wrd nil :euilist nil)
483   (:title "Lexical Word Index")
484   (:fields (wrd :string) (euilist :string)))
485
486 ;;; Semantic NET objects
487
488 (defclass sdef (umlsclass)
489   ((rt :type string :initarg :rt :reader rt)
490    (ui :type integer :initarg :ui :reader ui)
491    (styrl :type string :initarg :styrl :reader styrl)
492    (stnrtn :type string :initarg :stnrtn :reader stnrtn)
493    (def :type string :initarg :def :reader def)
494    (ex :type string :initarg :ex :reader ex)
495    (un :type string :initarg :un :reader un)
496    (rh :type string :initarg :rh :reader rh)
497    (abr :type string :initarg :abr :reader abr)
498    (rin :type string :initarg :rin :reader rin))
499   (:metaclass ml-class)
500   (:default-initargs 
501    :rt nil :ui nil :styrl nil :stnrtn nil :def nil :ex nil :un nil :rh nil 
502    :abr nil :rin nil)
503   (:title "Basic information about Semantic Types and Relations")
504   (:fields 
505    (rt :string) (ui :string fmt-tui) (styrl :string) (stnrtn :string-tui) 
506    (def :string) (ex :string) (un :string) (rh :string) (abr :string) 
507    (rin :string)))
508
509 (defclass sstr (umlsclass)
510   ((styrl :type string :initarg :styrl :reader styrl)
511    (rl :type string :initarg :rl :reader rl)
512    (styrl2 :type string :initarg :styrl2 :reader styrl2)
513    (ls :type string :initarg :ls :reader ls))
514   (:metaclass ml-class)
515   (:default-initargs :styrl nil :rl nil :styrl2 nil :ls nil)
516   (:title "Structure of the Network")
517   (:fields (styrl :string) (rl :string) (styrl2 :string) (ls :string)))
518
519 (defclass sstre1 (umlsclass)
520   ((ui :type integer :initarg :ui :reader ui)
521    (ui2 :type integer :initarg :ui2 :reader ui2)
522    (ui3 :type integer :initarg :ui3 :reader ui3))
523   (:metaclass ml-class)
524   (:default-initargs :ui nil :ui2 nil :ui3 nil)
525   (:title "Fully Inherited Set of Releatons (TUI's)")
526   (:fields (ui :string fmt-tui) (ui2 :string fmt-tui) (ui3 :string fmt-tui)))
527
528 (defclass sstre2 (umlsclass)
529   ((sty :type string :initarg :ui :reader sty)
530    (rl :type string :initarg :ui2 :reader rl)
531    (sty2 :type string :initarg :ui3 :reader sty2))
532   (:metaclass ml-class)
533   (:default-initargs :sty nil :rl nil :sty2 nil)
534   (:title "Fully Inherited Set of Releatons (strings)")
535   (:fields (sty :string) (rl :string) (sty2 :string)))
536
537 ;;; Formatting routines
538
539 (defmethod fmt-cui ((c ucon))
540   (format nil "C~7,'0d" (cui c)))
541
542 (defmethod fmt-cui ((c fixnum))
543   (format nil "C~7,'0d" c))
544
545 (defmethod fmt-cui ((c string))
546   (if (eql (aref c 0) #\C)
547       c
548     (format nil "C~7,'0d" (parse-integer c))))
549
550 (defmethod fmt-cui ((c null))
551   (format nil "nil"))
552
553 (defmethod fmt-lui ((l uterm))
554   (format nil "L~7,'0d" (lui l)))
555
556 (defmethod fmt-lui ((l fixnum))
557   (format nil "L~7,'0d" l))
558
559 (defmethod fmt-lui ((l string))
560   (if (eql (aref l 0) #\L)
561       l
562   (format nil "L~7,'0d" (parse-integer l))))
563
564 (defmethod fmt-sui ((s ustr))
565   (format nil "S~7,'0d" (sui s)))
566
567 (defmethod fmt-sui ((s fixnum))
568   (format nil "S~7,'0d" s))
569
570 (defmethod fmt-sui ((s string))
571   (if (eql (aref s 0) #\S)
572       s
573   (format nil "S~7,'0d" (parse-integer s))))
574
575 (defmethod fmt-tui ((s fixnum))
576   (format nil "T~3,'0d" s))
577
578 (defmethod fmt-tui ((s string))
579   (if (eql (aref s 0) #\T)
580       s
581   (format nil "T~3,'0d" (parse-integer s))))
582
583 (defmethod fmt-eui ((e fixnum))
584   (format nil "E~7,'0d" e))
585
586 (defmethod fmt-eui ((e string))
587   (if (eql (aref e 0) #\E)
588       e
589     (format nil "E~7,'0d" (parse-integer e))))
590
591 (defmethod fmt-eui ((e null))
592   (format nil "nil"))
593
594 ;;; Generic display functions
595
596 (eval-when (:compile-toplevel :load-toplevel :execute)
597 (defun english-term-p (obj)
598   (and (eq (class-name (class-of obj)) 'uterm)
599        (string-equal (lat obj) "ENG"))))
600
601 (defun display-umls-obj 
602   (obj &key (os *standard-output*) (format :text) (label nil) 
603        (file-wrapper t) (english-only nil) (subobjects nil)
604        (refvars nil))
605   (display-ml-class 
606    obj :os os :format format :label label :subobjects subobjects
607    :file-wrapper file-wrapper
608    :english-only-function (if english-only #'english-term-p nil)
609    :refvars refvars))
610                      
611 (defmacro defludisp-ml-class (newfuncname lookup-func)
612   "Defines functions for looking up and displaying objects"
613   `(defun ,newfuncname 
614      (keyval &key (os *standard-output*) (format :text) (label nil)
615              (file-wrapper t) (english-only nil) (subobjects nil))
616      (let ((obj (funcall ,lookup-func keyval)))
617        (display-umls-obj obj :os os :format format :label label 
618                          :file-wrapper file-wrapper :english-only english-only
619                          :subobjects subobjects))))
620
621 (defludisp-ml-class disp-con #'find-ucon-cui)
622 (defludisp-ml-class disp-term #'find-uterm-lui)
623 (defludisp-ml-class disp-str #'find-ustr-sui)
624