r11704: can not use keywords in :subobject functions
[umlisp.git] / class-support.lisp
index 2b94e91a93c2451f861100aa3446168d3686f837..e4f49cbcedeb36749d18008bfc56036fbd937dc7 100644 (file)
 (defgeneric fmt-rui (rui))
 (when *has-fixnum-class*
   (defmethod fmt-rui ((rui fixnum))
-    (prefixed-fixnum-string aui #\A 8)))
+    (prefixed-fixnum-string rui #\A 8)))
 
 (defmethod fmt-rui ((rui integer))
   (prefixed-integer-string rui #\A 8))
   "Returns T if UCON has a semantic type of TUI."
   (some #'(lambda (usty) (= tui (tui usty))) (s#sty ucon)))
 
-(defgeneric suistr (lo))
-(defmethod suistr ((lo ulo))
-  "Return the string for a ulo object"
-  (find-string-sui (sui lo)))
-
 (defgeneric pf-ustr (obj))
 (defmethod pf-ustr ((ucon ucon))
   "Return the preferred ustr for a ucon"
         ((char-equal #\O c)
          "Other"))))
 
-
-(defun ucon-parents (con &optional sab)
-  (ucon-ancestors con sab t))
-
-(defun ucon-ancestors (ucon &optional sab single-level)
-  "Returns a list of ancestor lists for a concept"
-  (let* ((parent-rels (filter-urels-by-rel (s#rel ucon) "par"))
-        (anc nil))
-    (when sab
-      (setq parent-rels (delete-if-not
-                        (lambda (rel) (string-equal sab (sab rel)))
-                        parent-rels)))
-    (dolist (rel parent-rels (nreverse anc))
-      (let ((parent (find-ucon-cui (cui2 rel))))
-       (push
-        (if single-level
-            (list parent)
-          (list* parent (car (ucon-ancestors parent (sab rel) nil))))
-        anc)))))
-
-(defgeneric cxt-ancestors (obj))
-(defmethod cxt-ancestors ((con ucon))
-  (loop for term in (s#term con)
-      append (cxt-ancestors term)))
-
-
-(defmethod cxt-ancestors ((term uterm))
-  (loop for str in (s#str term)
-      append (cxt-ancestors str)))
-
-(defmethod cxt-ancestors ((str ustr))
-  "Return the ancestory contexts of a ustr"
-  (let* ((anc (remove-if-not
-              (lambda (cxt) (string-equal "ANC" (cxl cxt)))
-              (s#cxt str)))
-        (num-contexts (if anc
-                          (apply #'max (mapcar (lambda (cxt) (cxn cxt)) anc))
-                        0))
-        (anc-lists '()))
-    (dotimes (i num-contexts (nreverse anc-lists))
-      (let* ((anc-this-cxn (remove-if-not
-                           (lambda (cxt) (= (1+ i) (cxn cxt))) anc)))
-       (push
-        (sort anc-this-cxn (lambda (a b) (< (rank a) (rank b))))
-        anc-lists)))))
-
 (defun uso-unique-codes (usos)
   (let ((sab-codes (make-hash-table :test 'equal)))
     (dolist (uso usos)
     (loop for key being the hash-key in sab-codes
         collect (list key (gethash key sab-codes)))))
 
-                                          
+(defun ucon-has-sab (ucon sab)
+  (and (find-if (lambda (uso) (string-equal sab (sab uso))) (s#so ucon)) t))
+
+
 #+scl
-(dolist (c '(urank udef usat uso ucxt ustr ulo uterm usty urel ucoc uatx ucon uxw uxnw uxns lexterm labr lagr lcmp lmod lnom lprn lprp lspl ltrm ltyp lwd sdef sstr sstre1 sstre2 usrl))
+(dolist (c '(urank udef usat uso ucxt ustr uterm usty urel ucoc uatx uconso uxw uxnw uxns lexterm labr lagr lcmp lmod lnom lprn lprp lspl ltrm ltyp lwd sdef sstr sstre1 sstre2 usrl))
     (let ((cl (find-class c)))
       (clos:finalize-inheritance cl)))