-(defclass ucon_freq (umlsclass)
- ((ucon :type ucon :initarg :ucon :reader ucon)
- (freq :type fixnum :initarg :freq :accessor freq))
- (:metaclass ml-class)
- (:default-initargs :cui nil :pfstr nil :freq nil)
- (:title "Concept and Count")
- (:fields (cui :string fmt-cui) (freq :fixnum) (pfstr :cdata))
- (:ref-fields (cui find-ucon-cui))
- (:documentation "Composite object of ucon/freq"))
-
-(defun ucon_freq-cui (c)
- (cui (ucon c)))
-
-(defun ucon_freq-pfstr (c)
- (pfstr (ucon c)))
-
-(defclass ustr_freq (umlsclass)
- ((ustr :type ustr :initarg :ustr :reader ustr)
- (freq :type fixnum :initarg :freq :accessor freq))
- (:metaclass ml-class)
- (:default-initargs :cui nil :pfstr nil :freq nil)
- (:title "String and Count")
- (:fields (sui :string fmt-sui) (freq :fixnum) (stt :string) (lrl :fixnum) (str :cdata))
- (:ref-fields (sui find-ustr-sui))
- (:documentation "Composite object of ustr/freq"))
-
-(defun ustr_freq-sui (s)
- (sui (ustr s)))
-
-(defun ustr_freq-str (s)
- (str (ustr s)))
-
-(defun ustr_freq-lrl (s)
- (lrl (ustr s)))
-
-(defun ustr_freq-stt (s)
- (stt (ustr s)))
-
-(defclass usty_freq (umlsclass)
- ((usty :type usty :initarg :usty :reader usty)
- (freq :type fixnum :initarg :freq :accessor freq))
- (:metaclass ml-class)
- (:default-initargs :usty nil :freq nil)
- (:title "Semantic Type and Count")
- (:ref-fields (tui find-ucon-tui "subobjects=no"))
- (:fields (tui :string fmt-tui) (freq :fixnum) (sty :string))
- (:documentation "Composite object of usty/freq"))
-
-(defun usty_freq-tui (s)
- (tui (usty s)))
-
-(defun usty_freq-sty (s)
- (sty (usty s)))
-
-(defclass usrl_freq (umlsclass)
- ((usrl :type usrl :initarg :usrl :reader usrl)
- (freq :type fixnum :initarg :freq :accessor freq))
- (:metaclass ml-class)
- (:default-initargs :usrl nil :freq nil)
- (:title "Source and Count")
- (:ref-fields (sab find-ustr-sab))
- (:fields (sab :string) (freq :commainteger) (srl :fixnum))
- (:documentation "Composite object of usrl/freq"))
-
-(defun usrl_freq-sab (s)
- (sab (usrl s)))
-
-(defun usrl_freq-srl (s)
- (srl (usrl s)))
-
+(defclass freq (hyperobject)
+ ((freq :value-type integer :initarg :freq :accessor freq
+ :print-formatter fmt-comma-integer))
+ (:metaclass hyperobject-class)
+ (:default-initargs :freq 0)
+ (:user-name "Frequency class" "Frequency classes")
+ (:default-print-slots freq)
+ (:description "Base class containing frequency slot, used for multi-inherited objects"))
+
+(defclass ucon_freq (ucon freq)
+ ()
+ (:metaclass hyperobject-class)
+ (:user-name "Concept and Count" "Concepts and Counts")
+ (:default-print-slots cui freq pfstr)
+ (:description "Composite object of ucon/freq"))
+
+(defclass ustr_freq (ustr freq)
+ ()
+ (:metaclass hyperobject-class)
+ (:user-name "String and Count" "Strings and Counts")
+ (:default-print-slots sui freq stt lrl str)
+ (:description "Composite object of ustr/freq"))
+
+(defclass usty_freq (usty freq)
+ ()
+ (:metaclass hyperobject-class)
+ (:user-name "Semantic Type and Count" "Semantic Types and Counts")
+ (:default-print-slots tui freq sty)
+ (:description "Composite object of usty/freq"))
+
+(defun find-usty_freq-all ()
+ (let ((usty_freqs '()))
+ (dolist (tuple (mutex-sql-query "select distinct TUI from MRSTY"))
+ (let* ((tui (car tuple))
+ (freq (ensure-integer
+ (caar (mutex-sql-query
+ (format nil "select count(*) from MRSTY where TUI=~a" tui)))))
+ (usty (find-usty-tui tui)))
+ (push (make-instance 'usty_freq :sty (sty usty)
+ :tui (tui usty) :freq freq) usty_freqs)))
+ (sort usty_freqs #'> :key #'freq)))
+
+
+(defclass usrl_freq (usrl freq)
+ ()
+ (:metaclass hyperobject-class)
+ (:user-name "Source and Count" "Sources and Counts")
+ (:default-print-slots sab freq srl)
+ (:description "Composite object of usrl/freq"))