;;  -*- Mode: emacs-lisp; Syntax: Common-Lisp; Package: UMDL-LOOM -*-
;;  ontology.lisp             UMDL Ontology -- for the Beethoven project
;;
;;  Creates the ontology for describing digital library content.
;;  Concepts are defined here: see kb.lisp for instance assertions.
;;
;;  See http://www.umich.edu/~peterw/Ontology/ontology.html
;;  for text descriptions.
;;
;;  The development of some of the more detailed areas of the ontology
;;  are as required to support ontology-based metadata describing a
;;  collection of almost 500 records having to do with Beethoven,
;;  converted from US MARC data.
;;
;;  Concepts starting with an underscore '_' are used for converting data
;;  from US MARC.
;;
;;  WARNING: Loom does not properly enforce SAME-AS constraints for multi-
;;  valued roles unless the role fillers are asserted before the type
;;  of the instance is asserted. This may require extra
;;  programming to enforce these constraints! (see email from Tom Russ).
;;
;;  11/97 Peter Weinstein for the UMDL
;;
;;  Modifications:


(in-package "UMDL-LOOM")
(loom:use-loom "UMDL-LOOM" :dont-create-knowledge-base-p t)
(use-package "COMMON-LISP-USER")

;; Create the concept ontology.
;; Loom knowledge bases are shadowed by 'contexts' in vs. 2.1
(defkb "DL-KB" nil :package-name "UMDL-LOOM" :pathname "dl-kb.loom") 
;; Loom requires  monotonicity to do equality constraint inference
(defcontext dl-theory :theory () 
  :creation-policy :classified-instance :monotonic-p T)

;; Hold the Beethoven knowledge base (instances) in a separate context
(defkb "BEETHOVEN-KB" ("DL-KB") :package-name "UMDL-LOOM" 
  :pathname "beethoven-kb.loom") 
(defcontext beethoven-theory :theory (dl-theory) 
  :creation-policy :classified-instance :monotonic-p T)


;; ********************** Utilities ************************

;; Relations.
(defun define-full-relation (name domain parent range inverse 
				  &key (closed nil))
  "Creates a Loom relation."
  (define-relation :name name 
    :is-primitive parent
    :domain domain
    :range range
    :characteristic (if closed ':closed-world ':open-world))
  (define-relation :name inverse
    :is `(:inverse ,name)))

;; A time-saver for writing relations: input is the list of 3-part
;; relation names, output is calls to the define-full-relation function.
(defun expand-relations (rels)
  (if rels
      (let ((inv (get-name (first 
			    (eval 
			     `(retrieve ?x (inverse ,(second rels) ?x)))))))
	(format t 
	  "~&(define-full-relation '~s.~s.~s ~&    '~s '~s '~s '~s.~s.~s)"
		(first rels) (second rels) (third rels)
		(first rels)
		(second rels)
		(third rels)
		(third rels) inv (first rels))
	(expand-relations (nthcdr 3 rels)))))
      
;; list-kb-nicely.  Lists objects alphabetically.
(defun list-kb-nicely ()
  (format t "~&~s currently contains:~&" (cc))
  (mapc #'(lambda (obj)
	    (format t "~s: ~s~&" 
		    (if (concept-p obj)
			'concept
		      (if (relation-p obj)
			  'relation
			(if (instance-p obj)
			    'instance
			  'Other)))
		    (get-name obj)))
	(sort (list-kb) #'string< :key #'get-name))
  t)

;; ********************** DL-KB ************************

(change-kb "DL-KB")  

;; * relations for attaching values *
(defrelation value :range string)
(defrelation val :range number)

;; * top-level relations *
(define-relation :name 'has)
(define-relation :name 'of :is '(:inverse has))
(define-relation :name 'by :is-primitive 'has)
(define-relation :name 'for :is '(:inverse by))
(define-relation :name 'from :is-primitive 'has)
(define-relation :name 'to :is '(:inverse from))
(define-relation :name 'extends)
(define-relation :name 'base-of :is '(:inverse extends))

;; *** relations ***

'(agent has uniform-name
agent has name
creator of work
conception has uniform-title
conception has creator
conception has topic
conception has audience
conception has conceptual-level
expression has title
expression has creator
expression has mode
expression extends conception)

(define-full-relation 'AGENT.HAS.UNIFORM-NAME 
    'AGENT 'HAS 'UNIFORM-NAME 'UNIFORM-NAME.OF.AGENT)
(define-full-relation 'AGENT.HAS.NAME 
    'AGENT 'HAS 'NAME 'NAME.OF.AGENT)
(define-full-relation 'CREATOR.OF.WORK 
    'CREATOR 'OF 'WORK 'WORK.HAS.CREATOR)
;; Tange restriction is relaxed to allow manifestation titles to be
;; used as uniform-titles if the latter is missing.
(define-full-relation 'CONCEPTION.HAS.UNIFORM-TITLE 
    'CONCEPTION 'HAS 'TITLE 'UNIFORM-TITLE.OF.CONCEPTION)
(define-full-relation 'CONCEPTION.HAS.CREATOR 
    'CONCEPTION 'HAS 'CREATOR 'CREATOR.OF.CONCEPTION)
(define-full-relation 'CONCEPTION.HAS.TOPIC 
    'CONCEPTION 'HAS 'TOPIC 'TOPIC.OF.CONCEPTION)
(define-full-relation 'CONCEPTION.HAS.AUDIENCE 
    'CONCEPTION 'HAS 'AUDIENCE 'AUDIENCE.OF.CONCEPTION)
(define-full-relation 'CONCEPTION.HAS.CONCEPTUAL-LEVEL 
    'CONCEPTION 'HAS 'CONCEPTUAL-LEVEL 'CONCEPTUAL-LEVEL.OF.CONCEPTION)
(define-full-relation 'EXPRESSION.HAS.TITLE 
    'EXPRESSION 'HAS 'TITLE 'TITLE.OF.EXPRESSION)
(define-full-relation 'EXPRESSION.HAS.SUBTITLE 
    'EXPRESSION 'HAS 'SUBTITLE 'SUBTITLE.OF.EXPRESSION)
(define-full-relation 'EXPRESSION.HAS.CREATOR 
    'EXPRESSION 'HAS 'CREATOR 'CREATOR.OF.EXPRESSION)
(define-full-relation 'EXPRESSION.HAS.MODE 
    'EXPRESSION 'HAS 'MODE 'MODE.OF.EXPRESSION)
(define-full-relation 'EXPRESSION.EXTENDS.CONCEPTION 
    'EXPRESSION 'EXTENDS 'CONCEPTION 'CONCEPTION.BASE-OF.EXPRESSION)

'(manifestation has publishing-format
manifestation has title
manifestation has creator
manifestation has edition
manifestation has publication-place
manifestation has publication-date
manifestation extends expression)

(define-full-relation 'MANIFESTATION.HAS.PUBLISHING-FORMAT 
    'MANIFESTATION 'HAS 'PUBLISHING-FORMAT 
    'PUBLISHING-FORMAT.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.TITLE 
    'MANIFESTATION 'HAS 'TITLE 'TITLE.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.SUBTITLE 
    'MANIFESTATION 'HAS 'SUBTITLE 'SUBTITLE.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.CREATOR 
    'MANIFESTATION 'HAS 'CREATOR 'CREATOR.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.EDITION 
    'MANIFESTATION 'HAS 'EDITION 'EDITION.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.PUBLICATION-PLACE 
    'MANIFESTATION 'HAS 'PUBLICATION-PLACE 
    'PUBLICATION-PLACE.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.PUBLICATION-DATE
    'MANIFESTATION 'HAS 'PUBLICATION-DATE
    'PUBLICATION-DATE.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.EXTENDS.EXPRESSION 
    'MANIFESTATION 'EXTENDS 'EXPRESSION 'EXPRESSION.BASE-OF.MANIFESTATION)

'(manifestation has volume
manifestation has price
manifestation has marc-control-num
manifestation has library-of-congress-num
manifestation has publishers-item-num
event has existence-dates
event has place
live of event)

(define-full-relation 'MANIFESTATION.HAS.VOLUME 
    'MANIFESTATION 'HAS 'VOLUME 'VOLUME.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.PRICE 
    'MANIFESTATION 'HAS 'PRICE 'PRICE.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.MARC-CONTROL-NUM 
    'MANIFESTATION 'HAS 'MARC-CONTROL-NUM 'MARC-CONTROL-NUM.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.LIBRARY-OF-CONGRESS-NUM 
    'MANIFESTATION 'HAS 'LIBRARY-OF-CONGRESS-NUM 
    'LIBRARY-OF-CONGRESS-NUM.OF.MANIFESTATION)
(define-full-relation 'MANIFESTATION.HAS.PUBLISHERS-ITEM-NUM 
    'MANIFESTATION 'HAS 'PUBLISHERS-ITEM-NUM 
    'PUBLISHERS-ITEM-NUM.OF.MANIFESTATION)
(define-full-relation 'EVENT.HAS.EXISTENCE-DATES 
    'EVENT 'HAS 'EXISTENCE-DATES 'EXISTENCE-DATES.OF.EVENT)
(define-full-relation 'EVENT.HAS.PLACE 
    'EVENT 'HAS 'PLACE 'PLACE.OF.EVENT)
(define-full-relation 'LIVE.OF.EVENT 
    'LIVE 'OF 'EVENT 'EVENT.HAS.LIVE)

'(materialization has item-number
materialization has production-format
materialization has production-city
materialization has producer
materialization has production-date
materialization extends manifestation
fiction has fiction-structure
fiction has fiction-approach
non-fiction has non-fiction-structure
non-fiction has non-fiction-approach
non-fiction-structure has size
 music has musical-form
 music has musical-approach
 music has musical-instrument
 music has musical-key)

(define-full-relation 'MATERIALIZATION.HAS.ITEM-NUMBER 
    'MATERIALIZATION 'HAS 'ITEM-NUMBER 'ITEM-NUMBER.OF.MATERIALIZATION)
(define-full-relation 'MATERIALIZATION.HAS.PRODUCTION-FORMAT 
    'MATERIALIZATION 'HAS 'PRODUCTION-FORMAT 
    'PRODUCTION-FORMAT.OF.MATERIALIZATION)
(define-full-relation 'MATERIALIZATION.HAS.PRODUCTION-PLACE 
    'MATERIALIZATION 'HAS 'PRODUCTION-PLACE 
    'PRODUCTION-PLACE.OF.MATERIALIZATION)
(define-full-relation 'MATERIALIZATION.HAS.PRODUCER 
    'MATERIALIZATION 'HAS 'PRODUCER 'PRODUCER.OF.MATERIALIZATION)
(define-full-relation 'MATERIALIZATION.HAS.PRODUCTION-DATE 
    'MATERIALIZATION 'HAS 'PRODUCTION-DATE 
    'PRODUCTION-DATE.OF.MATERIALIZATION)
(define-full-relation 'MATERIALIZATION.EXTENDS.MANIFESTATION 
    'MATERIALIZATION 'EXTENDS 'MANIFESTATION 
    'MANIFESTATION.BASE-OF.MATERIALIZATION)
(define-full-relation 'FICTION.HAS.FICTION-STRUCTURE 
    'FICTION 'HAS 'FICTION-STRUCTURE 'FICTION-STRUCTURE.OF.FICTION)
(define-full-relation 'FICTION.HAS.FICTION-APPROACH 
    'FICTION 'HAS 'FICTION-APPROACH 'FICTION-APPROACH.OF.FICTION)
(define-full-relation 'NON-FICTION.HAS.NON-FICTION-STRUCTURE 
    'NON-FICTION 'HAS 'NON-FICTION-STRUCTURE 
    'NON-FICTION-STRUCTURE.OF.NON-FICTION)
(define-full-relation 'NON-FICTION.HAS.NON-FICTION-APPROACH 
    'NON-FICTION 'HAS 'NON-FICTION-APPROACH 
    'NON-FICTION-APPROACH.OF.NON-FICTION)
(define-full-relation 'NON-FICTION-STRUCTURE.HAS.SIZE 
    'NON-FICTION-STRUCTURE 'HAS 'SIZE 'SIZE.OF.NON-FICTION-STRUCTURE)
(define-full-relation 'MUSIC.HAS.MUSICAL-FORM 
    'MUSIC 'HAS 'MUSICAL-FORM 'MUSICAL-FORM.OF.MUSIC)
(define-full-relation 'MUSIC.HAS.MUSICAL-APPROACH 
    'MUSIC 'HAS 'MUSICAL-APPROACH 'MUSICAL-APPROACH.OF.MUSIC)
(define-full-relation 'MUSIC.HAS.MUSICAL-INSTRUMENT 
    'MUSIC 'HAS 'MUSICAL-INSTRUMENT 'MUSICAL-INSTRUMENT.OF.MUSIC)
(define-full-relation 'MUSIC.HAS.MUSICAL-KEY 
    'MUSIC 'HAS 'MUSICAL-KEY 'MUSICAL-KEY.OF.MUSIC)

'(linguistic.has.narrative-style
  linguistic.has.tongue)

(define-full-relation 'linguistic.has.narrative-style
  'linguistic 'has 'narrative-style 'narrative-style.of.linguistic)
(define-full-relation 'linguistic.has.tongue
  'linguistic 'has 'tongue 'tongue.of.linguistic)

(define-full-relation 'conception.has.sequential-number
  'conception 'has 'sequential-number 
  'sequential-number.of.conception)

(define-full-relation 'mode.has.verisimilitude
    'mode 'HAS 'verisimilitude 'verisimilitude.of.mode)

(define-full-relation 'mode.has.medium
    'mode 'HAS 'medium 'medium.of.mode)

;; *********************** concepts *********************


;; * upper level (sketchy!) *

(define-concept 'EXISTENCE-DATES :is-primitive '(:exactly 1 value))
(define-concept 'PLACE)
(define-concept 'EVENT
  :is-primitive '(:and (:exactly 1 event.has.existence-dates)
		       (:exactly 1 event.has.place)))

(define-concept 'NAME :is-primitive '(:exactly 1 value))
(define-concept 'UNIFORM-NAME :is-primitive 'name)
(define-concept 'PERSON)
(define-concept 'ORGANIZATION)
(define-concept 'AGENT
  :is-primitive '(:and (:or person organization)
		       (:exactly 1 agent.has.uniform-name)
		       (:at-least 1 agent.has.name)))

;; * creators *

(define-concept 'CREATOR
  :is-primitive '(:and Agent
		       (:all creator.of.work conception)))

(define-concept 'AUTHOR
  :is-primitive 'creator)
(define-concept 'COMPOSER
  :is-primitive 'creator)
(define-concept 'EDITOR
  :is-primitive '(:and creator
		       (:all creator.of.work expression)))
(define-concept 'TRANSLATOR
  :is-primitive '(:and creator
		       (:all creator.of.work expression)))
(define-concept 'PUBLISHER
  :is-primitive '(:and creator
		       (:all creator.of.work manifestation)))
(define-concept 'TRANSCRIBER
  :is-primitive '(:and creator
		       (:all creator.of.work manifestation)))
(define-concept 'PERFORMER
  :is-primitive '(:and creator
		       (:all creator.of.work manifestation)))
(define-concept 'PRODUCER
  :is-primitive '(:and creator
		       (:all creator.of.work materialization)))
(define-concept 'DIGITIZER
  :is-primitive '(:and creator
		       (:all creator.of.work digitization)))
(define-concept 'OWNER
  :is-primitive '(:and creator
		       (:all creator.of.work instance)))
(define-concept 'ARCHIVER
  :is-primitive '(:and creator
		       (:all creator.of.work instance)))
(define-concept 'DISTRIBUTOR
  :is-primitive '(:and creator
		       (:all creator.of.work instance)))

;; * work *
(define-concept 'CONCEPTION
  :is-primitive 
  '(:and (:exactly 1 conception.has.uniform-title)
	 (:all conception.has.sequential-number sequential-number)
	 (:at-least 1 conception.has.creator)
	 (:at-least 1 conception.has.topic)
	 (:at-least 1 conception.has.audience)
	 (:at-least 1 conception.has.conceptual-level)))

(define-concept 'EXPRESSION
  :is '(:and conception
	     ;; inheritance is enforced procedurally
	     (:exactly 1 expression.extends.conception)

	     (:at-least 1 expression.has.mode)
	     (:exactly 1 expression.has.title)
	     (:all expression.has.subtitle subtitle)
	     (:at-least 1 expression.has.creator)))
	     
(define-concept 'MANIFESTATION
  :is '(:and expression
	     ;; inheritance is enforced procedurally
	     (:exactly 1 manifestation.extends.expression)

	     (:at-least 1 manifestation.has.publishing-format)
	     (:exactly 1 manifestation.has.title)
	     (:all manifestation.has.subtitle subtitle)
	     (:at-least 1 manifestation.has.creator)
	     (:exactly 1 manifestation.has.edition)
	     (:all manifestation.has.volume volume)
	     (:exactly 1 manifestation.has.price)
	     (:exactly 1 manifestation.has.publication-date)
	     (:at-least 1 manifestation.has.publication-place)
	     (:exactly 1 manifestation.has.marc-control-num)
	     (:exactly 1 manifestation.has.library-of-congress-num)
	     (:exactly 1 manifestation.has.publishers-item-num)))
	     
;; the digital equivalent includes DIGITIZATION and INSTANCE
(define-concept 'MATERIALIZATION
  :is '(:and manifestation
	     ;; inheritance is enforced procedurally
	     (:exactly 1 materialization.extends.manifestation)

	     (:exactly 1 materialization.has.item-number)
	     (:at-least 1 materialization.has.production-format)
	     (:at-least 1 materialization.has.production-place)
	     (:at-least 1 materialization.has.producer)
	     (:at-least 1 materialization.has.production-date)))

;; def's pending for levels not used for Beethoven KB (see web doc).
(define-concept 'DIGITIZATION
  :is-primitive 'manifestation)
(define-concept 'INSTANCE
  :is-primitive 'digitization)

;; for CONCEPTIONS
(define-concept 'WORK :is 'conception)
(define-concept 'TITLE :is-primitive '(:exactly 1 value))
(define-concept 'UNIFORM-TITLE :is-primitive 'title)
(define-concept 'SEQUENTIAL-NUMBER :is-primitive '(:exactly 1 value))
(define-concept 'TOPIC :is-primitive '(:exactly 1 value))
(define-concept 'AUDIENCE)
(define-concept 'CONCEPTUAL-LEVEL)

;; for EXPRESSIONs
(define-concept 'SUBTITLE :is-primitive '(:exactly 1 value))
(define-concept 'MODE
  :is-primitive '(:and (:exactly 1 mode.has.verisimilitude)
		       (:at-least 1 mode.has.medium)))

;; Genre
(define-concept 'VERISIMILITUDE)
(define-concept 'FICTION 
  :is '(:and verisimilitude
	     (:not non-fiction)
	     (:at-least 1 fiction.has.fiction-structure)
	     (:at-least 1 fiction.has.fiction-approach)))
;; a partial list...
(define-concept 'FICTION-STRUCTURE) 
(define-concept 'NOVEL :is-primitive 'fiction-structure)
(define-concept 'PLAY :is-primitive 'fiction-structure)
(define-concept 'SHORT-STORY :is-primitive 'fiction-structure)
;; a partial list...
(define-concept 'FICTION-APPROACH) 
(define-concept 'MYSTERY :is-primitive 'fiction-approach)
(define-concept 'SCIENCE-FICTION :is-primitive 'fiction-approach)
(define-concept 'ROMANCE :is-primitive 'fiction-approach)

(define-concept 'NON-FICTION
  :is '(:and verisimilitude
	     (:exactly 1 non-fiction.has.non-fiction-structure)
	     (:at-least 1 non-fiction.has.non-fiction-approach)))
;; needs work...
(define-concept 'NON-FICTION-STRUCTURE 
  :is-primitive '(:and (:exactly 1 non-fiction-structure.has.size)))
(define-concept 'SIZE :is '(:one-of LONG SHORT))
       
;; a partial list...
(define-concept 'NON-FICTION-APPROACH)
(define-concept 'BIBLIOGRAPHY :is-primitive 'non-fiction-approach)
(define-concept 'MAP :is-primitive 'non-fiction-approach)
(define-concept 'ESSAY  :is-primitive 'non-fiction-approach)
(define-concept 'DOCUMENTARY :is-primitive 'non-fiction-approach)
(define-concept 'HIGHLIGHTS :is-primitive 'documentary)
(define-concept 'BIOGRAPHY :is-primitive 'non-fiction-approach)
(define-concept 'AUTOBIOGRAPHY :is-primitive 'biography)

;; medium
(define-concept 'MEDIUM)
(define-concept 'SYMBOLIC :is-primitive 'medium)
(define-concept 'DATA :is-primitive 'symbolic)
(define-concept 'NOTATION :is-primitive 'symbolic)
(define-concept 'SOUND :is-primitive 'medium)
(define-concept 'NOISE :is-primitive 'sound)
(define-concept 'VISUAL :is-primitive 'medium)
(define-concept 'STATIC-VISUAL :is-primitive 'visual)
(define-concept 'PORTRAIT :is-primitive 'static-visual)
(define-concept 'SEQUENTIAL :is-primitive 'visual)

(define-concept 'LINGUISTIC 
  :is '(:and symbolic
	     (:at-least 1 linguistic.has.narrative-style)
	     (:at-least 1 linguistic.has.tongue)))
(define-concept 'NARRATIVE-STYLE
  :is '(:one-of prose verse))
(define-concept 'TONGUE
  :is '(:one-of english german french czech italian Mandingo Japanese
		Latin Swedish Polyglot Dutch Greek Polish Russian ))

(define-concept 'MUSIC 
  :is '(:and sound
	     (:exactly 1 music.has.musical-form)
	     (:at-least 1 music.has.musical-approach)
	     (:at-least 1 music.has.musical-instrument)
	     (:exactly 1 music.has.musical-key)))
;; a partial list...
(define-concept 'MUSICAL-FORM) 
(define-concept 'cantata :is-primitive 'musical-form)
(define-concept 'CONCERTO :is-primitive 'musical-form)
(define-concept 'dance-form :is-primitive 'musical-form)
(define-concept 'fantasia :is-primitive 'musical-form)
(define-concept 'minuet :is-primitive 'musical-form)
(define-concept 'march :is-primitive 'musical-form)
(define-concept 'mass :is-primitive 'musical-form)
(define-concept 'OPERA :is-primitive 'musical-form)
(define-concept 'oratorio :is-primitive 'musical-form)
(define-concept 'overture :is-primitive 'musical-form)
(define-concept 'program-music :is-primitive 'musical-form)
(define-concept 'passion-music :is-primitive 'musical-form)
(define-concept 'polonaise :is-primitive 'musical-form)
(define-concept 'rondo :is-primitive 'musical-form)
(define-concept 'sonata :is-primitive 'musical-form)
(define-concept 'SONG :is-primitive '(:and musical-form linguistic))
(define-concept 'SYMPHONY :is-primitive 'musical-form)
(define-concept 'variation-music :is-primitive 'musical-form)

(define-concept 'MUSICAL-INSTRUMENT :is-primitive '(:exactly 1 value))
(define-concept 'KEYBOARD :is-primitive 'musical-instrument)
(define-concept 'MUSICAL-KEY :is-primitive '(:exactly 1 value))
;; a partial list...
(define-concept 'MUSICAL-APPROACH) 
(define-concept 'CLASSICAL :is-primitive 'musical-approach)
(define-concept 'ROCK-N-ROLL :is-primitive 'musical-approach)
(define-concept 'jazz :is-primitive 'musical-approach)
(define-concept 'reggae :is-primitive 'musical-approach)
(define-concept 'salsa :is-primitive 'musical-approach)

;; types of Beethoven music we would like to reason about
(define-concept '_PIANO-ACCOMPANIMENT 
  :is '(:and music
	     (:all music.has.musical-instrument keyboard)))

;; for MANIFESTATIONs
(define-concept 'PUBLISHING-FORMAT)
(define-concept 'PUBLICATION-DATE :is-primitive '(:exactly 1 value))
(define-concept 'PUBLICATION-PLACE :is-primitive '(:exactly 1 value))
(define-concept 'EDITION  :is-primitive '(:exactly 1 value))
(define-concept 'VOLUME :is-primitive '(:exactly 1 value))
(define-concept 'PRICE :is-primitive '(:exactly 1 value))
(define-concept 'MARC-CONTROL-NUM :is-primitive '(:exactly 1 value))
(define-concept 'LIBRARY-OF-CONGRESS-NUM :is-primitive '(:exactly 1 value))
(define-concept 'PUBLISHERS-ITEM-NUM :is-primitive '(:exactly 1 value))

;; publishing format
(define-concept 'LIVE 
  :is-primitive '(:and publishing-format
		       (:at-least 1 live.of.event)))
(define-concept 'PERFORMANCE 
  :is-primitive '(:and live event))
(define-concept 'PHENOMENA :is-primitive 'live)
(define-concept 'RECORDED :is-primitive 'publishing-format)
(define-concept 'SOUND-RECORDING :is-primitive 'recorded)
(define-concept 'FILM :is-primitive 'recorded)
(define-concept 'VIDEO-FORMAT :is-primitive 'recorded)
(define-concept 'BOOK :is-primitive 'recorded)
(define-concept 'ILLUSTRATION :is-primitive 'recorded)
(define-concept 'PLATE :is-primitive 'illustration)
(define-concept 'LIBRETTO :is-primitive 'recorded)
(define-concept 'SCORE :is-primitive 'recorded)
(define-concept 'VOCAL-SCORE :is-primitive 'score)
(define-concept 'JOURNAL :is-primitive 'recorded)
(define-concept 'NEWSPAPER :is-primitive 'recorded)
(define-concept 'LP :is-primitive 'recorded)
(define-concept 'VIDEO :is-primitive 'recorded)
(define-concept 'TABLOID :is-primitive 'newspaper)
(define-concept 'REPORT :is-primitive 'recorded)
(define-concept 'THESIS :is-primitive 'book)
(define-concept 'UNDERGRADUATE-THESIS :is-primitive 'thesis)
(define-concept 'MASTERS-THESIS :is-primitive 'thesis)
(define-concept 'DOCTORAL-THESIS :is-primitive 'thesis)

;; for MATERIALIZATION
(define-concept 'ITEM-NUMBER  :is-primitive '(:exactly 1 value))
(define-concept 'PRODUCTION-FORMAT)
(define-concept 'PRODUCTION-PLACE :is-primitive '(:exactly 1 value))
(define-concept 'PRODUCER :is-primitive '(:exactly 1 value))
(define-concept 'PRODUCTION-DATE :is-primitive '(:exactly 1 value))

(define-concept 'FACSIMILE :is-primitive 'production-format)

;; ** for conversion only (see rules_transcription) **
(define-concept '_COMMENT :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._COMMENT)
(define-concept '_ABRIDGED :is-primitive '(:at-least 1 value)) 
(define-relation 'MATERIALIZATION.HAS._ABRIDGED)
(define-concept '_UNABRIDGED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._UNABRIDGED)
(define-concept '_ALTERED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._ALTERED)
(define-concept '_ADAPTED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._ADAPTED)
(define-concept '_COMPILED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._COMPILED)
(define-concept '_REPRODUCTION :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._REPRODUCTION)
(define-concept '_FACSIMILE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._FACSIMILE)
(define-concept '_SEQUEL :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._SEQUEL)
(define-concept '_TRANSCRIPTION :is-primitive '(:at-least 1 value)) 
(define-relation 'MATERIALIZATION.HAS._TRANSCRIPTION)
(define-concept '_REARRANGEMENT :is-primitive '(:at-least 1 value)) 
(define-relation 'MATERIALIZATION.HAS._REARRANGEMENT)
(define-concept '_REMASTERED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._REMASTERED)
(define-concept '_REPRINTED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._REPRINTED)
(define-concept '_REPUBLISHED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._REPUBLISHED)
(define-concept '_PUBLISHED-SIMULTANEOUSLY 
  :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PUBLISHED-SIMULTANEOUSLY)
(define-concept '_CRITIQUE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._CRITIQUE)
(define-concept '_REVISED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._REVISED)
(define-concept '_SUPPLEMENTED :is-primitive '(:at-least 1 value)) 
(define-relation 'MATERIALIZATION.HAS._SUPPLEMENTED)
(define-concept '_TRANSLATED :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._TRANSLATED)
(define-concept '_UNKNOWN-DERIVATION :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._UNKNOWN-DERIVATION)
(define-concept '_DESCRIPTIVE-REVIEW :is-primitive '(:at-least 1 value)) 
(define-relation 'MATERIALIZATION.HAS._DESCRIPTIVE-REVIEW)
(define-concept '_PERFORMED-USING :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PERFORMED-USING)
(define-concept '_COMPOSITION :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._COMPOSITION)
(define-concept '_PROGRAM-NOTES-EDITOR :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PROGRAM-NOTES-EDITOR)
(define-concept '_AUTHOR :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._AUTHOR)
(define-concept '_EDITOR2 :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._EDITOR2)
(define-concept '_PUBLISHER-CITY :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PUBLISHER-CITY)
(define-concept '_DATE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._DATE)
(define-concept '_GENRE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._GENRE)
(define-concept '_LANGUAGE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._LANGUAGE)
(define-concept '_PUBLISHER :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PUBLISHER)
(define-concept '_CONDUCTOR :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._CONDUCTOR)
(define-concept '_ORCHESTRA :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._ORCHESTRA)
(define-concept '_SOLOIST :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._SOLOIST)
(define-concept '_PERFORMANCE-DATE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PERFORMANCE-DATE)
(define-concept '_PERFORMANCE-PLACE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PERFORMANCE-PLACE)
(define-concept '_TITLE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._TITLE)
(define-concept '_SERIES :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._SERIES)
(define-concept '_PUBLISHERS-NUMBER :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._PUBLISHERS-NUMBER)
(define-concept '_MULTI-RELATIONS :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._MULTI-RELATIONS)
(define-concept '_ORIGINAL-DATE :is-primitive '(:at-least 1 value))
(define-relation 'MATERIALIZATION.HAS._ORIGINAL-DATE)

;; ** all of the composition concepts will need to wait for another
;;    phase of implementation. The music collections, in particular,
;;    will benefit greatly.
(define-concept 'SERIES :is-primitive '(:exactly 1 value))

;; ** ONTOGENY RELATIONS **
;; Each group has a general relation defined first.
;; There are three levels of certainty -- tentative, confirmed, certain.
;; The primary relations are from the viewpoint of the succeeding work,
;; relative to the preceding.

(define-relation 'ONTOGENY-FROM)
(define-relation 'ONTOGENY-TO :is '(:inverse ONTOGENY-FROM))

;; derivations
(define-relation 'DERIVED-FROM-TENTATIVE
  :is-primitive 'ontogeny-from
  :domain 'conception :range 'conception)
(define-relation 'derived-to-tentative 
  :is '(:inverse derived-from-tentative))
(define-relation 'derived-from-confirmed 
  :is-primitive 'derived-from-tentative)
(define-relation 'derived-to-confirmed 
  :is '(:inverse derived-from-confirmed))
(define-relation 'derived-from-certain 
  :is-primitive 'derived-from-confirmed)
(define-relation 'derived-to-certain
  :is '(:inverse derived-from-certain))

(define-relation 'TRANSLATED-FROM-TENTATIVE
  :is-primitive 'derived-from-tentative
  :domain 'expression :range 'expression)
(define-relation 'translated-to-tentative 
  :is '(:inverse translated-from-tentative))
(define-relation 'translated-from-confirmed 
  :is-primitive 'translated-from-tentative)
(define-relation 'translated-to-confirmed 
  :is '(:inverse translated-from-confirmed))
(define-relation 'translated-from-certain 
  :is-primitive 'translated-from-confirmed)
(define-relation 'translated-to-certain
  :is '(:inverse translated-from-certain))

(define-relation 'REVISED-FROM-TENTATIVE
  :is-primitive 'derived-from-tentative
  :domain 'expression :range 'expression)
(define-relation 'revised-to-tentative 
  :is '(:inverse revised-from-tentative))
(define-relation 'revised-from-confirmed 
  :is-primitive 'revised-from-tentative)
(define-relation 'revised-to-confirmed 
  :is '(:inverse revised-from-confirmed))
(define-relation 'revised-from-certain 
  :is-primitive 'revised-from-confirmed)
(define-relation 'revised-to-certain
  :is '(:inverse revised-from-certain))

(define-relation 'REPRINTED-FROM-TENTATIVE
  :is-primitive 'derived-from-tentative
  :domain 'manifestation :range 'manifestation)
(define-relation 'reprinted-to-tentative 
  :is '(:inverse reprinted-from-tentative))
(define-relation 'reprinted-from-confirmed 
  :is-primitive 'reprinted-from-tentative)
(define-relation 'reprinted-to-confirmed 
  :is '(:inverse reprinted-from-confirmed))
(define-relation 'reprinted-from-certain 
  :is-primitive 'reprinted-from-confirmed)
(define-relation 'reprinted-to-certain
  :is '(:inverse reprinted-from-certain))

(define-relation 'REPUBLISHED-FROM-TENTATIVE
  :is-primitive 'derived-from-tentative
  :domain 'manifestation :range 'manifestation)
(define-relation 'republished-to-tentative 
  :is '(:inverse republished-from-tentative))
(define-relation 'republished-from-confirmed 
  :is-primitive 'republished-from-tentative)
(define-relation 'republished-to-confirmed 
  :is '(:inverse republished-from-confirmed))
(define-relation 'republished-from-certain 
  :is-primitive 'republished-from-confirmed)
(define-relation 'republished-to-certain
  :is '(:inverse republished-from-certain))

(define-relation 'REPRODUCED-FROM-TENTATIVE
  :is-primitive 'derived-from-tentative
  :domain 'materialization :range 'materialization)
(define-relation 'reproduced-to-tentative 
  :is '(:inverse reproduced-from-tentative))
(define-relation 'reproduced-from-confirmed 
  :is-primitive 'reproduced-from-tentative)
(define-relation 'reproduced-to-confirmed 
  :is '(:inverse reproduced-from-confirmed))
(define-relation 'reproduced-from-certain 
  :is-primitive 'reproduced-from-confirmed)
(define-relation 'reproduced-to-certain
  :is '(:inverse reproduced-from-certain))


;; additions
(define-relation 'ADDS-TO-TENTATIVE
  :is-primitive 'ontogeny-from
  :domain 'conception :range 'conception)
(define-relation 'adding-yields-tentative 
  :is '(:inverse adds-to-tentative))
(define-relation 'adds-to-confirmed 
  :is-primitive 'adds-to-tentative)
(define-relation 'adding-yields-confirmed 
  :is '(:inverse adds-to-confirmed))
(define-relation 'adds-to-certain 
  :is-primitive 'adds-to-confirmed)
(define-relation 'adding-yields-certain
  :is '(:inverse adds-to-certain))

(define-relation 'SUPPLEMENTS-TENTATIVE
  :is-primitive 'adds-to-tentative
  :domain 'expression :range 'expression)
(define-relation 'supplemented-by-tentative 
  :is '(:inverse supplements-tentative))
(define-relation 'supplements-confirmed 
  :is-primitive 'supplements-tentative)
(define-relation 'supplemented-by-confirmed 
  :is '(:inverse supplements-confirmed))
(define-relation 'supplements-certain 
  :is-primitive 'supplements-confirmed)
(define-relation 'supplemented-by-certain
  :is '(:inverse supplements-certain))

;; descriptions
(define-relation 'DESCRIBES-TENTATIVE
  :is-primitive 'ontogeny-from
  :domain 'expression :range 'expression)
(define-relation 'described-by-tentative 
  :is '(:inverse describes-tentative))
(define-relation 'describes-confirmed 
  :is-primitive 'describes-tentative)
(define-relation 'described-by-confirmed 
  :is '(:inverse describes-confirmed))
(define-relation 'describes-certain 
  :is-primitive 'describes-confirmed)
(define-relation 'described-by-certain
  :is '(:inverse describes-certain))

(define-relation 'CRITIQUES-TENTATIVE
  :is-primitive 'describes-tentative
  :domain 'expression :range 'expression)
(define-relation 'critiqued-by-tentative 
  :is '(:inverse critiques-tentative))
(define-relation 'critiques-confirmed 
  :is-primitive 'critiques-tentative)
(define-relation 'critiqued-by-confirmed 
  :is '(:inverse critiques-confirmed))
(define-relation 'critiques-certain 
  :is-primitive 'critiques-confirmed)
(define-relation 'critiqued-by-certain
  :is '(:inverse critiques-certain))

;; continuations
(define-relation 'CONTINUATION-OF-TENTATIVE
  :is-primitive 'ontogeny-from
  :domain 'conception :range 'conception)
(define-relation 'continued-by-tentative 
  :is '(:inverse continuation-of-tentative))
(define-relation 'continuation-of-confirmed 
  :is-primitive 'continuation-of-tentative)
(define-relation 'continued-by-confirmed 
  :is '(:inverse continuation-of-confirmed))
(define-relation 'continuation-of-certain 
  :is-primitive 'continuation-of-confirmed)
(define-relation 'continued-by-certain
  :is '(:inverse continuation-of-certain))

(define-relation 'SEQUEL-OF-TENTATIVE
  :is-primitive 'continuation-of-tentative
  :domain 'conception :range 'conception)
(define-relation 'sequelled-by-tentative 
  :is '(:inverse sequel-of-tentative))
(define-relation 'sequel-of-confirmed 
  :is-primitive 'sequel-of-tentative)
(define-relation 'sequelled-by-confirmed 
  :is '(:inverse sequel-of-confirmed))
(define-relation 'sequel-of-certain 
  :is-primitive 'sequel-of-confirmed)
(define-relation 'sequelled-by-certain
  :is '(:inverse sequel-of-certain))

;; identify the potential for unification of two instances with this
;; relation (cases where we don't have enough evidence to go ahead and merge).
;; NOTE: THESE RELATIONS ARE _NOT_ INHERITED.
(define-relation 'TENTATIVELY-THE-SAME
  :domain 'conception :range 'conception
  :characteristics '(:symmetric))

(define-relation 'CONFIRMED-THE-SAME :is-primitive 'tentatively-the-same
   :characteristics '(:symmetric))

;; -----------------------

(tellm)

;; -----------------------

(change-kb "BEETHOVEN-KB")


The University of Michigan Digital Library.
The Beethoven Project.
The Service Classifier Agent.
To mail Peter Weinstein.
To mail the ontology group.