(in-package "COMMON-LISP-USER")

;;; File: loom-kpml-package.lisp

;;; ----------------------------------------------------------------------
;;; Package definitions for Using LOOM as the KR...
;;; N.B. the *shadow-import-from-loom* list contains the string "PATTERN"
;;;      which is also now wanted by KPML for templates. We therefore
;;;      now refuse to shadow import this from Loom.
;;;
;;; penman-kb has been the traditional package used for Penman releases
;;; of the upper model and domains for a long time. 
;;;
;;; Knut's Penman-kb package definition modification included (Feb98)
;;; 2.0.2 reference to package USER removed...

(eval-when (:execute :load-toplevel :compile-toplevel)
	(defparameter *penman-kb-shadow-list* 
	    '("DOMAIN" "FUTURE" "PAST" "RANGE" "SET"))
	(defparameter *kpml-refused-loom-shadows*
	    '("PATTERN")))

(if (boundp 'Loom::*shadow-import-from-loom*)
    (shadowing-import 
     (mapcar #'(lambda (string) (intern string 'Loom))
	     (remove-if #'(lambda (string)
			    (or (member 
				 string 
				 *shadow-import-from-clisp*
				 :test #'string=)
				(member string *kpml-refused-loom-shadows*
					:test #'string=)))
			Loom::*shadow-import-from-loom*))
     "KPML"))

(shadowing-import 'COMMON-LISP::SET "KPML")

;;; Set up the penman-kb package...
(eval-when (:execute :load-toplevel :compile-toplevel)
  (unless (find-package "PENMAN-KB")
    (cl:defpackage "PENMAN-KB"         ;; 1.1 previously did not use
      (:use "COMMON-LISP" "LOOM")      ;;     common-lisp here... 
      (:shadowing-import-from "COMMON-LISP" "SET")
      (:shadowing-import-from "LOOM" "DEFMETHOD" "PI" "FIND-METHOD"))))

;;; setup the upper model knowledge base... (conditionalization fixed)
#+Loom2.0(loom::use-loom "PENMAN-KB" :knowledge-base-name "PENMAN-KB")

(shadow '(penman-kb) (find-package "LOOM"))
(shadowing-import '(penman-kb) (find-package "KPML"))

(if (boundp 'Loom::*shadow-import-from-loom*)
	  (shadowing-import 
	   (mapcar #'(lambda (string) (intern string 'Loom))
		   (remove-if #'(lambda (x)
				  (member x 
					  cl-user::*penman-kb-shadow-list*
					  :test #' string=))
			      Loom::*shadow-import-from-loom*))
	   "PENMAN-KB"))

(shadow  (mapcar #'intern 
		 cl-user::*penman-kb-shadow-list*
		 ) 
	 (find-package "PENMAN-KB"))

;;; ----------------------------------------------------------------------
;;; More stuff...

(shadowing-import '(identity name-of space spl-consumed time um-thing) 
		  (find-package 'penman-kb))



