;; Access to and use of these products is governed by the GNU General Public 
;; License <http://www.gnu.org/copyleft/gpl.html>. 
;; By using these products, you agree to be bound by the terms 
;; of the GPL.

;; Those who are interested in making use of this ontology are requested 
;; to contact Adam Pease (apease@articulatesoftware.com).
;; We ask the people using or referencing this work cite our primary paper:

;; Niles, I., and Pease, A.  2001.  Towards a Standard Upper Ontology.  In 
;; Proceedings of the 2nd International Conference on Formal Ontology in 
;; Information Systems (FOIS-2001), Chris Welty and Barry Smith, eds, 
;; Ogunquit, Maine, October 17-19, 2001.  See also http://www.ontologyportal.org

;; Dependencies: 

;;     Merge.kif
;;     Mid-level-ontology.kif
;;     CCTrep.kif
;;     Communications.kif
;;     CountriesAndRegions.kif
;;     Economy.kif
;;     elements.kif
;;     FinancialOntology.kif
;;     Geography.kif
;;     Government.kif
;;     naics.kif
;;     People.kif
;;     QoSontology.kif

(=>
  (termFormat ?TERM ?LANGUAGE ?STRING)
  (names ?STRING ?TERM))

(disjoint Organization Human)

;; KJN: Moving this to Merge.kif as it causes some dependency errors on ShapeAttribute
;;(subclass StructureAttribute InternalAttribute)
;;(documentation StructureAttribute EnglishLanguage
;;"Each &%subclass of &%StructureAttribute denotes some facet of the
;;structure of physical entities.  Each &%instance of
;;&%StructureAttribute denotes some structural characteristic that may
;;pertain to some &%Physical entity.")
;;(subclass ShapeAttribute StructureAttribute)

;;(instance structure BinaryPredicate)
;;(instance structure IrreflexiveRelation)
;;(instance structure AsymmetricRelation)
;;(subrelation structure attribute)
;;(domain structure 1 Object)
;;(domain structure 2 StructureAttribute)

;; KJN: moving this to MILO
;;(instance color BinaryPredicate)
;;(instance color IrreflexiveRelation)
;;(instance color AsymmetricRelation)
;;(subrelation color attribute)
;;(domain color 1 Object)
;;(domain color 2 ColorAttribute)

;; NS: Narrowing attribute -> color.
;;(=>
;;  (and
;;    (instance ?ATTR ColorAttribute)
;;    (holdsDuring ?T1 
;;      (attribute ?OBJ ?ATTR)))
;;  (holdsDuring ?T1
;;    (color ?OBJ ?ATTR)))

;; KJN: Moving this to Mid-level-ontology.kif
;;(subclass VisualAcuityAttribute BiologicalAttribute)
;;(documentation VisualAcuityAttribute EnglishLanguage "The
;;&%BiologicalAttributes in this &%Class describe the visual
;;capabilities of an &%Organism.")

;;(instance Blind VisualAcuityAttribute)

;;(instance ColorBlind VisualAcuityAttribute)
;;(documentation ColorBlind EnglishLanguage "This
;;&%VisualAcuityAttribute describes an &%Organism that is
;;unable to perceive a distinction in color between certain
;;wavelength ranges within the larger range of typically
;;visible electro-magnetic radiation (light).  Among &%Humans,
;;there are several forms and degrees of color blindness.
;;Color blindness is generally considered to be a mild to
;;moderate disability among &%Humans, but individuals with
;;certain types of color blindness excel at some visual
;;pattern recognition tasks, and it's not clear that the
;;condition should be considered a &%DiseaseOrSyndrome.")

;; "Rate"
;; "RoyaltyRate"
;; "AudioBitRate"
;; "AudioSamplingRate"
;; "BitRate"
;; "OverallBitRate"
;; "CurrencyExchangeRate"
;; "FrameRate"
;; "SamplingRate"
;; "TaxRate"
;; "UnitOfBitRate"
;; "UnitOfExtent"
;; "UnitOfFrameRate"
;; "UnitOfFrequency"
;; "VideoBitRate"

;; "AudioBitsPerSample"
;; "BitsPerSample"
;; "MinimumAmountPerCustomer"
;; "PercentageRate"
;; "TotalWholesalePricePerUnit"
;; "TotalWholesalePricePerUnitInCurrencyOfAccounting"
;; "WholesalePricePerUnit"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Start: Event Types, Temporal Interval Types ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<=>
  (subrelation ?PRED involvedInEvent)
  (instance ?PRED CaseRole))

;; LibraryEvent

(subclass ReachingAgreement Stating)
(documentation ReachingAgreement EnglishLanguage "Instances of
this &%Class are &%Statings in which two or more agents affirm
the same thing (acknowledge the truth of the same
&%Propositions).")

(=>
  (instance ?CLOSE ClosingContract)
  (exists (?AGREE)
    (and
      (instance ?AGREE ReachingAgreement)
      (subProcess ?AGREE ?CLOSE))))

(=>
  (instance ?RA ReachingAgreement)
  (exists (?A1 ?A2)
    (and
      (agent ?RA ?A1)
      (agent ?RA ?A2)
      (not (equal ?A1 ?A2)))))

(=>
  (instance ?RA ReachingAgreement)
  (exists (?PROP)
    (and
      (instance ?PROP Agreement)
      (result ?RA ?PROP))))

(=>
  (and
    (instance ?RA ReachingAgreement)
    (agent ?RA ?AGENT)
    (result ?RA ?PROP)
    (instance ?PROP Agreement))
  (holdsDuring (FutureFn (WhenFn ?RA))
    (partyToAgreement ?AGENT ?PROP)))

(subclass LicenseAgreement Agreement)

(subclass AgentPatientProcess Process)
(documentation AgentPatientProcess EnglishLanguage "Instances of
&%AgentPatientProcess have at least one &%agent and at least one
&%patient.  Unlike instances of &%IntentionalProcess, the &%agent
need not be a &%CognitiveAgent.  Cf. other high-level
&%subclasses of &%Process, such as &%DualObjectProcess,
&%InternalChange, and &%Motion.")

(=>
  (instance ?PROC AgentPatientProcess)
  (exists (?AGENT ?PATIENT)
    (and
      (agent ?PROC ?AGENT)
      (patient ?PROC ?PATIENT))))

(documentation ReceivingAnObjectFn EnglishLanguage
"(&%ReceivingAnObjectFn ?CLASS) denotes a &%subclass of
&%Getting, all instances of which have some instance of ?CLASS as
the object received (&%patient).")

(instance ReceivingAnObjectFn UnaryFunction)
(rangeSubclass ReceivingAnObjectFn Getting)
(domainSubclass ReceivingAnObjectFn 1 Object)

(=>
  (instance ?GET (ReceivingAnObjectFn ?OBJCLASS))
  (exists (?OBJ)
    (and
      (instance ?OBJ ?OBJCLASS)
      (patient ?GET ?OBJ))))

(=>
  (and
    (equal ?CLASS1 (ReceivingAnObjectFn ?OBJCLASS1))
    (equal ?CLASS2 (ReceivingAnObjectFn ?OBJCLASS2))
    (subclass ?OBJCLASS1 ?OBJCLASS2))
  (subclass ?CLASS1 ?CLASS2))

(subclass Emailing WrittenCommunication)
(documentation Emailing EnglishLanguage "An &%instance of &%Emailing
is a &%Communication in which an &%EmailMessage is sent by one
&%CognitiveAgent to another.")

(=>
  (instance ?ACT Emailing)
  (exists (?MSG)
    (and
      (patient ?ACT ?MSG)
      (instance ?MSG EmailMessage))))

;; TO DO: Revise the rules that refer to WrittenCommunication, to make
;; it easier for an inference engine to derive useful conclusions
;; about specializations of WrittenCommunication.

(subclass InPersonCommunication Communication)
(documentation InPersonCommunication EnglishLanguage "An &%instance of
&%InPersonCommunication is a &%Communication that occurs between two
or more &%Humans who are physically present to each other during the
&%Communication.")

(=>
  (and
    (instance ?C InPersonCommunication)
    (agent ?C ?A1)
    (agent ?C ?A2)
    (not (equal ?A1 ?A2)))
  (holdsDuring ?C
    (orientation ?A1 ?A2 Near)))

;; TO DO: A good representation of holidays requires representation of
;; different calendars (Gregorian, Julian, Jewish, Islamic)

(instance observesHoliday BinaryPredicate)
(instance observesHoliday AsymmetricRelation)
(domain observesHoliday 1 CognitiveAgent)
(domain observesHoliday 2 Holiday)
(documentation observesHoliday EnglishLanguage "(&%observesHoliday
?&%CognitiveAgent ?&%Holiday) means that ?&%CognitiveAgent
regards ?&%Holiday as an institutionally special (sacred,
commemorative, celebratory) &%TimeInterval and participates, at least
to some degree, in the rituals, ceremonies, or other activies
associated with ?&%Holiday.")

;; Every holiday is observed by at least someone.  Additional
;; rules make this more specific.
(=>
  (instance ?T1 Holiday)
  (exists (?A)
    (observesHoliday ?A ?T1)))

;; If one observes a holiday, one exists when the holiday occurs.
;; Note that this partly obviates the need to use holdsDuring
;; with observesHoliday, but might not be sufficient to prevent
;; inference engines from generating contradictions.
(=>
  (and
    (observesHoliday ?A ?T1)
    (equal ?T2 (WhenFn ?A)))
  (during ?T1 ?T2))

(subclass ChristianHoliday Holiday)
(documentation ChristianHoliday EnglishLanguage "An &%instance
of &%ChristianHoliday is a &%Holiday instituted and
observed by &%members of &%Christianity.")

(=>
  (and
    (instance ?T1 ChristianHoliday)
    (holdsDuring ?T1
      (attribute ?A Christian)))
  (observesHoliday ?A ?T1))

(subclass JewishHoliday Holiday)
(documentation JewishHoliday EnglishLanguage "An &%instance of
&%JewishHoliday is a &%Holiday instituted and observed by
&%members of &%Judaism.")

(=>
  (and
    (instance ?T1 JewishHoliday)
    (observesHoliday ?A ?T1))
  (holdsDuring ?T1
    (attribute ?A ReligiousJew)))

(subclass USHoliday Holiday)
(documentation USHoliday EnglishLanguage "An &%instance of
&%USHoliday is a &%Holiday instituted and observed by
&%citizens or inhabitants of the &%UnitedStates.  Instances of
&%USHoliday commemorate or celebrate key figures or events
in the history of the nation, or focus attention on key national
values or ideals.")

(subclass Advent ChristianHoliday)
(subclass Advent MoveableHoliday)
(documentation Advent EnglishLanguage "An &%instance of
&%Advent (&%LatinLanguage adventus = coming) is a &%TimeInterval that
begins with an &%AdventSunday and includes the four &%Sundays
preceding an &%instance of &%ChristmasDay.  During this period,
observant &%members of &%Christianity ritually anticipate the
recurring celebration of the birth of Jesus of Nazareth.  Note that
&%Advent is observed only in Western Christianity, which includes
&%RomanCatholicism, &%Protestantism, and &%Anglicanism.  The analog of
&%Advent in Eastern Christianity, which includes
&%EasternOrthodoxChristianity, is the Nativity Fast, which differs
from &%Advent in length and significance.")

(subclass AdventSunday ChristianHoliday)
(subclass AdventSunday Sunday)
(subclass AdventSunday MoveableHoliday)
(documentation AdventSunday EnglishLanguage "An &%instance of
&%AdventSunday is a &%Sunday that begins an &%instance of
&%Advent.")

(=>
  (instance ?T1 Advent)
  (exists (?T2)
    (and
      (instance ?T2 AdventSunday)
      (starts ?T2 ?T1))))

;; TO DO: state that every Advent temporally subsumes the four Sundays
;; preceding a Christmas Day.

(=>
  (instance ?T1 AdventSunday)
  (exists (?T2)
    (and
      (instance ?T2 Advent)
      (starts ?T1 ?T2))))

(subclass ChristmasDay ChristianHoliday)
(subclass ChristmasDay Day)
(subclass ChristmasDay FixedHoliday)
(subclass ChristmasDay (DayFn 25 December))
;; TO DO: Make it possible to represent the fact that no
;; instances of (DayFn 25 December) in the Gregorian and Julian
;; calendars correspond to the same actual (siderial, UTC) day.
(documentation ChristmasDay EnglishLanguage "An &%instance of
&%ChristmasDay is a &%ChristianHoliday on which observant
&%members of &%Christianity celebrate the birth of Jesus of Nazareth.
In both the Gregorian and Julian calendars, &%ChristmasDay falls on
December 25th, but since the two calendars are currently off by 13
days, the &%ChristmasDays assigned by each correspond to different
actual (sidereal, UTC) days.")

(=>
  (and
    (instance ?NATION Nation)
    (or
      (geographicSubregion ?NATION NorthAmerica)
      (geographicSubregion ?NATION SouthAmerica)
      (geographicSubregion ?NATION WesternEurope)))
  (holdsDuring (WhenFn ?NATION)
    (nationalHoliday ?NATION ChristmasDay)))

(nationalHoliday Australia ChristmasDay)
(nationalHoliday NewZealand ChristmasDay)

(=>
  (instance ?T1 ChristmasDay)
  (exists (?T2)
    (and
      (instance ?T2 Advent)
      (meetsTemporally ?T2 ?T1))))

(=>
  (instance ?T1 Advent)
  (exists (?T2)
    (and
      (instance ?T2 ChristmasDay)
      (meetsTemporally ?T1 ?T2))))

(=>
  (and
    (instance ?T1 Advent)
    (instance ?T2 ChristmasDay)
    (meetsTemporally ?T1 ?T2))
  (exists (?YEAR)
    (and 
      (instance ?YEAR Year)
      (during ?T1 ?YEAR)
      (during ?T2 ?YEAR))))

(=>
  (and
    (instance ?T1 Advent)
    (instance ?T2 ChristmasDay)
    (during ?T1 ?YEAR)
    (instance ?YEAR Year)
    (meetsTemporally ?T1 ?T2))
  (during ?T2 ?YEAR))

(=>
  (and
    (instance ?T1 Advent)
    (instance ?T2 ChristmasDay)
    (during ?T2 ?YEAR)
    (instance ?YEAR Year)
    (meetsTemporally ?T1 ?T2))
  (during ?T1 ?YEAR))

;; Just about every Christian observes Christmas.
(=>
  (and
    (holdsDuring ?H 
      (attribute ?A Christian))
    (instance ?H ChristmasDay))
  (observesHoliday ?A ?H))

(subclass Lent ChristianHoliday)
(subclass Lent MoveableHoliday)
(documentation Lent EnglishLanguage "In Western Christianity, an
&%instance of &%Lent is a 40-day period of (relative) fasting and
reflection preceding an &%instance of &%EasterSunday.  In the US,
&%Lent is observed predominantly by &%RomanCatholics, with lesser
participation by members of other &%Christian denominations, some
of which even consider &%Lent not to be a legitimate
&%ChristianHoliday.")

(=>
  (instance ?T1 Lent)
  (exists (?T2)
    (and
      (instance ?T2 EasterSunday)
      (meetsTemporally ?T1 ?T2))))

(=>
  (instance ?T1 EasterSunday)
  (exists (?T2)
    (and
      (instance ?T2 Lent)
      (meetsTemporally ?T2 ?T1))))

(=>
  (and
    (instance ?ES EasterSunday)
    (instance ?L Lent)
    (meetsTemporally ?L ?ES)
    (during ?ES ?Y)
    (instance ?Y Year))
  (during ?L ?Y))

(=>
  (and
    (instance ?ES EasterSunday)
    (instance ?L Lent)
    (meetsTemporally ?L ?ES)
    (during ?L ?Y)
    (instance ?Y Year))
  (during ?ES ?Y))

(=>
  (instance ?T1 Lent)
  (duration ?T1 (MeasureFn 40 DayDuration)))

(subclass PalmSunday ChristianHoliday)
(subclass PalmSunday Sunday)
(subclass PalmSunday MoveableHoliday)
(documentation PalmSunday EnglishLanguage "An &%instance of
&%PalmSunday is a &%ChristianHoliday that commemorates the
<quote>Triumphal Entry</quote> of Jesus into Jerusalem in the
days preceding his crucifixion.  The actual date of a
&%PalmSunday is determined by the date of the corresponding
&%EasterSunday, and so, like Easter, Palm Sunday is a
&%MoveableHoliday.")

;; Palm Sunday is the Sunday immediately preceding Easter Sunday.
;; There are many ways to say this, some probably simpler than
;; the rule below.
(=>
  (and
    (instance ?Y Year)
    (instance ?E EasterSunday)
    (instance ?P PalmSunday)
    (during ?E ?Y)
    (during ?P ?Y)
    (starts ?P ?I)
    (finishes ?E ?I))
  (duration ?I (MeasureFn 8 DayDuration)))

(subclass EasterSunday ChristianHoliday)
(subclass EasterSunday Sunday)
(subclass EasterSunday MoveableHoliday)
(documentation EasterSunday EnglishLanguage "An &%instance of
&%EasterSunday is a &%ChristianHoliday celebrating the
resurrection of Jesus of Nazareth.  Easter is a movable holiday,
falling between late March and late April for Western
Chrisitanity (Gregorian calendar), and between early April and
early May for Eastern Christianity (Julian calendar).  Easter is
calculated to occur near the Jewish holiday &%Passover, the date
of which is determined according to the Jewish lunar calendar.")

;; This, at least, is true for both the Gregorian and Julian
;; calendars.
(=>
  (and
    (instance ?D EasterSunday)
    (temporalPart ?D ?M)
    (instance ?M Month))
  (or
    (instance ?M March)
    (instance ?M April)
    (instance ?M May)))

;; Just about every Christian observes EasterSunday.
(=>
  (and
    (holdsDuring ?H 
      (attribute ?A Christian))
    (instance ?H EasterSunday))
  (observesHoliday ?A ?H))

(subclass Epiphany ChristianHoliday)
(subclass Epiphany (DayFn 6 January))
(subclass Epiphany FixedHoliday)
(documentation Epiphany EnglishLanguage "An &%instance of
&%Epiphany is a &%ChristianHoliday that is celebrated on
January 6th in both the Gregorian and Julian calendars.  In
Western Christianity, it commemorates the visit of the Magi to
the infant Jesus.  In Eastern Christianity, it commemorates
Jesus's baptism in the Jordan River and manifestation as the Son
of God.  In this tradition, the holiday is also called
Theophany.")

(subclass AscensionThursday ChristianHoliday)
(subclass AscensionThursday MoveableHoliday)
(subclass AscensionThursday Thursday)
(documentation AscensionThursday EnglishLanguage "An &%instance
of &%AscensionThursday is a &%ChristianHoliday that
celebrates the bodily ascension of Jesus to heaven following his
resurrection.")

;; In every calendar year, the time period from Easter to
;; Ascension Thursday is 40 days, inclusive.
(=>
  (and
    (instance ?Y Year)
    (instance ?E EasterSunday)
    (instance ?A AscensionThursday)
    (during ?E ?Y)
    (during ?A ?Y)
    (starts ?E ?I)
    (finishes ?A ?I))
  (duration ?I (MeasureFn 40 DayDuration)))

(subclass Pentecost ChristianHoliday)
(subclass Pentecost MoveableHoliday)
(subclass Pentecost Sunday)
(documentation Pentecost EnglishLanguage "An &%instance of
&%Pentecost is a &%ChristianHoliday that commemorates the
descent of the Holy Spirit onto the Apostles and other followers
of Jesus, as described in the Book of Acts.")

;; In every calendar year, the time period from Easter to
;; Pentecost is 50 days, inclusive.
(=>
  (and
    (instance ?Y Year)
    (instance ?E EasterSunday)
    (instance ?P Pentecost)
    (during ?E ?Y)
    (during ?P ?Y)
    (starts ?E ?I)
    (finishes ?P ?I))
  (duration ?I (MeasureFn 50 DayDuration)))

(subclass Hanukkah JewishHoliday)
(subclass Hanukkah MoveableHoliday)
(documentation Hanukkah EnglishLanguage "An &%instance of
&%Hanukkah is a &%JewishHoliday that lasts for eight
nights, and commemorates the rededication of the Temple in
Jerusalem during the 2nd century BCE, at the time of the
Maccabean Revolt.  According to the Jewish (Hebrew)
religious calendar, Hanukkah begins at sunset on 25
Kislev.")

(=>
  (instance ?H Hanukkah)
  (duration ?H (MeasureFn 8 DayDuration)))

;; Undoubtedly, it would be better to explicitly represent
;; the main calendrical systems of the various religions,
;; and some of the relationships between them.
(=>
  (and
    (instance ?H Hanukkah)
    (equal ?B (BeginFn ?H)))
  (exists (?M)
    (and
      (temporalPart ?B ?M)
      (instance ?M Month)
      (or
        (instance ?M November)
        (instance ?M December)))))

(subclass Passover JewishHoliday)
(subclass Passover MoveableHoliday)
(documentation Passover EnglishLanguage "An &%instance of
&%Passover is a &%JewishHoliday that lasts for seven
nights, or eight nights among Conservative and Orthodox Jews
in the Diaspora.  Technically, Passover is the first night
of (or, immediately precedes) the Festival of Unlevened
Bread.  &%Passover commemorates the liberation of the
Israelites from slavery in Egypt, as recounted in the Book
of Exodus.  In the Jewish (Hebrew) calendar, &%Passover
begins at sunset on 14 Nisan.")

(=>
  (and
    (instance ?P Passover)
    (duration ?P (MeasureFn ?N DayDuration)))
  (or
    (equal ?N 7)
    (equal ?N 8)))

(subclass USThanksgivingDay USHoliday)
(subclass USThanksgivingDay MoveableHoliday)
(subclass USThanksgivingDay Thursday)
(documentation USThanksgivingDay EnglishLanguage "An &%instance of
&%USThanksgivingDay is a &%USHoliday celebrated yearly on the
fourth &%Thursday of &%November.  The holiday commemorates the
feasts of Thanksgiving instituted by early English settlers in
the New World, most notably the 1621 Thanksgiving at Plymouth
Colony in Massachusetts.  In the &%UniteStates, &%USThanksgivingDay
traditionally is the one national holiday for which entire
families strive to come together, with members often traveling
great distances.  Note that &%Canada celebrates its own
Thanksgiving, on the second &%Monday of &%October, with
tradition, significance, and foods that parallel the
&%UnitedStates version.")

(=>
  (instance ?T USThanksgivingDay)
  (exists (?M)
    (and
      (instance ?M November)
      (during ?T ?M))))

;; KJN: Moving this to Mid-level-ontology.kif as it is more of a general concept      
;;(subclass Ceremony IntentionalProcess)
;;(subclass Ceremony SocialInteraction)
;;(documentation Ceremony EnglishLanguage "An &%instance of
;;&%Ceremony is a relatively stylized, highly conventional
;;&%SocialInteraction, typically guided or controlled by officials
;;or professionals, to commemorate or mark some transformative
;;event, such as a &%Wedding or a &%Baptizing.")

;; TO DO: Probably it would be best to make the now more or less
;; standard anthropological distinction between &%Ceremony (past
;; to present looking status confirmation events) and *Ritual
;; (present to future looking status transformation events), but
;; that seems more technical than required here, and for unknown
;; utility.

;;(subclass Baptizing Ceremony)
;;(subclass Wedding Ceremony)
;;(subclass Funeral Ceremony)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End: Event Types, Temporal Interval Types ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;
;; Start: Media Types ;;
;;;;;;;;;;;;;;;;;;;;;;;;

;; KJN: Moving this to MILO.
;;(subclass DataStorageDevice Device)
;;(documentation DataStorageDevice EnglishLanguage "An &%instance of
;;&%DataStorageDevice is a &%Device intended to be used for storing
;;data (information).")

;; KJN: Moving this to QoSontology.kif where DataSaving is defined
;;(=>
;;  (instance ?DSAVE DataSaving)
;;  (exists (?DSTORE)
;;    (and
;;      (instance ?DSTORE DataStorageDevice)
;;      (resource ?DSAVE ?DSTORE))))

(subclass ElectronicDataStorageDevice DataStorageDevice)
(documentation ElectronicDataStorageDevice EnglishLanguage "An
&%instance of &%ElectronicDataStorageDevice is a &%DataStorageDevice
intended to be used for storing data (information) in some encoding
scheme designed to be interpreted by electronic devices.")

(=>
  (and
    (instance ?DSAVE DataSaving)
    (resource ?DSAVE ?RES)
    (instance ?RES ElectronicDataStorageDevice))
  (exists (?DEV)
    (and
      (instance ?DEV ElectricDevice)
      (instrument ?DSAVE ?DEV)
      (holdsDuring (WhenFn ?DSAVE)
        (connected ?RES ?DEV)))))

(subclass DigitalDataStorageDevice ElectronicDataStorageDevice)
(documentation DigitalDataStorageDevice EnglishLanguage "An &%instance
of &%DigitalDataStorageDevice is an &%ElectronicDataStorageDevice
intended to be used for storing data (information) in some digital
(discrete bit) encoding scheme designed for interpretation by
computers.")

;; AP - add rule to specify the encoding scheme, relate to BinaryNumber

;; NS: In Merge.kif, the following statements are problematic:
;; (subclass Encoding Writing)
;; (subclass Decoding Writing)
;; &%Writing refers exclusively to the transcription or creation
;; of written texts.  DataSaving 
;; must be related to Encoding somehow, so for now let's try to
;; state something meaningful without referring to the process
;; types.

(=>
  (and
    (instance ?OBJ DigitalDataStorageDevice)
    (part ?PART ?OBJ)
    (instance ?PART DigitalData))
  (exists (?SCHEME ?LIST)
    (and
      (codeMapping ?SCHEME ?PART ?NUM)
      (represents ?LIST ?SCHEME)
      (=>
        (inList ?NUM ?LIST)
        (instance ?NUM BinaryNumber)))))

;; NS: This is difficult, even
;; apart from not being temporally qualified.

(subclass AudioDataStorageDevice DataStorageDevice)
(documentation AudioDataStorageDevice EnglishLanguage "An
&%instance of &%AudioDataStorageDevice is a &%DataStorageDevice
intended to be used for storing data, encoded information,
obtained from sound, in some encoding scheme that, given suitable
technology, can be reproduced as sound.")

;; AP - specify that contents represent RadiatingSound

;; NS: This is already stated in MILO for &%AudioRecording.  An
;; &%AudioDataStorageDevice can "contain" or "hold" an
;; &%AudioRecording.  It's not clear what predicate should be
;; used to relate an &%AudioRecording to the
;; &%AudioDataStorageDevice on which it is stored.  In general,
;; &%part seems more correct than &%located, since the process
;; required to store an &%AudioRecording "on" or "in" an
;; &%AudioDataStorageDevice alters the structure of the device
;; (i.e., the grooves of a vinyl record, the gold or aluminum
;; coating of a CD, etc.

(subclass VideoDataStorageDevice DataStorageDevice)
(documentation VideoDataStorageDevice EnglishLanguage "An
&%instance of &%VideoDataStorageDevice is a
&%DataStorageDevice intended to be used for storing data
obtained from visual inputs (e.g., eyes or cameras), in some
encoding scheme that, given suitable technology, can be
reproduced as visual outputs.")

;; AP - specify that contents represent visual data

(subclass AudioVisualDataStorageDevice AudioDataStorageDevice)
(subclass AudioVisualDataStorageDevice VideoDataStorageDevice)

(subclass DataDisplayDevice CommunicationDevice)
(documentation DataDisplayDevice EnglishLanguage "An &%instance of
&%DataDisplayDevice is a &%Device intended to be used to display data
information in some visual form (e.g., &%Images or visible
&%LinguisticExpressions).")

;; PerceivableThing
;; TouchableThing
;; TouchableCreation
;; SeeableCreation

;; KJN: Moving this to Mid-level-ontology.kif
;;(subclass VisualContentBearingPhysical ContentBearingPhysical)
;;(documentation VisualContentBearingPhysical EnglishLanguage
;;"Instances of &%VisualContentBearingPhysical are
;;&%ContentBearingPhysicals that are intended to convey
;;meaning as the result of being seen.")

;;(subclass VisualContentBearingObject ContentBearingPhysical)
;;(subclass VisualContentBearingObject VisualContentBearingPhysical)
;;(documentation VisualContentBearingObject
;;EnglishLanguage "Instances of &%VisualContentBearingObject are
;;&%ContentBearingObjects that are intended to convey meaning as
;;the result of being seen.")

;;(subclass Image VisualContentBearingObject)
;;(documentation Image EnglishLanguage "Instances of &%Image are
;;&%VisualContentBearingObjects that convey their meaning primarily
;;in non-textual form.")

(documentation TextualImage EnglishLanguage "Instances of
&%TextualImage are &%Images that include depictions of
&%LinguisticExpressions, such as stylized characters or acronyms.")
(subclass TextualImage Image)

(documentation Logo EnglishLanguage "Instances of &%Logo are &%Images
that identify a particular &%Agent, typically an &%Organization, and
the use of which may be reserved to the identified &%Agents through
trademark registry or other legal sanction.")
(subclass Logo Image)

;; AP - create rule that states that logos represent products or agents
;; Could state that they need not be a picture but can be simply something more abstract

(=>
  (and
    (instance ?LOGO Logo)
    (represents ?LOGO ?OBJ))
  (or
    (instance ?OBJ Agent)
    (instance ?OBJ Product)))

;; KJN: Moving to MILO as it is very general-purpose    
;;(subclass Document ContentBearingObject)
;;(subclass Document Artifact)
;;(documentation Document EnglishLanguage "Instances of &%Document are
;;&%ContentBearingObjects that are intended to convey propositional
;;content via &%Text (&%LinguisticExpressions, seen or heard), &%Images,
;;or some combination of these (e.g., an audio clip included in an
;;electronic document consisting mostly of &%VisualText and some
;;&%Images).  Formally, a &%Document constitutes any
;;&%ContentBearingObject that is an &%Artifact conventionally
;;typically intended to be transmitted and assimilated as a meaningful
;;whole.  An &%Article or a &%Book would be a &%Document, but a &%Word
;;or &%Paragraph typically would not.")

;; AP - state that a document hasPurpose of being the instrument of communication
;;(=>
;;  (instance ?DOC Document)
;;  (hasPurpose ?DOC
;;    (exists (?COMM)
;;      (and
;;        (instance ?COMM Communication)
;;        (instrument ?COMM ?DOC)))))

(documentation TextDocument EnglishLanguage "Instances of
&%TextDocument are &%Documents that have at least one &%part that is
an &%instance of &%Text.")

(subclass TextDocument Document)
(=>
  (instance ?OBJ TextDocument)
  (exists (?TXT)
    (and
      (instance ?TXT Text)
      (component ?TXT ?OBJ))))

(=>
  (and
    (instance ?TXT Text)
    (instance ?OBJ Document)
    (part ?TXT ?OBJ))
  (instance ?OBJ TextDocument))

(documentation Correspondence EnglishLanguage "Instances of
&%Correspondence are &%Documents that typically are sent from a
specific sending &%Agent to at least one receiving &%Agent, and
typically adhere to formatting conventions motivated, in part, by the
practical concern of ensuring reliable message transmission and
understanding in a given medium: email messages, FAX messages,
personal letters, business letters, etc.")
(subclass Correspondence Document)
(subclass Letter Correspondence)
(subclass Letter TextDocument)

;; AP - maybe make this disjoint from Disseminating?
;; Try to characterize how it's different from Disseminating

;; NS: Here is the documentation statement for
;; Disseminating: (documentation Disseminating
;; EnglishLanguage "Any Communication that involves a single
;; agent and many destinations. This covers the release of a
;; published book, broadcasting, a theatrical performance,
;; giving orders to assembled troops, delivering a public
;; lecture, etc.").

;; Certainly instances of Correspondence (documents) could be
;; disseminated.  Is the distinction to be characterized the
;; distinction between, say, sending a personal or business
;; letter, and shipping/distributing a book to a buyer (wholesale
;; and retail models, single order and batch models, etc.)?

;;(subclass Report TextDocument)

(subclass ContractDocument TextDocument)
(documentation ContractDocument EnglishLanguage "Instances of
&%ContractDocument are &%TextDocuments that describe the terms of a
contract.")
(=>
  (instance ?DOC ContractDocument)
  (exists (?PROP)
    (and
      (containsInformation ?DOC ?PROP)
      (property ?PROP Contract))))

;; AP - contracts have some normative legal force
;; Distinguish it from a written Promise
;; end comments for now

;; NS: Should be simple, but requires some cleanup.  In
;; Merge.kif, Contract is a subAttribute of Promise.  Note that
;; in real life, a contract document can contain some statements
;; that are understood (and even annotated) to be merely
;; promises.  For now, we could say the following:
(=>
  (and
    (instance ?DOC ContractDocument)
    (containsInformation ?DOC ?PROP)
    (property ?PROP Contract))
  (property ?PROP Law))
;; NS: Paraphrase: If a contract document contains
;; propositions that are contractual, those same
;; propositions have the force of law.

;; Rejected (subclass Letter PaperSheet).  This statement
;; typifies a problem.  Content type, linguistic form,
;; medium of expression (instantiation), and means of
;; transmission tend to be muddled together.  

(subclass FaxMessage Correspondence)
(documentation FaxMessage EnglishLanguage "Instances of &%FaxMessage
are &%Documents that &%result from the transmission of information via
a &%FaxMachine, or technology that emulates a &%FaxMachine, such as a
personal computer running FAX software and connected to a video
monitor or printer.")

(=>
  (instance ?ACT Fax)
  (exists (?MSG)
    (and
      (instance ?MSG FaxMessage)
      (result ?ACT ?MSG))))

(documentation EmailMessage EnglishLanguage "Instances of
&%EmailMessage are &%Documents that are intended to be transmitted via
electronic mail technology, and that conform to the required textual
format of such messages.")
(subclass EmailMessage Correspondence)

(subclass HardcopyDocument VisualContentBearingObject)
(subclass HardcopyDocument DataDisplayDevice)
(subclass HardcopyDocument DataStorageDevice)
(subclass HardocpyDocument Document)
(documentation HardcopyDocument EnglishLanguage "An
&%instance of &%HardcopyDocument is a tangible (solid,
touchable) &%Document, which typically has a number of
printed sheets as &%components.")

(=>
  (instance ?OBJ HardcopyDocument)
  (attribute ?OBJ Solid))

(=>
  (instance ?BOOK HardcopyDocument)
  (exists (?SHEET)
    (and
      (component ?SHEET ?BOOK)
      (instance ?SHEET PrintedSheet))))

;;(subclass Book Document)

;; In a collection of articles, each article *is* a chapter.

;; TO DO:
;;
;;   JoinedPaperSheets
;;   BookCover
;;   Ink (marking substance)

(documentation PrintedSheet EnglishLanguage "An &%instance
of &%PrintedSheet is a piece of flat material such as paper,
vellum, or plastic on which some &%Image or
&%LinguisticExpression has been written, printed, embossed,
or otherwise deposited.")

;; TO DO: Generalize (subclass PrintedSheet Paper) to a
;; proper treatment of something like *WritingSurface.

(subclass PrintedSheet VisualContentBearingObject)
(subclass PrintedSheet DataDisplayDevice)
(subclass PrintedSheet DataStorageDevice)

(=>
  (instance ?OBJ PrintedSheet)
  (structure ?OBJ Flat))

(subclass PrintedBook HardcopyDocument)
(subclass PrintedBook Book)
(documentation PrintedBook EnglishLanguage "An &%instance of
&%PrintedBook is a &%Book manifest as a
&%HardcopyDocument.")

(=>
  (instance ?BOOK PrintedBook)
  (exists (?SHEET1 ?SHEET2)
    (and
      (component ?SHEET1 ?BOOK)
      (component ?SHEET2 ?BOOK)
      (instance ?SHEET1 PrintedSheet)
      (instance ?SHEET2 PrintedSheet)
      (not (equal ?SHEET1 ?SHEET2)))))

(subclass Blackboard DataDisplayDevice)
(subclass Blackboard DataStorageDevice)
(subclass Blackboard DisplayArtifact)

(=>
  (instance ?OBJ Blackboard)
  (structure ?OBJ Flat))

(=>
  (instance ?OBJ Blackboard)
  (color ?OBJ Black))

(documentation Poster EnglishLanguage "An &%instance of &%Poster
is a &%PrintedSheet intended to be posted on a horizontal
surface, so as to make the information it displays visible to
passers by.")
(subclass Poster PrintedSheet)
(subclass Poster DisplayArtifact)

(documentation Transparency EnglishLanguage "An &%instance
of &%Transparency is a transparent sheet through which
images may be transmitted onto a screen by light
projection.")
(subclass Transparency PrintedSheet)

(=>
  (instance ?OBJ Transparency)
  (attribute ?OBJ Transparent))

(documentation OHPTransparency EnglishLanguage "An
&%instance of &%OHPTransparency is a &%Transparency intended
for use with an overhead projector.")
(subclass OHPTransparency Transparency)

(documentation ProjectionSlide EnglishLanguage "An instance
of &%ProjectionSlide is a &%Transparency intended for use
with a slide (not overhead) projector.")
(subclass ProjectionSlide Transparency)

;; TO DO: Relate the subclasses of Transparency to plastic,
;; and to the devices with which instances of Transparency
;; typically are used.

(subclass OpticalDisc AudioVisualDataStorageDevice)
(documentation OpticalDisc EnglishLanguage "This &%Class comprises
several &%subclasses of disc-shaped data storage devices.  Unless
otherwise indicated, &%instances of all of these classes are generally
consist of plastic discs incorporating one or more reflective layers
of gold or aluminum, which is pitted by a laser to encode data.")

(=>
  (instance ?OBJ OpticalDisc)
  (structure ?OBJ Flat))

(=>
  (instance ?OBJ OpticalDisc)
  (material Plastic ?OBJ))

(=>
  (instance ?OBJ OpticalDisc)
  (or
    (material Gold ?OBJ)
    (material Aluminum ?OBJ)))

(documentation CompactDisc EnglishLanguage "An &%instance of
&%CompactDisc is a flat, disc-shaped &%DigitalDataStorageDevice
that has a reflective medium on at least one side, in which a
laser is used to write and read bits of data.")
(subclass CompactDisc DigitalDataStorageDevice)
(subclass CompactDisc OpticalDisc)

(=>
  (and
    (instance ?OBJ CompactDisc)
    (or
      (top ?FACE ?OBJ)
      (bottom ?FACE ?OBJ)))
  (diameter ?FACE (MeasureFn 120 Millimeter)))

(subclass AudioCDSystem MediaSystem)
(documentation AudioCDSystem EnglishLanguage "&%AudioCDSystem is a type of &%MediaSystem that
plays &%AudioRecording")
(termFormat EnglishLanguage AudioCDSystem "cd player")

(=>
  (instance ?PLAYER AudioCDSystem)
  (hasPurpose ?PLAYER
    (exists (?DISC ?AUDIO ?RS ?DIGITAL ?PROC)
      (and
        (instrument ?PROC ?PLAYER)
        (patient ?PROC ?DISC)
        (instance ?DISC CompactDisc)
        (instance ?AUDIO AudioRecording)
        (represents ?DIGITAL ?AUDIO)
        (part ?DIGITAL ?DISC)
        (instance ?RS RadiatingSound)
        (subProcess ?RS ?PROC)
        (instrument ?RS ?PLAYER)
        (patient ?RS ?DISC)))))
  
  
(documentation CDROM EnglishLanguage "An &%instance of
&%CDROM is a &%CompactDisc in the CompactDisc-ReadOnlyMemory
(CD-ROM) format, which allows no modification of data after
it has been written.")
(subclass CDROM CompactDisc)

(documentation Minidisc EnglishLanguage "An &%instance of
&%Minidisc is a disc-shaped &%DigitalDataStorageDevice
smaller than a standard-size &%CompactDisc, but employing
the same technology.")
(subclass Minidisc DigitalDataStorageDevice)
(subclass Minidisc OpticalDisc)

(=>
  (and
    (instance ?OBJ Minidisc)
    (or
      (top ?FACE ?OBJ)
      (bottom ?FACE ?OBJ)))
  (diameter ?FACE (MeasureFn 80 Millimeter)))

(documentation DVD EnglishLanguage "An &%instance of &%DVD
(Digital Versatile Disk) is a disc-shaped
&%DigitalDataStorageDevice similar to a &%CompactDisc, but
with a larger storage capacity.")
(subclass DVD DigitalDataStorageDevice)
(subclass DVD OpticalDisc)

(=>
  (and
    (instance ?OBJ DVD)
    (or
      (top ?FACE ?OBJ)
      (bottom ?FACE ?OBJ)))
  (diameter ?FACE (MeasureFn 120 Millimeter)))

(subclass DVDSystem MediaSystem)
(documentation DVDSystem EnglishLanguage "&%DVDSystem is a type of &%MediaSystem
that is able to play the contents of &%VideoRecording and &%AudioRecording stored
in a &%DVD")
(termFormat EnglishLanguage DVDSystem "dvd player")

(=>
  (instance ?X DVDSystem)
  (hasPurpose ?X
    (exists (?DVD ?PROC)
      (and
        (instance ?DVD DVD)
        (instrument ?PROC ?X)
        (patient ?PROC ?DVD)
        (or
          (exists (?VIDEO ?DVIDEO ?RL)
            (and
              (instance ?VIDEO VideoRecording)
              (represents ?DVIDEO ?VIDEO)
              (part ?DVIDEO ?DVD)
              (instance ?RL RadiatingLight)
              (subProcess ?RL ?PROC)
              (instrument ?RL ?X)
              (patient ?RL ?VIDEO)))
          (exists (?AUDIO ?DAUDIO ?RS)
            (and        
              (instance ?AUDIO AudioRecording)
              (represents ?DAUDIO ?AUDIO)
              (part ?DAUDIO ?DVD)
              (instance ?RS RadiatingSound)
              (subProcess ?RS ?PROC)
              (instrument ?RS ?X)
              (patient ?RS ?AUDIO))))))))  
  
(subclass TapeCassette ElectronicDataStorageDevice)
(documentation TapeCassette EnglishLanguage "An &%instance
of &%TapeCassette is an &%ElectronicDataStorageDevice
consisting of some length of &%RecordingTape enclosed in a
protective plastic case.")

(=>
  (instance ?OBJ TapeCassette)
  (exists (?TAPE)
    (and
      (instance ?TAPE RecordingTape)
      (component ?TAPE ?OBJ))))

(documentation DigitalAudioTapeCassette EnglishLanguage "An
&%instance of &%DigitalAudioTapeCassette (DAT) is a
&%DigitalDataStorageDevice consisting of &%RecordingTape
enclosed in a plastic case, intended primarily for storing
sound (audio) data in some digital encoding.")
(subclass DigitalAudioTapeCassette DigitalDataStorageDevice)
(subclass DigitalAudioTapeCassette AudioDataStorageDevice)
(subclass DigitalAudioTapeCassette TapeCassette)

(subclass RecordingTape ElectronicDataStorageDevice)
(documentation RecordingTape EnglishLanguage "An &%instance
of &%RecordingTape is length of magnetic tape used to store
data encoded in some electronic (digital or analog)
encoding.")

(subclass TapeRecorder AudioRecorder)
(documentation TapeRecorder EnglishLanguage "&%TapeRecorder is a type of &%AudioRecorder
that stores the recorded &%AudioRecording on a &%RecordingTape")
(termFormat EnglishLanguage TapeRecorder "tape recorder")

(=>
  (instance ?X TapeRecorder)
  (hasPurpose ?X
    (exists (?AUDIO ?TAPE ?PROC)
      (and
        (instance ?PROC IntentionalProcess)
        (instrument ?PROC ?X)
        (result ?PROC ?AUDIO)
        (instance ?AUDIO AudioRecording)
        (instance ?TAPE RecordingTape)
        (holdsDuring ?PROC
          (connected ?TAPE ?X))
        (before 
          (BeginFn (WhenFn ?PROC))
          (BeginFn (WhenFn (part ?AUDIO ?TAPE))))))))


(documentation AudioCassette EnglishLanguage "An &%instance
of &%AudioCassette is a tape cassette intended primarily for
storing audio (sound) data encoded in some electronic
format.")
(subclass AudioCassette TapeCassette)
(subclass AudioCassette AudioDataStorageDevice)

;; (subclass Audiocassette AudioCreation) This doesn't really
;; make sense.  What we want to say is that an AudioCassette is
;; used to store data that can be converted into sound.  Note,
;; too, that a new AudioCassette will be blank, which makes it no
;; less an AudioCassette, but not a Creation.

(documentation VideoCassette EnglishLanguage "An &%instance
of &%VideoCassette is a &%TapeCassette designed for the
storage of recorded audio-visual data in some electronic
encoding.")
(subclass VideoCassette TapeCassette)
(subclass AudioCassette AudioVisualDataStorageDevice)

(documentation VHSCassette EnglishLanguage "An &%instance of
&%VHSCassette is a &%VideoCassette in which data is encoded
in the VHS format.")

;; TO DO: Treat encoding schemes separately, as Abstract
;; entities (patterns).

(subclass VHSCassette VideoCassette)

(subclass VCRSystem MediaSystem)
(documentation VCRSystem EnglishLanguage "&%VCRSystem is a type of &%MediaSystem that
can play &%AudioRecording and &%VideoRecording that is stored in a &%VHS")
(termFormat EnglishLanguage VCRSystem "vcr system")

(=>
  (instance ?VCR VCRSystem)
  (hasPurpose ?VCR
    (exists (?VHS ?PROC ?VIDEO ?AVIDEO ?RL ?AUDIO ?AAUDIO ?RS)
      (and
        (instance ?VHS VHSCassette)
        (instrument ?PROC ?VCR)
        (patient ?PROC ?VHS)
        (instance ?VIDEO VideoRecording)
        (represents ?AVIDEO ?VIDEO)
        (part ?VIDEO ?VHS)
        (instance ?AUDIO AudioRecording)
        (represents ?AAUDIO ?AUDIO)
        (part ?AAUDIO ?AVIDEO)
        (part ?AUDIO ?VHS)
        (instance ?RL RadiatingLight)
        (patient ?RL ?VIDEO)
        (subProcess ?RL ?PROC)
        (instance ?RS RadiatingSound)
        (patient ?RS ?AUDIO)
        (subProcess ?RS ?PROC)))))


(documentation MultimediaFile EnglishLanguage "An &%instance of
&%MultimediaFile is a &%ComputerFile that can contain (encode)
multimedia content: images, text, and/or sound.")

(subclass MultimediaFile ComputerFile)
;; It's not clear if MultimediaFile should be a subclass of ImageFile,
;; since all multimedia encoding schemes can be used to encode just
;; image data.

;; TO DO: See the previous TO DO.  Tease apart file content and file
;; encoding format.

(documentation MUSFile EnglishLanguage "An &%instance of &%MUSFile is
a &%ComputerFile produced by the Finale system.")

(subclass MUSFile MultimediaFile)

(subclass ImageFile ComputerFile)

(documentation JPGFile EnglishLanguage "An &%instance of &%JPGFile is
an &%ImageFile encoded in JPG (JPEG) format.")
(subclass JPGFile ImageFile)

(documentation PDFFile EnglishLanguage "An &%instance of &%PDFFile is
an &%ImageFile encoded in PDF (Portable Document Format) format.")
(subclass PDFFile ImageFile)

(documentation DOCFile EnglishLanguage "An &%instance of &%DOCFile is
an &%ImageFile encoded in .doc format (e.g., a Microsoft Word file).")
(subclass DOCFile ImageFile)

(documentation EBookFile EnglishLanguage "An &%instance of &%EBookFile
is an &%ImageFile encoded in eBook format, for rendering by an eBook
reading device.")
(subclass EBookFile ImageFile)

;; "EBook"
;; "EBookRelease"

(documentation DigitalSignature EnglishLanguage "An &%instance of
&%DigitalSignature is an &%ImageFile that encodes an &%Image (picture)
of a person's signature (hand-written legal name).")
(subclass DigitalSignature ImageFile)

(subclass AudioFile ComputerFile)
;; This is not exactly right, but connects the two concepts for now:
(subclass AudioFile AudioRecording)

;; TO DO: Remove (subclass AudioRecording Text) from
;; Mid-level-ontology.kif, since an AudioRecording might encode
;; bird songs, volcanic eruptions, traffic noises, or other
;; non-linguistic sounds.

(documentation AudioVisualFile EnglishLanguage "An &%instance of
&%AudioVisualFile is a &%ComputerFile that can contain information
intended to be rendered as sounds for visual images.")
(subclass AudioVisualFile ImageFile)
(subclass AudioVisualFile AudioFile)
(subclass AudioVisualFile MultimediaFile)

(documentation XMLFile EnglishLanguage "An &%instance of &%XMLFile is
a &%ComputerFile that contains data marked up (formatted) in the
eXtensible Markup Language format.")
(subclass XMLFile ComputerFile)

(documentation WebPage EnglishLanguage "An &%instance of
&%WebPage is a chunk of &%DigitalData typically
displayed (metaphorically) as one <quote>page</quote> by a web
browser.  Note that a &%WebPage might be dynamically generated,
might include data assembled from many different files or storage
media (e.g., databases), and so might not exist as a unitary
&%ComputerFile.")
(subclass WebPage DigitalData)

;; TO DO: Tease apart WebPage, HTMLFile, HTML as a markup scheme (text
;; encoding pattern), HTTP as a transport protocol (data encapsulation
;; pattern).

(documentation WebSite EnglishLanguage "An &%instance of
&%WebSite is a body of &%ComputerData that can be accessed at a
specific virtual location identified by a
&%UniformResourceLocator and rendered as &%WebPages by a web
browser.")
(subclass WebSite DigitalData)
(=>
  (instance ?SITE WebSite)
  (exists (?PAGE)
    (and
      (instance ?PAGE WebPage)
      (component ?PAGE ?SITE))))

(documentation SoftwareFile EnglishLanguage "An &%instance of
&%SoftwareFile is a &%ComputerFile that contains information
(&%containsInformation) which constitutes (instantiates) a
&%ComputerProgram.")
(subclass SoftwareFile ComputerFile)

(=>
  (instance ?SOFTWARE SoftwareSystem)
  (exists (?FILE)
    (and
      (instance ?FILE SoftwareFile)
      (component ?FILE ?SOFTWARE))))

;; Every software file contains information about at least part of
;; some computer program.  Note that ?PROGRAM could be equal to
;; ?SUBPROGRAM -- &%subsumesContentInstance is reflexive -- in which
;; case ?FILE would contain as information the entire program.  Note,
;; too, that ?FILE could be a source (uncompiled) file or an
;; executable (compiled) file.  &%SoftwareFile currently covers both.
(=>
  (instance ?FILE SoftwareFile)
  (exists (?PROGRAM ?SUBPROGRAM)
    (and
      (instance ?PROGRAM ComputerProgram)
      (subsumesContentInstance ?PROGRAM ?SUBPROGRAM)
      (containsInformation ?FILE ?SUBPROGRAM))))

(subclass MacOS OperatingSystem)
(documentation MacOS EnglishLanguage "A &%Class, the &%subclasses of
which are the different types of the &%OperatingSystems developed by
Apple Computer to run its Macintosh line of &%Computers.")

(subclass MicrosoftWindows OperatingSystem)
(documentation MicrosoftWindows EnglishLanguage "A &%Class, the &%subclasses
of which are the different types of the related &%OperatingSystems
developed by Microsoft Corporation to run &%Computers.")

(subclass SymbianOS OperatingSystem)
(documentation SymbianOS EnglishLanguage "A &%Class, the &%subclasses
of which are the different types of &%OperatingSystems developed by
Symbian, Ltd., to run a variety of mobile devices such as
&%MobileCellPhones.")

;; KJN: Moving this to MILO as Telephone and telephoneNumber is defined there.
;;(documentation FixedPhone EnglishLanguage "An &%instance of
;;&%FixedPhone is a &%Telephone that must be connected to the telephone
;;network via a cord.")
;;(subclass FixedPhone Telephone)

;;(subclass MobileCellPhone ReceiverDevice)
;;(subclass MobileCellPhone Telephone)
;;(documentation MobileCellPhone EnglishLanguage "A &%MobileCellPhone
;;is a &%Telephone that connects to the telephone network by
;;sending and receiving radio transmissions, rather than via a
;;cord, and so is portable.")

;; KJN: Moving this to MILO as FaxMachine is defined there.
;;(subclass FaxMachine ElectricDevice)
;;(subclass FaxMachine CommunicationDevice)
;; TO DO: Relate FaxMachine to telephony.

(documentation UnicodeString EnglishLanguage "An &%instance of
&%UnicodeString is a &%SymbolicString that contains Unicode character
encodings, typically decimal or hexadecimal XML/HTML character
entities.")
(subclass UnicodeString SymbolicString)

;; (En)coding schemes
;; "AAC"
;; "ADPCM" (Adaptive Differential Pulse Code Modulation)
;; "ASCII" (American Standard Code for Information Interchange), character encoding
;; "DateTime"
;; HTML
;; "AVC" (Advanced Video Coding)
;; "AudioCodec"
;; "AudioCodecType"
;; "Codec"
;; MIDI (Musical Instrument Digital Interface, a protocol)
;; "DigitalManifestation"
;; "DigitalProduct"
;; "DigitalText"
;; "FileFormat"
;; "FileFormatName"
;; "GIF"
;; VideoCodec
;; H-261
;; H-263
;; MPEG-1
;; MPEG-2
;; MPEG-4
;; IPTV (Internet Protocol Television)
;; "ImageCodec"
;; "ImageCodecType"
;; "JPEG"
;; "JPEG2000"
;; "MD4"
;; "MD5"
;; "MP2"
;; "MP3"
;; "PCM"
;; "PDF"
;; "PNG"
;; "Vorbis"
;; WMA (Windows Media Audio)
;; WMV (Windows Media Video)
;; QuickTime
;; RealVideo
;; "SHA"
;; "SHA1"

;; Namespaces

;; Data Frameworks

;; "FixedImage"
;; "FrontCoverImage"
;; "Flag"
;; "Format"
;; "Fragment"
;; "FragmentDescription"
;; "Icon"
;; "IconRelease"
;; "LexicalCreation"
;; "LexicalManifestation"
;; "LexicalWork"


;;;;;;;;;;;;;;;;;;;;;;
;; End: Media Types ;;
;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Start: Organizations, Persons, Roles (Types) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; KJN: Moving Business to Merge.kif as it seems to be a very basic notion -- a CommercialAgent
;; that is also an Organization. 
;;(subclass Business CommercialAgent)
;;(subclass Business Organization)
;;(documentation Business EnglishLanguage "An &%instance of
;;&%Business is an &%Organization that is a &%CommercialAgent.")

;; KJN: Moving to MILO when applicable.
;;(subclass Agency Business)
;;(subclass Corporation Business)
;;(subclass EntertainmentCompany Business)
;;(subclass FinancialCompany Business)

;; KJN: Deleting this statement. See Hotel.kif.
;;(subclass Hotel Business)

;; KJN: Moving to MILO when applicable.
;;(subclass InsuranceCompany Business)
;;(subclass Partnership Business)
;;(subclass Proprietorship Business)
;;(subclass Publisher Business)
;;(subclass Restaurant Business)
;;(subclass TransportationCompany Business)

;;(subclass RetailStore Business)

;; vcvp suggests calling it BookStore 
;;(subclass BookSeller RetailStore)
(subclass BookStore RetailStore)

;; KJN: Moving to MILO
;;(subclass Publisher Manufacturer)
;; By analogy with (subclass Publication Manufacture)

(subclass RecordingCompany Publisher)
(documentation RecordingCompany EnglishLanguage "An &%instance of
&%RecordingCompany is a &%Business that makes sound recordings
for commercial release.")

;; TO DO: Change the documentation statements for Publication and
;; Publisher to refer to ContentBearingObject rather than Text,
;; since sound recordings are also published.

(subclass BookPublisher Publisher)
(documentation BookPublisher EnglishLanguage "An &%instance of
&%BookPublisher is a &%Publisher of &%Books.")

(subclass FuneralArranger Business)
(documentation FuneralArranger EnglishLanguage "An &%instance of
&%FuneralArranger is a &%Business that enbalms dead &%Human
bodies and conducts &%Funerals.")

(subclass Crematorium Business)
(documentation Crematorium EnglishLanguage "An &%instance of
&%Crematorium is a &%Business that incinerates corpses, reducing
them to ashes.")

(subclass CopyrightAuthority Organization)
(documentation CopyrightAuthority EnglishLanguage "An &%instance
of &%CopyrightAuthority is an &%Organization with whom a creative
work may or must be registered for the purpose of establishing
copyright.")

(instance Artist EntertainmentProfession)
(documentation Artist EnglishLanguage "This &%RelationalAttribute
describes an &%Agent that contributes to a &%Performance, or to
some form of &%ContentDevelopment that &%results in an
&%ArtWork.")

(=>
  (and
    (agent ?PROCESS ?AGENT)
    (result ?PROCESS ?WORK)
    (instance ?WORK ArtWork))
  (holdsDuring (WhenFn ?PROCESS) 
    (attribute ?AGENT Artist)))

(instance Performer EntertainmentProfession)
(subAttribute Performer Artist)
(documentation Performer EnglishLanguage "This
&%RelationalAttribute describes an &%agent of a &%Performance.")

(=>
  (and
    (instance ?P Performance)
    (agent ?P ?A))
  (holdsDuring (WhenFn ?P) (attribute ?A Performer)))

(instance Actor EntertainmentProfession)
(documentation Actor EnglishLanguage "This &%RelationalAttribute
describes an &%agent of a &%DramaticPerformance.")
(subAttribute Actor Performer)

(=>
  (and
    (instance ?P DramaticPerformance)
    (agent ?P ?A))
  (holdsDuring (WhenFn ?P) (attribute ?A Actor)))

(=>
  (and
    (instance ?GROUP DramaticCast)
    (holdsDuring ?T1 (member ?MEM ?GROUP)))
  (holdsDuring ?T1 (attribute ?MEM Actor)))

(=>
  (and
    (holdsDuring ?T1 (member ?OBJ ?GROUP))
    (instance ?OBJ Human)
    (instance ?GROUP GroupOfPeople))
  (holdsDuring ?T1 (groupMember ?OBJ ?GROUP)))

;; NS: Singing has not been connected to VocalMusic.
;; MusicalPerformance has not be connected to Music.

;;(subclass Singing VocalMusic)
;; NS: Let's define Singing to be a "single agent" process type.
;; Therefore, every instance of Singing is also an instance of
;; VocalMusic.  But a single instance of VocalMusic might consist
;; of multiple Singing subProcesses, which are coordinated to
;; produce Music that conforms to (realizes) some specification
;; (text, or perhaps simply the maintenance of harmony in the
;; case of improvisation).

(=>
  (and
    (instance ?GROUP MusicalGroup)
    (holdsDuring ?T1 (member ?MEM ?GROUP)))
  (holdsDuring ?T1 (attribute ?MEM Musician)))

(subclass Choir MusicalGroup)
(documentation Choir EnglishLanguage "A &%Choir is a
&%MusicalGroup that performs &%VocalMusic.")

;; NS: Music performed by a Choir is VocalMusic.
(=>
  (and
    (instance ?GROUP Choir)
    (agent ?MUSIC ?GROUP)
    (instance ?MUSIC MakingMusic))
  (instance ?MUSIC MakingVocalMusic))

;; NS: An instance of VocalMusic includes at least one Singing
;; subProcess.
;; KJN: Deleting this as this is not necessarily true.
;;(=>
;;  (instance ?MUSIC VocalMusic)
;;  (exists (?SING)
;;    (and
;;      (instance ?SING Singing)
;;      (subProcess ?SING ?MUSIC))))

;; NS: An instance of VocalMusic performed by a Choir includes at
;; least one Singing subProcess performed by each member of the
;; Choir.
(=>
  (and
    (instance ?MUSIC MakingVocalMusic)
    (agent ?MUSIC ?GROUP)
    (instance ?GROUP Choir)
    (holdsDuring ?MUSIC (member ?MEM ?GROUP)))
  (exists (?SING)
    (and
      (instance ?SING Singing)
      (subProcess ?SING ?MUSIC)
      (agent ?SING ?MEM))))

(=>
  (instance ?PERF MusicalPerformance)
  (exists (?MUSIC)
    (and
      (instance ?MUSIC MakingMusic)
      (subProcess ?MUSIC ?PERF))))

(instance states BinaryPredicate)
(instance states AsymmetricRelation)
(domain states 1 CognitiveAgent)
(domain states 2 Sentence)
(documentation states EnglishLanguage "(&%holdsDuring
?T1 (&%states ?AGENT ?SENTENCE)) means that at time ?T1, ?AGENT
is the &%agent of a &%LinguisticCommunication in which the
&%patient is ?SENTENCE.  Note that ?SENTENCE could be a
&%Formula.")

(=>
  (and
    (instance ?COMM LinguisticCommunication)
    (agent ?COMM ?AGENT)
    (patient ?COMM ?SENTENCE)
    (instance ?SENTENCE Sentence))
  (holdsDuring (WhenFn ?COMM) (states ?AGENT ?SENTENCE)))

(=>
  (holdsDuring ?T1 (states ?AGENT ?SENTENCE))
  (exists (?COMM)
    (and
      (instance ?COMM LinguisticCommunication)
      (agent ?COMM ?AGENT)
      (patient ?COMM ?SENTENCE)
      (temporalPart ?T1 (WhenFn ?COMM)))))

(instance composer BinaryPredicate)
(instance composer AsymmetricRelation)
(domain composer 1 Agent)
(domainSubclass composer 2 MusicalComposition)
(subrelation composer authors)
(documentation composer EnglishLanguage "(&%composer ?AGENT
?COMPCLASS) means that ?AGENT wrote (created the propositional
content) expressed in all instances of the subclass of
&%MusicalComposition ?COMPCLASS.")

(=>
  (and
    (authors ?AGENT ?CLASS)
    (subclass ?CLASS MusicalComposition))
  (composer ?AGENT ?CLASS))

;; KJN: Removing this as it is already defined in Mid-level-ontology.kif
;;(subclass MusicalConducting Directing)
;;(documentation MusicalConducting EnglishLanguage "The
;;&%Process of &%Directing a &%MusicalPerformance.")

(instance MusicalConductor EntertainmentProfession)
(documentation MusicalConductor EnglishLanguage "The
&%RelationalAttribute &%MusicalConductor describes the &%agent of
a &%MusicalConducting process.")

(=>
  (and
    (instance ?CONDUCT MusicalConducting)
    (agent ?CONDUCT ?AGENT))
  (holdsDuring (WhenFn ?CONDUCT) (attribute ?AGENT MusicalConductor)))

(=>
  (holdsDuring ?T1 (attribute ?AGENT MusicalConductor))
  (exists (?CONDUCT)
    (and
      (instance ?CONDUCT MusicalConducting)
      (agent ?CONDUCT ?AGENT)
      (not (earlier ?T1 (WhenFn ?CONDUCT))))))

;; NS: Missing from naics.kif:
(=>
  (and
    (instance ?ATTR IndustryAttribute)
    (attribute ?OBJ ?ATTR))
  (instance ?OBJ Organization))

(=>
  (and
    (holdsDuring ?T1 (publishes ?AGENT ?COMPCLASS))
    (subclass ?COMPCLASS MusicalComposition))
  (holdsDuring ?T1 (attribute ?AGENT MusicPublishers)))

(=>
  (and
    (holdsDuring ?T1 (publishes ?AGENT ?COMPCLASS))
    (subclass ?COMPCLASS Text))
  (holdsDuring ?T1 (attribute ?AGENT InformationIndustries)))

(=>
  (and
    (holdsDuring ?T1 (publishes ?AGENT ?COMPCLASS))
    (subclass ?COMPCLASS Book))
  (holdsDuring ?T1 (attribute ?AGENT BookPublishers)))

(=>
  (and
    (holdsDuring ?T1 (publishes ?AGENT ?COMPCLASS))
    (subclass ?COMPCLASS Periodical))
  (holdsDuring ?T1 (attribute ?AGENT PeriodicalPublishers)))

(=>
  (and
    (holdsDuring ?T1 (publishes ?AGENT ?COMPCLASS))
    (subclass ?COMPCLASS Newspaper))
  (holdsDuring ?T1 (attribute ?AGENT NewspaperPublishers)))

(instance JesusOfNazareth Man)
(instance JesusOfNazareth ReligiousJew)
(holdsDuring (WhenFn JesusOfNazareth) (located JesusOfNazareth Palestine))
;; NS: TO DO: Temporally and spatially relate &%Palestine to &%Israel.

(documentation JesusOfNazareth EnglishLanguage "&%JesusOfNazareth
is the central figure of &%Christianity, revered by most
&%Christians as the incarnation of God, and also is an important
figure in several other religions.  See the article on <a
href=http://en.wikipedia.org/wiki/Jesus>Jesus</a> in <a
href=http://www.wikipedia.org/>Wikipedia</a>.")

(givenName "Jesus" JesusOfNazareth)
(givenName "Yehoshua" JesusOfNazareth)
;; Hebrew.
(givenName "Yeshua" JesusOfNazareth)
;; Aramaic.

(=>
  (and
    (birthdate JesusOfNazareth ?DAY)
    (instance ?Y1 (YearFn -6))
    (instance ?Y2 (YearFn 4)))
  (temporalPart ?DAY (TimeIntervalFn (BeginFn ?Y1) (EndFn ?Y2))))

(=>
  (and
    (deathdate JesusOfNazareth ?DAY)
    (instance ?Y1 (YearFn 29))
    (instance ?Y2 (YearFn 36)))
  (temporalPart ?DAY (TimeIntervalFn (BeginFn ?Y1) (EndFn ?Y2))))

(instance TwelveApostles GroupOfPeople)
(documentation TwelveApostles EnglishLanguage "The
&%TwelveApostles is the group of 12 core disciples of
&%JesusOfNazareth who knew him during his lifetime, as described
in the &%ChristianGospels and the Acts of the Apostles.
According to the gospel accounts, Judas Iscariot betrays Jesus
and then leaves the group, but later is replaced by Matthias,
restoring the group's number to 12.")

(=>
  (and
    (instance ?T1 (YearFn 26))
    (instance ?T2 (YearFn 100)))
  (temporalPart (WhenFn TwelveApostles) (TimeIntervalFn (BeginFn ?T1) (EndFn ?T2))))

(greaterThanOrEqualTo (CardinalityFn TwelveApostles) 11)
(lessThanOrEqualTo (CardinalityFn TwelveApostles) 12)
;; Matthias replaced Judas before Pentecost, restoring the number
;; to 12.

(exists (?TIME)
  (and
    (instance ?TIME TimeInterval)
    (finishes ?TIME (WhenFn JesusOfNazareth))
    (starts ?TIME (WhenFn TwelveApostles))
    (forall (?MEM)
      (=>
        (holdsDuring ?TIME (member ?MEM TwelveApostles))
        (holdsDuring ?TIME (friend ?MEM JesusOfNazareth))))))
;; NS: This isn't quite right.  &%friend doesn't capture the
;; notion of discipleship.  I'll fix it later.

(subclass Angel Deity)
(documentation Angel EnglishLanguage "In the mythologies of the
world's major monotheistic religions -- &%Judaism,
&%Christianity, and &%Islam -- &%Angels are portrayed as a
&%Class of beings that fall somewhere between &%Humans and &%God
on the scale of divinity.  &%Humans typically encounter &%Angels
when the latter are acting as messengers (&%GreekLanguage
singular: angelos) or intermediaries for &%God.  Such encounters
often are described as occurring in dreams, or in trance
experiences.")

(instance NativityMagi GroupOfPeople)
(documentation NativityMagi EnglishLanguage "In the
&%ChristianGospel of Matthew, the &%NativityMagi are Zoroastrian
astrologers (&%GreekLanguage singular: magos) who visit the
infant &%JesusOfNazareth, bringing him symbolic gifts of gold,
frankincense, and myrrh.  Matthew does not mention the number of
magi, but later tradition has assumed three, based on the number
of gifts described.  See the article <a
href=http://en.wikipedia.org/wiki/Biblical_Magi>Biblical Magi</a>
in <a href=http://www.wikipedia.org/>Wikipedia</a>.")
(equal (CardinalityFn NativityMagi) 3)

;; Adapter
;; Arranger
;; AssociatedPerformer
;; Consumer
;; ContactPerson
;; Contributor
;; Creator
;; Licensor
;; Lyricist
;; MainArtist
;; Maker
;; PhysicalMediaWriter
;; PolicyMaker
;; Producer
;; ReleaseCreator
;; RightsAdministrator
;; RightsHolder
;; RoyaltyAdministrator
;; Soloist
;; SubArranger
;; Translator

;; CoCreator
;; Contributor
;; Creator
;; DataAdministator
;; DataCreator
;; Deriver
;; Licensee
;; Licensor
;; Maker
;; Martyrs
;; Messiah
;; SonOfGod
;; Performer
;; PolicyMaker
;; Provider
;; Providee
;; DSP (Digital Service Provider)
;; RightsDelegate
;; RightsDelegator
;; RoyaltyAdministrator
;; RoyaltyRecipient
;; Sender
;; SongSelectCustomer
;; Translator
;; "DesignatedDsrMessageRecipient"
;; "DisplayArtist"
;; "DisplayArtistName"


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End: Organizations, Persons, Roles (Types) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Start: cardinality and other constraints ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(documentation exactCardinality EnglishLanguage "This
relation expresses the number of values that a particular
argument to a relation can have if all other values remain
fixed.")
(instance exactCardinality TernaryPredicate)
(domain exactCardinality 1 Relation)
(domain exactCardinality 2 Integer)
(domain exactCardinality 3 Integer)

;; The axiom below only covers the case of exact cardinality = 1.
;; [1]
(=>
   (exactCardinality ?REL ?ARG 1)
   (exists (?X @ARGS)
     (and
       (?REL @ARGS)
       (equal ?X
         (ListOrderFn (ListFn @ARGS) ?ARG))
       (not
         (exists (?Y)
           (and
             (equal ?Y
               (ListOrderFn (ListFn @ARGS) ?ARG))
             (not
               (equal ?X ?Y))))))))

;; [2] A simpler version of the axiom above.
(=>
 (and
   (exactCardinality ?REL ?ARG 1)
   (?REL @ARGS)
   (equal ?X (ListOrderFn (ListFn @ARGS) ?ARG)))
 (not
   (exists (?Y)
     (and
       (equal ?Y (ListOrderFn (ListFn @ARGS) ?ARG))
       (not (equal ?X ?Y))))))

;; [3] A still simpler version.
(=>
 (and
   (exactCardinality ?REL ?ARG 1)
   (?REL @ARGS)
   (equal ?X (ListOrderFn (ListFn @ARGS) ?ARG))
   (equal ?Y (ListOrderFn (ListFn @ARGS) ?ARG)))
 (equal ?X ?Y))

;; The interpretation of these rules in practice (in a working
;; system) would depend on the meaning of "equal" and whether or
;; not the unique names assumption is built into the prover.

;; [4] A more complete formulation with KappaFn (but second
;; order).
(=>
   (exactCardinality ?REL ?ARG ?COUNT)
   (equal
     (CardinalityFn
       (KappaFn ?EL
         (and
           (?REL @ARGS)
           (equal ?EL
             (ListOrderFn (ListFn @ARGS) ?ARG))))) ?COUNT))

;; [5] A first order version of [4].
(=>
 (exactCardinality ?REL ?ARG ?COUNT)
 (exists (?S)
   (and
     (instance ?S SetOrClass)
     (=>
       (and
         (?REL @ARGS)
         (equal ?EL (ListOrderFn (ListFn @ARGS) ?ARG)))
       (and
         (instance ?EL ?S)
         (equal (CardinalityFn ?S) ?COUNT))))))

(documentation minCardinality EnglishLanguage "This relation
expresses the minimum number of values that a particular argument
to a relation can have if all other values remain fixed.")
(instance minCardinality TernaryPredicate)
(domain minCardinality 1 Relation)
(domain minCardinality 2 Integer)
(domain minCardinality 3 Integer)

;; [6] A version with KappaFn.
(=>
   (minCardinality ?REL ?ARG ?COUNT)
   (greaterThanOrEqualTo
     (CardinalityFn
       (KappaFn ?EL
         (and
           (?REL @ARGS)
           (equal ?EL
             (ListOrderFn (ListFn @ARGS) ?ARG))))) ?COUNT))

;; [7] A first order version of [6], analogous to the first order
;; definition of exactCardinality.
(=>
 (minCardinality ?REL ?ARG ?COUNT)
 (exists (?S)
   (and
     (instance ?S SetOrClass)
     (=>
       (and
         (?REL @ARGS)
         (equal ?EL (ListOrderFn (ListFn @ARGS) ?ARG)))
       (and
         (instance ?EL ?S)
         (greaterThanOrEqualTo (CardinalityFn ?S) ?COUNT))))))

(documentation maxCardinality EnglishLanguage "This relation
expresses the maximum number of values that a particular argument
to a relation can have if all other values remain fixed.")
(instance maxCardinality TernaryPredicate)
(domain maxCardinality 1 Relation)
(domain maxCardinality 2 Integer)
(domain maxCardinality 3 Integer)

;; [8] A definition with KappaFn.
(=>
   (maxCardinality ?REL ?ARG ?COUNT)
   (lessThanOrEqualTo
     (CardinalityFn
       (KappaFn ?EL
         (and
           (?REL @ARGS)
           (equal ?EL
             (ListOrderFn (ListFn @ARGS) ?ARG))))) ?COUNT))

;; [9] A first order version of [8].
(=>
 (maxCardinality ?REL ?ARG ?COUNT)
 (exists (?S)
   (and
     (instance ?S SetOrClass)
     (=>
       (and
         (?REL @ARGS)
         (equal ?EL (ListOrderFn (ListFn @ARGS) ?ARG)))
       (and
         (instance ?EL ?S)
         (lessThanOrEqualTo (CardinalityFn ?S) ?COUNT))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End: cardinality and other constraints ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;
;; Start: code tables ;;
;;;;;;;;;;;;;;;;;;;;;;;;

(subclass CodeMap ClassificationScheme)
(documentation CodeMap EnglishLanguage "An &%instance of
&%CodeMap is a &%ClassificationScheme that specifies
correspondences (typically, one to one or one to many) between
members of a set of tokens (typically, short alphanumeric
&%SymbolicStrings) and other entities.  In most cases, the other
entities will be terms (logical constants) that denote SUMO
concepts.")

(subclass LanguageCodeMap CodeMap)
(documentation LanguageCodeMap EnglishLanguage "An &%instance of
&%LanguageCodeMap is a &%CodeMap that specifies
correspondences (typically, one to one or one to many) between
members of a set of tokens that identifiy languages, and SUMO
terms.")

(subclass CurrencyCodeMap CodeMap)
(documentation CurrencyCodeMap EnglishLanguage "An &%instance of
&%CurrencyCodeMap is a &%CodeMap that specifies
correspondences (typically, one to one or one to many) between
members of a set of tokens that identifiy currencies, and SUMO
terms.")

(subclass GeographicCodeMap CodeMap)
(documentation GeographicCodeMap EnglishLanguage "An &%instance
of &%GeographicCodeMap is a &%CodeMap that specifies
correspondences (typically, one to one or one to many) between
members of a set of tokens that identifiy geographic areas, and
SUMO terms.")

(instance codeMapping TernaryPredicate)
(domain codeMapping 1 CodeMap)
(domain codeMapping 2 SymbolicString)
(domain codeMapping 3 Entity)
(documentation codeMapping EnglishLanguage "(&%codeMapping
?&%CodeMap ?&%SymbolicString ?&%Entity) means that the token
?&%SymbolicString, which is defined or specified in ?&%CodeMap,
corresponds to the SUMO concept denoted by ?&%Entity.")

(=>
  (codeMapping ?MAP ?TOKEN ?X)
  (represents ?TOKEN ?X))

;; ISO 4217

(instance ISO-4217-A CurrencyCodeMap)
(documentation ISO-4217-A EnglishLanguage "This &%CurrencyCodeMap
states correspondences between three-letter alphabetic tokens
defined in the ISO 4217 standard, and constants defined in SUMO.
Note that for most of the alphabetic tokens, ISO 4217 also
defines a corresponding three-digit numeric token with the same
meaning.")

(=>
  (codeMapping ISO-4217-A ?TOKEN ?X)
  (and
    (instance ?X UnitOfMeasure)
    (stringLength 3 ?TOKEN)
    (instance ?TOKEN AlphabeticString)))

;; NS: Restate after clean up of UnitOfMeasure:
;; (=>
;;   (codeMapping ISO-4217-A ?TOKEN ?X)
;;   (subclass ?X CurrencyMeasure))

(codeMapping ISO-4217-A "AUD" AustralianDollar)
(codeMapping ISO-4217-A "BWP" BotswanaPula)
(codeMapping ISO-4217-A "CAD" CanadianDollar)
(codeMapping ISO-4217-A "DKK" DanishKrone)
(codeMapping ISO-4217-A "EUR" EuroDollar)
(codeMapping ISO-4217-A "GBP" BritishPound)
(codeMapping ISO-4217-A "ISK" IcelandicKrona)
(codeMapping ISO-4217-A "LSL" LesothoLoti)
(codeMapping ISO-4217-A "MWK" MalawianKwacha)
(codeMapping ISO-4217-A "NOK" NorwegianKrone)
(codeMapping ISO-4217-A "NZD" NewZealandDollar)
(codeMapping ISO-4217-A "SEK" SwedishKrona)
(codeMapping ISO-4217-A "SZL" SwazilandLilangeni)
(codeMapping ISO-4217-A "USD" UnitedStatesDollar)
(codeMapping ISO-4217-A "ZAR" SouthAfricanRand)
(codeMapping ISO-4217-A "ZMK" ZambianKwacha)
(codeMapping ISO-4217-A "ZWD" ZimbabweanDollar)

(=>
  (codeMapping ISO-4217-A ?TOKEN ?CURRENCY)
  (currencyCode ?TOKEN ?CURRENCY))

(=>
  (currencyCode ?TOKEN ?CURRENCY)
  (codeMapping ISO-4217-A ?TOKEN ?CURRENCY))

;; "CurrencyOfAccounting"

;; (codeMapping ISO-4217-A "ADP") obsolete
(codeMapping ISO-4217-A "AED" UnitedArabEmirateDirham)
(codeMapping ISO-4217-A "AFA" AfghanAfghani)
(codeMapping ISO-4217-A "ALL" AlbanianLek)
(codeMapping ISO-4217-A "AMD" ArmenianDram)
;; (codeMapping ISO-4217-A "ANG" *NetherlandsAntilleanGuilder)
(codeMapping ISO-4217-A "AOA" AngolanKwanza)
;; (codeMapping ISO-4217-A "ARS" *ArgentinePeso)
(codeMapping ISO-4217-A "ATS" AustrianSchilling)
;; (codeMapping ISO-4217-A "AWG" *ArubanGuilder)
(codeMapping ISO-4217-A "AZM" AzerbaijaniManat)
;; (codeMapping ISO-4217-A "BAM" *BosniaAndHerzegovinaMark)
(codeMapping ISO-4217-A "BBD" BarbadosDollar)
(codeMapping ISO-4217-A "BDT" BangladeshiTaka)
(codeMapping ISO-4217-A "BEF" BelgianFranc)
(codeMapping ISO-4217-A "BGN" BulgarianLev)
(codeMapping ISO-4217-A "BHD" BahrainianDinar)
(codeMapping ISO-4217-A "BIF" BurundiFranc)
(codeMapping ISO-4217-A "BMD" BermudaDollar)
(codeMapping ISO-4217-A "BND" BruneiDollar)
(codeMapping ISO-4217-A "BOB" BolivianBoliviano)
;; (codeMapping ISO-4217-A "BOV" *BolivianMvdol)
(codeMapping ISO-4217-A "BRL" BrazilianReal)
(codeMapping ISO-4217-A "BSD" BahamianDollar)
(codeMapping ISO-4217-A "BTN" BhutaneseNgultrum)
(codeMapping ISO-4217-A "BYR" BelarusianRubel)
(codeMapping ISO-4217-A "BZD" BelizeDollar)
(codeMapping ISO-4217-A "CDF" CongoFranc)
(codeMapping ISO-4217-A "CHF" SwissFranc)
(codeMapping ISO-4217-A "CLP" ChileanPeso)
(codeMapping ISO-4217-A "CNY" ChineseYuan)
(codeMapping ISO-4217-A "COP" ColombianPeso)
(codeMapping ISO-4217-A "CRC" CostaRicanColon)
(codeMapping ISO-4217-A "CUP" CubanPeso)
(codeMapping ISO-4217-A "CVE" CapeVerdeEscudo)
(codeMapping ISO-4217-A "CYP" CypriotPound)
(codeMapping ISO-4217-A "CZK" CzechKoruna)
(codeMapping ISO-4217-A "DEM" GermanMark)
(codeMapping ISO-4217-A "DJF" DjiboutiFranc)
(codeMapping ISO-4217-A "DOP" DominicanPeso)
(codeMapping ISO-4217-A "DZD" AlgerianDinar)
(codeMapping ISO-4217-A "EEK" EstonianKroon)
(codeMapping ISO-4217-A "EGP" EgyptianPound)
;; (codeMapping ISO-4217-A "ERN" *EritreanNakfa)
(codeMapping ISO-4217-A "ESP" SpanishPeseta)
(codeMapping ISO-4217-A "ETB" EthiopianBirr)
(codeMapping ISO-4217-A "FIM" FinnishMarkka)
(codeMapping ISO-4217-A "FJD" FijiDollar)
;; (codeMapping ISO-4217-A "FKP" *FalklandIslandsPound)
(codeMapping ISO-4217-A "FRF" FrenchFranc)
(codeMapping ISO-4217-A "GEL" GeorgianLari)
(codeMapping ISO-4217-A "GHC" GhanianCedi)
;; (codeMapping ISO-4217-A "GIP" *GibraltarPound)
(codeMapping ISO-4217-A "GMD" GambianDalasi)
(codeMapping ISO-4217-A "GNF" GuineanFranc)
(codeMapping ISO-4217-A "GRD" GreekDrachma)
(codeMapping ISO-4217-A "GTQ" GuatemalanQuetzal)
;; (codeMapping ISO-4217-A "GWP" *GuineaPeso)
(codeMapping ISO-4217-A "GYD" GuyanaDollar)
(codeMapping ISO-4217-A "HKD" HongKongDollar)
(codeMapping ISO-4217-A "HNL" HonduranLempira)
;; (codeMapping ISO-4217-A "HRK" *CroatianKuna)
(codeMapping ISO-4217-A "HTG" HaitianGourde)
(codeMapping ISO-4217-A "HUF" HungarianForint)
(codeMapping ISO-4217-A "IDR" IndonesianRupiah)
(codeMapping ISO-4217-A "IEP" IrishPound)
(codeMapping ISO-4217-A "ILS" IsraeliShekel)
(codeMapping ISO-4217-A "INR" IndianRupee)
(codeMapping ISO-4217-A "IQD" IraqiDinar)
(codeMapping ISO-4217-A "IRR" IranianRial)
(codeMapping ISO-4217-A "ITL" ItalianLire)
(codeMapping ISO-4217-A "JMD" JamaicanDollar)
(codeMapping ISO-4217-A "JOD" JordanianDinar)
(codeMapping ISO-4217-A "JPY" JapaneseYen)
(codeMapping ISO-4217-A "KES" KenyanShilling)
(codeMapping ISO-4217-A "KGS" KyrgyzstaniSom)
(codeMapping ISO-4217-A "KHR" CambodianRiel)
;; (codeMapping ISO-4217-A "KMF" *ComoroFranc)
(codeMapping ISO-4217-A "KPW" NorthKoreanWon)
(codeMapping ISO-4217-A "KRW" SouthKoreanWon)
(codeMapping ISO-4217-A "KWD" KuwaitiDinar)
(codeMapping ISO-4217-A "KYD" CaymanIslandsDollar)
(codeMapping ISO-4217-A "KZT" KazakhstaniTenge)
(codeMapping ISO-4217-A "LAK" LaotianKip)
(codeMapping ISO-4217-A "LBP" LebanesePound)
(codeMapping ISO-4217-A "LKR" SriLankanRupee)
(codeMapping ISO-4217-A "LRD" LiberianDollar)
(codeMapping ISO-4217-A "LTL" LithuanianLitas)
(codeMapping ISO-4217-A "LUF" LuxembourgFranc)
(codeMapping ISO-4217-A "LVL" LatvianLats)
(codeMapping ISO-4217-A "LYD" LibyanDinar)
(codeMapping ISO-4217-A "MAD" MoroccanDirham)
(codeMapping ISO-4217-A "MDL" MoldovanLeu)
(codeMapping ISO-4217-A "MGF" MadagascarFranc)
;; (codeMapping ISO-4217-A "MKD" *MacedonianDinar)
(codeMapping ISO-4217-A "MMK" MyanmarKyat)
(codeMapping ISO-4217-A "MNT" MongolianTugrik)
(codeMapping ISO-4217-A "MOP" MacaoPataca)
(codeMapping ISO-4217-A "MRO" MauritanianOuguiya)
(codeMapping ISO-4217-A "MTL" MalteseLira)
(codeMapping ISO-4217-A "MUR" MauritianRupee)
;; (codeMapping ISO-4217-A "MVR" *MaldivesRufiyaa)
(codeMapping ISO-4217-A "MXN" MexicanPeso)
(codeMapping ISO-4217-A "MYR" MalaysianRinggit)
(codeMapping ISO-4217-A "MZM" MozambiqueMetical)
;; (codeMapping ISO-4217-A "NAD" *NamibianDollar)
(codeMapping ISO-4217-A "NGN" NigerianNaira)
(codeMapping ISO-4217-A "NIO" NicaraguanCordoba)
(codeMapping ISO-4217-A "NLG" DutchGuilder)
(codeMapping ISO-4217-A "NPR" NepaleseRupee)
(codeMapping ISO-4217-A "OMR" OmaniRiyal)
(codeMapping ISO-4217-A "PAB" PanamanianBalboa)
(codeMapping ISO-4217-A "PEI" PeruvianInti)
;; (codeMapping ISO-4217-A "PEN" *PeruvianNuevoSol)
(codeMapping ISO-4217-A "PGK" PapuanKina)
(codeMapping ISO-4217-A "PHP" PhilippinePeso)
(codeMapping ISO-4217-A "PKR" PakistaniRupee)
(codeMapping ISO-4217-A "PLN" PolishZloty)
(codeMapping ISO-4217-A "PTE" PortugueseEscudo)
(codeMapping ISO-4217-A "PYG" ParaguayanGuarani)
(codeMapping ISO-4217-A "QAR" QatariRiyal)
(codeMapping ISO-4217-A "ROL" RomanianLeu)
(codeMapping ISO-4217-A "RUB" RussianRuble)
(codeMapping ISO-4217-A "RWF" RwandaFranc)
(codeMapping ISO-4217-A "SAR" SaudiArabianRiyal)
;; (codeMapping ISO-4217-A "SBD" *SolomonIslandsDollar)
(codeMapping ISO-4217-A "SCR" SeychellesRupee)
;; (codeMapping ISO-4217-A "SDD" *SudaneseDinar)
(codeMapping ISO-4217-A "SDG" SudanesePound)
(codeMapping ISO-4217-A "SGD" SingaporeDollar)
;; (codeMapping ISO-4217-A "SHP" *SaintHelenaPound)
;; (codeMapping ISO-4217-A "SIT" *SloveniaTolar)
(codeMapping ISO-4217-A "SKK" SlovakianKoruna)
(codeMapping ISO-4217-A "SLL" SierraLeoneLeone)
(codeMapping ISO-4217-A "SOS" SomalianShilling)
;; (codeMapping ISO-4217-A "SRD" *SurinameseDollar)
(codeMapping ISO-4217-A "SRG" SurinameseGuilder)
(codeMapping ISO-4217-A "STD" SaoThomeEPrincipeDobra)
(codeMapping ISO-4217-A "SVC" ElSalvadoranColon)
(codeMapping ISO-4217-A "SYP" SyrianPound)
(codeMapping ISO-4217-A "THB" ThaiBaht)
(codeMapping ISO-4217-A "TJS" TajikSomoni)
(codeMapping ISO-4217-A "TMM" TurkmenManat)
(codeMapping ISO-4217-A "TND" TunisianDinar)
(codeMapping ISO-4217-A "TOP" TonganPaanga)
;; (codeMapping ISO-4217-A "TPE" *PortugueseTimorEscudo)
(codeMapping ISO-4217-A "TRL" TurkishLira)
(codeMapping ISO-4217-A "TTD" TrinidadAndTobagoDollar)
(codeMapping ISO-4217-A "TWD" TaiwanDollar)
(codeMapping ISO-4217-A "TZS" TanzanianShilling)
(codeMapping ISO-4217-A "UAH" UkranianHryvnia)
(codeMapping ISO-4217-A "UGX" UgandanShilling)
(codeMapping ISO-4217-A "UYU" UruguayanPeso)
(codeMapping ISO-4217-A "UZS" UzbekistaniSom)
(codeMapping ISO-4217-A "VEB" VenezuelanBolivar)
(codeMapping ISO-4217-A "VND" VietnameseDong)
;; (codeMapping ISO-4217-A "VUV" *VanuatuVatu)
;; (codeMapping ISO-4217-A "WST" *SamoanTala)
(codeMapping ISO-4217-A "XAF" CameroonFranc)
;; (codeMapping ISO-4217-A "XCD" *EastCaribbeanDollar)
(codeMapping ISO-4217-A "XOF" BeninFranc)
;; (codeMapping ISO-4217-A "XPF" *FrenchPolynesianFranc)
(codeMapping ISO-4217-A "YER" YemeniRial)
(codeMapping ISO-4217-A "YUM" YugoslavianDinar)

;; ISO 3166-1-alpha-2 

;; Serbia
(instance Serbia GeopoliticalArea)
(holdsDuring (FutureFn (DayFn 5 (MonthFn June (YearFn 2006))))
  (instance Serbia IndependentState))
(holdsDuring (FutureFn (DayFn 5 (MonthFn June (YearFn 2006))))
  (instance Serbia EuropeanNation))
(holdsDuring (FutureFn (DayFn 5 (MonthFn June (YearFn 2006))))
  (names "Republic of Serbia" Serbia))
(geographicSubregion Serbia SerbiaAndMontenegro)
(documentation Serbia EnglishLanguage "The Republic of &%Serbia is a
&%Nation that historically formed part of &%Yugoslavia, then part of
&%SerbiaAndMontenegro, and most recently has become an
&%IndependentState after recognizing the secession of &%Montenegro
from &%SerbiaAndMontenegro on 5 &%June 2006.")

;; Montenegro
(instance Montenegro GeopoliticalArea)
(holdsDuring (FutureFn (DayFn 3 (MonthFn June (YearFn 2006))))
  (instance Montenegro IndependentState))
(holdsDuring (FutureFn (DayFn 3 (MonthFn June (YearFn 2006))))
  (instance Montenegro EuropeanNation))
(holdsDuring (FutureFn (DayFn 3 (MonthFn June (YearFn 2006))))
  (names "Montenegro" Montenegro))
(geographicSubregion Montenegro SerbiaAndMontenegro)
(meetsSpatially Serbia Montenegro)
(documentation Montenegro EnglishLanguage "&%Montenegro is a &%Nation that
historically formed part of &%Yugoslavia, then part of
&%SerbiaAndMontenegro, and most recently has become an
&%IndependentState after seceding from &%SerbiaAndMontenegro on 3
&%June 2006.")

(holdsDuring (FutureFn (DayFn 3 (MonthFn June (YearFn 2006))))
  (not (instance SerbiaAndMontenegro IndependentState)))

;; NS: For proper temporal reasoning, we would need to better
;; represent the time interval(s) during which Serbia, Montenegro, and
;; SerbiaAndMontenegro have been independent states, parts of
;; Yugoslavia, etc.  A full temporal and spatial representation of the
;; geopolitical history of the nations that formerly composed
;; Yugoslavia would be a good test case.

;; AalandIslands
(instance AalandIslands Archipelago)
(instance AalandIslands DependencyOrSpecialSovereigntyArea)
(dependentGeopoliticalArea AalandIslands Finland)
(located AalandIslands BalticSea)
(documentation AalandIslands EnglishLanguage "The &%AalandIslands form
a partly autonomous &%Archipelago in the &%BalticSea that is
administratively part of &%Finland, but is populated mostly by ethnic
Swedes.")

;; PalestinianTerritories
(instance PalestinianTerritories GeopoliticalArea)
(instance PalestinianTerritories LandArea)
(geographicSubregion WestBank PalestinianTerritories)
(geographicSubregion GazaStrip PalestinianTerritories)
(documentation PalestinianTerritories EnglishLanguage "For the
purposes of &%ISO-3166-1-alpha-2, the &%PalestinianTerritories are
those &%LandAreas militarily controlled and sporadically occupied by
the State of &%Israel, but claimed and partly administered by the
&%PalestinianLiberationOrganization (in the case of the &%WestBank) or
Hamas (in the case of the &%GazaStrip).")
(meetsSpatially GazaStrip Israel)
(meetsSpatially WestBank Israel)

;; SvalbardAndJanMayenIsland
(instance SvalbardAndJanMayenIsland GeopoliticalArea)
(geographicSubregion Svalbard SvalbardAndJanMayenIsland)
(geographicSubregion JanMayenIsland SvalbardAndJanMayenIsland)
(documentation SvalbardAndJanMayenIsland EnglishLanguage "For the
purposes of &%ISO-3166-1-alpha-2, &%SvalbardAndJanMayenIsland comprises
an &%Archipelago, &%Svalbard, and an &%Island, &%JanMayenIsland, both
of which are considered to be full administrative &%parts of
&%Norway.")
(part SvalbardAndJanMayenIsland Norway)

;; USVirginIslands, BritishVirginIslands, VirginIslands
(instance BritishVirginIslands Archipelago)
;; Redundant with CountriesAndRegions.kif
;;(instance BritishVirginIslands DependencyOrSpecialSovereigntyArea)
(geographicSubregion BritishVirginIslands VirginIslands)
(instance USVirginIslands Archipelago)
(instance USVirginIslands DependencyOrSpecialSovereigntyArea)
(geographicSubregion USVirginIslands VirginIslands)
(subCollection BritishVirginIslands VirginIslands)
(subCollection USVirginIslands VirginIslands)
(dependentGeopoliticalArea BritishVirginIslands UnitedKingdom)
(dependentGeopoliticalArea USVirginIslands UnitedStates)

(instance UnitedStatesMinorOutlyingIslands Collection)
(instance UnitedStatesMinorOutlyingIslands GeopoliticalArea)
(documentation UnitedStatesMinorOutlyingIslands
EnglishLanguage "This &%Collection is a statistical convenience
introduced in 1986, and designated by &%ISO-3166-1-alpha-2 code
UM.")

(=>
  (member ?AREA UnitedStatesMinorOutlyingIslands)
  (dependentGeopoliticalArea ?AREA UnitedStates))

(member BakerIsland UnitedStatesMinorOutlyingIslands)
(member HowlandIsland UnitedStatesMinorOutlyingIslands)
(member JarvisIsland UnitedStatesMinorOutlyingIslands)
(member KingmanReef UnitedStatesMinorOutlyingIslands)
(member NavassaIsland UnitedStatesMinorOutlyingIslands)
(member WakeIsland UnitedStatesMinorOutlyingIslands)
(member PalmyraAtoll UnitedStatesMinorOutlyingIslands)
(member JohnstonAtoll UnitedStatesMinorOutlyingIslands)
(member MidwayIslands UnitedStatesMinorOutlyingIslands)

(instance ISO-3166-1-alpha-2 GeographicCodeMap)
(documentation ISO-3166-1-alpha-2 EnglishLanguage "This
&%GeographicCodeMap states correspondences between two-letter
alphabetic tokens defined in the ISO 3166-1 alpha-2 standard, and
constants defined in SUMO.  Note that for most of the alphabetic
tokens, the accompanying ISO 3166-1 numeric standard defines a
corresponding three-digit numeric token with the same meaning.")

(=>
  (codeMapping ISO-3166-1-alpha-2 ?TOKEN ?X)
  (and
    (instance ?X GeographicArea)
    (instance ?TOKEN AlphabeticString)
    (stringLength 2 ?TOKEN)))

(codeMapping ISO-3166-1-alpha-2 "AD" Andorra)
(codeMapping ISO-3166-1-alpha-2 "AF" Afghanistan)
(codeMapping ISO-3166-1-alpha-2 "AG" AntiguaAndBarbuda)
(codeMapping ISO-3166-1-alpha-2 "AL" Albania)
(codeMapping ISO-3166-1-alpha-2 "AM" Armenia)
(codeMapping ISO-3166-1-alpha-2 "AO" Angola)
(codeMapping ISO-3166-1-alpha-2 "AR" Argentina)
(codeMapping ISO-3166-1-alpha-2 "AT" Austria)
(codeMapping ISO-3166-1-alpha-2 "AU" Australia)
(codeMapping ISO-3166-1-alpha-2 "AX" AalandIslands)
(codeMapping ISO-3166-1-alpha-2 "AZ" Azerbaijan)
(codeMapping ISO-3166-1-alpha-2 "BA" BosniaAndHerzegovina)
(codeMapping ISO-3166-1-alpha-2 "BB" Barbados)
(codeMapping ISO-3166-1-alpha-2 "BD" Bangladesh)
(codeMapping ISO-3166-1-alpha-2 "BE" Belgium)
(codeMapping ISO-3166-1-alpha-2 "BF" BurkinaFaso)
(codeMapping ISO-3166-1-alpha-2 "BG" Bulgaria)
(codeMapping ISO-3166-1-alpha-2 "BH" Bahrain)
(codeMapping ISO-3166-1-alpha-2 "BI" Burundi)
(codeMapping ISO-3166-1-alpha-2 "BJ" Benin)
(codeMapping ISO-3166-1-alpha-2 "BN" Brunei)
(codeMapping ISO-3166-1-alpha-2 "BO" Bolivia)
(codeMapping ISO-3166-1-alpha-2 "BR" Brazil)
(codeMapping ISO-3166-1-alpha-2 "BS" TheBahamas)
(codeMapping ISO-3166-1-alpha-2 "BT" Bhutan)
(codeMapping ISO-3166-1-alpha-2 "BW" Botswana)
(codeMapping ISO-3166-1-alpha-2 "BY" Belarus)
(codeMapping ISO-3166-1-alpha-2 "BZ" Belize)
(codeMapping ISO-3166-1-alpha-2 "CA" Canada)
(codeMapping ISO-3166-1-alpha-2 "CD" DemocraticRepublicOfTheCongo)
(codeMapping ISO-3166-1-alpha-2 "CF" CentralAfricanRepublic)
;; (codeMapping ISO-3166-1-alpha-2 "CG" Congo)  historical abbreviation?
(codeMapping ISO-3166-1-alpha-2 "CI" CoteDIvoire)
(codeMapping ISO-3166-1-alpha-2 "CL" Chile)
(codeMapping ISO-3166-1-alpha-2 "CM" Cameroon)
(codeMapping ISO-3166-1-alpha-2 "CN" China)
(codeMapping ISO-3166-1-alpha-2 "CO" Colombia)
(codeMapping ISO-3166-1-alpha-2 "CR" CostaRica)
(codeMapping ISO-3166-1-alpha-2 "CV" CapeVerde)
(codeMapping ISO-3166-1-alpha-2 "CU" Cuba)
(codeMapping ISO-3166-1-alpha-2 "CY" Cyprus)
(codeMapping ISO-3166-1-alpha-2 "CZ" CzechRepublic)
(codeMapping ISO-3166-1-alpha-2 "DE" Germany)
(codeMapping ISO-3166-1-alpha-2 "DJ" Djibouti)
(codeMapping ISO-3166-1-alpha-2 "DK" Denmark)
(codeMapping ISO-3166-1-alpha-2 "DM" Dominica)
(codeMapping ISO-3166-1-alpha-2 "DO" DominicanRepublic)
(codeMapping ISO-3166-1-alpha-2 "DZ" Algeria)
(codeMapping ISO-3166-1-alpha-2 "EC" Ecuador)
(codeMapping ISO-3166-1-alpha-2 "EE" Estonia)
(codeMapping ISO-3166-1-alpha-2 "EG" Egypt)
(codeMapping ISO-3166-1-alpha-2 "ER" Eritrea)
(codeMapping ISO-3166-1-alpha-2 "ET" Ethiopia)
(codeMapping ISO-3166-1-alpha-2 "FI" Finland)
(codeMapping ISO-3166-1-alpha-2 "FJ" Fiji)
(codeMapping ISO-3166-1-alpha-2 "FM" Micronesia)
(codeMapping ISO-3166-1-alpha-2 "FR" France)
(codeMapping ISO-3166-1-alpha-2 "GA" Gabon)
(codeMapping ISO-3166-1-alpha-2 "GB" UnitedKingdom)
(codeMapping ISO-3166-1-alpha-2 "GD" Grenada)
(codeMapping ISO-3166-1-alpha-2 "GE" RepublicOfGeorgia)
(codeMapping ISO-3166-1-alpha-2 "GG" Guernsey)
(codeMapping ISO-3166-1-alpha-2 "GH" Ghana)
(codeMapping ISO-3166-1-alpha-2 "GM" Gambia)
(codeMapping ISO-3166-1-alpha-2 "GN" Guinea)
(codeMapping ISO-3166-1-alpha-2 "GQ" EquatorialGuinea)
(codeMapping ISO-3166-1-alpha-2 "GR" Greece)
(codeMapping ISO-3166-1-alpha-2 "GT" Guatemala)
(codeMapping ISO-3166-1-alpha-2 "GW" GuineaBissau)
(codeMapping ISO-3166-1-alpha-2 "GY" Guyana)
(codeMapping ISO-3166-1-alpha-2 "HN" Honduras)
(codeMapping ISO-3166-1-alpha-2 "HR" Croatia)
(codeMapping ISO-3166-1-alpha-2 "HT" Haiti)
(codeMapping ISO-3166-1-alpha-2 "HU" Hungary)
(codeMapping ISO-3166-1-alpha-2 "ID" Indonesia)
(codeMapping ISO-3166-1-alpha-2 "IE" Ireland)
(codeMapping ISO-3166-1-alpha-2 "IL" Israel)
(codeMapping ISO-3166-1-alpha-2 "IM" IsleOfMan)
(codeMapping ISO-3166-1-alpha-2 "IN" India)
(codeMapping ISO-3166-1-alpha-2 "IQ" Iraq)
(codeMapping ISO-3166-1-alpha-2 "IR" Iran)
(codeMapping ISO-3166-1-alpha-2 "IS" Iceland)
(codeMapping ISO-3166-1-alpha-2 "IT" Italy)
(codeMapping ISO-3166-1-alpha-2 "JE" Jersey)
(codeMapping ISO-3166-1-alpha-2 "JM" Jamaica)
(codeMapping ISO-3166-1-alpha-2 "JO" Jordan)
(codeMapping ISO-3166-1-alpha-2 "JP" Japan)
(codeMapping ISO-3166-1-alpha-2 "KE" Kenya)
(codeMapping ISO-3166-1-alpha-2 "KG" Kyrgyzstan)
(codeMapping ISO-3166-1-alpha-2 "KH" Cambodia)
(codeMapping ISO-3166-1-alpha-2 "KI" Kiribati)
(codeMapping ISO-3166-1-alpha-2 "KM" Comoros)
(codeMapping ISO-3166-1-alpha-2 "KP" NorthKorea)
(codeMapping ISO-3166-1-alpha-2 "KR" SouthKorea)
(codeMapping ISO-3166-1-alpha-2 "KW" Kuwait)
(codeMapping ISO-3166-1-alpha-2 "KZ" Kazakhstan)
(codeMapping ISO-3166-1-alpha-2 "LA" Laos)
(codeMapping ISO-3166-1-alpha-2 "LB" Lebanon)
(codeMapping ISO-3166-1-alpha-2 "LI" Liechtenstein)
(codeMapping ISO-3166-1-alpha-2 "LR" Liberia)
(codeMapping ISO-3166-1-alpha-2 "LS" Lesotho)
(codeMapping ISO-3166-1-alpha-2 "LT" Lithuania)
(codeMapping ISO-3166-1-alpha-2 "LU" Luxembourg)
(codeMapping ISO-3166-1-alpha-2 "LV" Latvia)
(codeMapping ISO-3166-1-alpha-2 "LY" Libya)
(codeMapping ISO-3166-1-alpha-2 "MA" Morocco)
(codeMapping ISO-3166-1-alpha-2 "MC" Monaco)
(codeMapping ISO-3166-1-alpha-2 "MD" Moldova)
(codeMapping ISO-3166-1-alpha-2 "ME" Montenegro)
(codeMapping ISO-3166-1-alpha-2 "MG" Madagascar)
(codeMapping ISO-3166-1-alpha-2 "MH" MarshallIslands)
(codeMapping ISO-3166-1-alpha-2 "ML" Mali)
(codeMapping ISO-3166-1-alpha-2 "MN" Mongolia)
(codeMapping ISO-3166-1-alpha-2 "MR" Mauritania)
(codeMapping ISO-3166-1-alpha-2 "MT" Malta)
(codeMapping ISO-3166-1-alpha-2 "MU" Mauritius)
(codeMapping ISO-3166-1-alpha-2 "MV" Maldives)
(codeMapping ISO-3166-1-alpha-2 "MW" Malawi)
(codeMapping ISO-3166-1-alpha-2 "MX" Mexico)
(codeMapping ISO-3166-1-alpha-2 "MY" Malaysia)
(codeMapping ISO-3166-1-alpha-2 "NA" Namibia)
(codeMapping ISO-3166-1-alpha-2 "NL" Netherlands)
(codeMapping ISO-3166-1-alpha-2 "NO" Norway)
(codeMapping ISO-3166-1-alpha-2 "NZ" NewZealand)
(codeMapping ISO-3166-1-alpha-2 "ZA" SouthAfrica)
(codeMapping ISO-3166-1-alpha-2 "SE" Sweden)
(codeMapping ISO-3166-1-alpha-2 "SV" ElSalvador)
(codeMapping ISO-3166-1-alpha-2 "SZ" Swaziland)
(codeMapping ISO-3166-1-alpha-2 "TD" Chad)
(codeMapping ISO-3166-1-alpha-2 "TL" EastTimor)
(codeMapping ISO-3166-1-alpha-2 "US" UnitedStates)
(codeMapping ISO-3166-1-alpha-2 "VA" HolySee)
(codeMapping ISO-3166-1-alpha-2 "ZM" Zambia)
(codeMapping ISO-3166-1-alpha-2 "ZW" Zimbabwe)

(codeMapping ISO-3166-1-alpha-2 "MZ" Mozambique)
(codeMapping ISO-3166-1-alpha-2 "MM" Myanmar)
(codeMapping ISO-3166-1-alpha-2 "NR" Nauru)
(codeMapping ISO-3166-1-alpha-2 "NP" Nepal)
(codeMapping ISO-3166-1-alpha-2 "NI" Nicaragua)
(codeMapping ISO-3166-1-alpha-2 "NE" Niger)
(codeMapping ISO-3166-1-alpha-2 "NG" Nigeria)
(codeMapping ISO-3166-1-alpha-2 "OM" Oman)
(codeMapping ISO-3166-1-alpha-2 "PK" Pakistan)
(codeMapping ISO-3166-1-alpha-2 "PW" Palau)
(codeMapping ISO-3166-1-alpha-2 "PA" Panama)
(codeMapping ISO-3166-1-alpha-2 "PG" PapuaNewGuinea)
(codeMapping ISO-3166-1-alpha-2 "PY" Paraguay)
(codeMapping ISO-3166-1-alpha-2 "PE" Peru)
(codeMapping ISO-3166-1-alpha-2 "PH" Philippines)
(codeMapping ISO-3166-1-alpha-2 "PL" Poland)
(codeMapping ISO-3166-1-alpha-2 "PT" Portugal)
(codeMapping ISO-3166-1-alpha-2 "QA" Qatar)
(codeMapping ISO-3166-1-alpha-2 "RO" Romania)
(codeMapping ISO-3166-1-alpha-2 "RU" Russia)
(codeMapping ISO-3166-1-alpha-2 "RW" Rwanda)
(codeMapping ISO-3166-1-alpha-2 "KN" SaintKittsAndNevis)
(codeMapping ISO-3166-1-alpha-2 "LC" SaintLucia)
(codeMapping ISO-3166-1-alpha-2 "VC" SaintVincentAndTheGrenadines)
(codeMapping ISO-3166-1-alpha-2 "WS" Samoa)
(codeMapping ISO-3166-1-alpha-2 "SM" SanMarino)
(codeMapping ISO-3166-1-alpha-2 "ST" SaoTomeAndPrincipe)
(codeMapping ISO-3166-1-alpha-2 "SA" SaudiArabia)
(codeMapping ISO-3166-1-alpha-2 "SN" Senegal)
(codeMapping ISO-3166-1-alpha-2 "RS" Serbia)
(codeMapping ISO-3166-1-alpha-2 "SC" Seychelles)
(codeMapping ISO-3166-1-alpha-2 "SL" SierraLeone)
(codeMapping ISO-3166-1-alpha-2 "SG" Singapore)
(codeMapping ISO-3166-1-alpha-2 "SK" Slovakia)
(codeMapping ISO-3166-1-alpha-2 "SI" Slovenia)
(codeMapping ISO-3166-1-alpha-2 "SB" SolomonIslands)
(codeMapping ISO-3166-1-alpha-2 "SO" Somalia)
(codeMapping ISO-3166-1-alpha-2 "ES" Spain)
(codeMapping ISO-3166-1-alpha-2 "LK" SriLanka)
(codeMapping ISO-3166-1-alpha-2 "SD" Sudan)
(codeMapping ISO-3166-1-alpha-2 "SR" Suriname)
(codeMapping ISO-3166-1-alpha-2 "CH" Switzerland)
(codeMapping ISO-3166-1-alpha-2 "SY" Syria)
(codeMapping ISO-3166-1-alpha-2 "TJ" Tajikistan)
(codeMapping ISO-3166-1-alpha-2 "TZ" Tanzania)
(codeMapping ISO-3166-1-alpha-2 "TH" Thailand)
(codeMapping ISO-3166-1-alpha-2 "MK" Macedonia)
(codeMapping ISO-3166-1-alpha-2 "TG" Togo)
(codeMapping ISO-3166-1-alpha-2 "TO" Tonga)
(codeMapping ISO-3166-1-alpha-2 "TT" TrinidadAndTobago)
(codeMapping ISO-3166-1-alpha-2 "TN" Tunisia)
(codeMapping ISO-3166-1-alpha-2 "TR" Turkey)
(codeMapping ISO-3166-1-alpha-2 "TM" Turkmenistan)
(codeMapping ISO-3166-1-alpha-2 "TV" Tuvalu)
(codeMapping ISO-3166-1-alpha-2 "UG" Uganda)
(codeMapping ISO-3166-1-alpha-2 "UA" Ukraine)
(codeMapping ISO-3166-1-alpha-2 "AE" UnitedArabEmirates)
(codeMapping ISO-3166-1-alpha-2 "UY" Uruguay)
(codeMapping ISO-3166-1-alpha-2 "UZ" Uzbekistan)
(codeMapping ISO-3166-1-alpha-2 "VU" Vanuatu)
(codeMapping ISO-3166-1-alpha-2 "VE" Venezuela)
(codeMapping ISO-3166-1-alpha-2 "VN" Vietnam)
(codeMapping ISO-3166-1-alpha-2 "YE" Yemen)
(codeMapping ISO-3166-1-alpha-2 "AS" AmericanSamoa)
(codeMapping ISO-3166-1-alpha-2 "AI" Anguilla)
(codeMapping ISO-3166-1-alpha-2 "AQ" Antarctica)
(codeMapping ISO-3166-1-alpha-2 "AW" Aruba)
(codeMapping ISO-3166-1-alpha-2 "BM" Bermuda)
(codeMapping ISO-3166-1-alpha-2 "BV" BouvetIsland)
(codeMapping ISO-3166-1-alpha-2 "IO" BritishIndianOceanTerritory)
(codeMapping ISO-3166-1-alpha-2 "KY" CaymanIslands)
(codeMapping ISO-3166-1-alpha-2 "CX" ChristmasIsland)
(codeMapping ISO-3166-1-alpha-2 "CC" CocosKeelingIslands)
(codeMapping ISO-3166-1-alpha-2 "CK" CookIslands)
(codeMapping ISO-3166-1-alpha-2 "FK" FalklandIslands)
(codeMapping ISO-3166-1-alpha-2 "FO" FaroeIslands)
(codeMapping ISO-3166-1-alpha-2 "GF" FrenchGuiana)
(codeMapping ISO-3166-1-alpha-2 "PF" FrenchPolynesia)
(codeMapping ISO-3166-1-alpha-2 "TF" FrenchSouthernAndAntarcticLands)
(codeMapping ISO-3166-1-alpha-2 "GI" Gibraltar)
(codeMapping ISO-3166-1-alpha-2 "GL" Greenland)
(codeMapping ISO-3166-1-alpha-2 "GP" Guadeloupe)
(codeMapping ISO-3166-1-alpha-2 "GU" Guam)
(codeMapping ISO-3166-1-alpha-2 "HM" HeardIslandAndMcDonaldIslands)
(codeMapping ISO-3166-1-alpha-2 "HK" HongKong)
(codeMapping ISO-3166-1-alpha-2 "MO" Macau)
(codeMapping ISO-3166-1-alpha-2 "MQ" Martinique)
(codeMapping ISO-3166-1-alpha-2 "YT" Mayotte)
(codeMapping ISO-3166-1-alpha-2 "MS" Montserrat)
(codeMapping ISO-3166-1-alpha-2 "AN" NetherlandsAntilles)
(codeMapping ISO-3166-1-alpha-2 "NC" NewCaledonia)
(codeMapping ISO-3166-1-alpha-2 "NU" Niue)
(codeMapping ISO-3166-1-alpha-2 "NF" NorfolkIsland)
(codeMapping ISO-3166-1-alpha-2 "MP" NorthernMarianaIslands)
(codeMapping ISO-3166-1-alpha-2 "PS" PalestinianTerritories)
(codeMapping ISO-3166-1-alpha-2 "PN" PitcairnIslands)
(codeMapping ISO-3166-1-alpha-2 "PR" PuertoRico)
(codeMapping ISO-3166-1-alpha-2 "RE" Reunion)
(codeMapping ISO-3166-1-alpha-2 "SH" SaintHelena)
(codeMapping ISO-3166-1-alpha-2 "PM" SaintPierreAndMiquelon)
(codeMapping ISO-3166-1-alpha-2 "GS" SouthGeorgiaAndTheSouthSandwichIslands)
(codeMapping ISO-3166-1-alpha-2 "SJ" SvalbardAndJanMayenIsland)
(codeMapping ISO-3166-1-alpha-2 "TW" Taiwan)
(codeMapping ISO-3166-1-alpha-2 "TK" Tokelau)
(codeMapping ISO-3166-1-alpha-2 "TC" TurksAndCaicosIslands)
(codeMapping ISO-3166-1-alpha-2 "UM" UnitedStatesMinorOutlyingIslands)
(codeMapping ISO-3166-1-alpha-2 "VG" BritishVirginIslands)
(codeMapping ISO-3166-1-alpha-2 "VI" USVirginIslands)
(codeMapping ISO-3166-1-alpha-2 "WF" WallisAndFutuna)
(codeMapping ISO-3166-1-alpha-2 "EH" WesternSahara)

(=>
  (and
    (codeMapping ISO-4217-A ?A3 ?CURRENCY)
    (codeMapping ISO-3166-1-alpha-2 ?A2 ?AREA)
    (subclass ?AREA GeopoliticalArea)
    (equal ?A2 (SubstringFn ?A3 0 2)))
  (currencyType ?AREA ?CURRENCY))

;;;;;;;;;;;;;;;;;;;;;;
;; End: code tables ;;
;;;;;;;;;;;;;;;;;;;;;;

(subclass AlphabeticString SymbolicString)
(subclass AlphabeticString LinguisticExpression)

(=>
  (and
    (instance ?STR AlphabeticString)
    (part ?CHAR ?STR)
    (instance ?CHAR Character))
  (instance ?CHAR AlphabeticCharacter))

(subclass DecimalDigitString SymbolicString)
(=>
  (and
    (instance ?STR DecimalDigitString)
    (part ?CHAR ?STR)
    (instance ?CHAR Character))
  (instance ?CHAR DigitCharacter))

(subclass TerritoryID LocalizablePlaceID)
(subclass TerritoryCode TerritoryID)
(subclass TerritoryCode IsoCode)
(subclass CountryID TerritoryID)
(subclass DistrictID LocalizablePlaceID)
(subclass UsStateCode DistrictID)
(subclass SubDistrictID LocalizablePlaceID)
(subclass AccountID VirtualPlaceID)
(subclass BankAccountNumber AccountID)
(subclass FilePath VirtualAddress)
(subclass InternetAddress VirtualAddress)
(subclass EmailAddress InternetAddress)
(subclass WebAddress InternetAddress)
(subclass URL WebAddress)
(subclass URL StandardIdentifier)
(subclass StandardIdentifier Identifier)
(subclass IsoCode StandardIdentifier)
(subclass FormalIdentifier Identifier)
(subclass IsoLanguageCode IsoCode)

(subclass AlphaNumericString SymbolicString)
(subclass AlphaNumericString LinguisticExpression)

(=>
  (instance ?ANS AlphaNumericString)
  (exists (?A ?N)
    (and
      (instance ?A AlphabeticCharacter)
      (inString ?A ?ANS)
      (instance ?N DigitCharacter)
      (inString ?N ?ANS))))

(subclass AlphaNumericIDString FormalIdentifier)
(subclass AlphaNumericIDString AlphaNumericString)

(subclass NumericString4 DecimalDigitString)

(=>
  (instance ?STRING NumericString4)
  (stringLength 4 ?STRING))

(=>
  (and
    (instance ?STRING DecimalDigitString)
    (stringLength 4 ?STRING))
  (instance ?STRING NumericString4))

(subclass NumericIDString FormalIdentifier)
(subclass NumericIDString DecimalDigitString)

(subclass AlphaIDString FormalIdentifier)
(subclass AlphaIDString AlphabeticString)

(subclass Alpha3String AlphabeticString)

(=>
  (instance ?STRING Alpha3String)
  (stringLength 3 ?STRING))

(=>
  (and
    (instance ?STRING AlphabeticString)
    (stringLength 3 ?STRING))
  (instance ?STRING Alpha3String))

(subclass Alpha3IDString AlphaIDString)
(subclass Alpha3IDString Alpha3String)

(subclass Alpha2String AlphabeticString)

(=>
  (instance ?STRING Alpha2String)
  (stringLength 2 ?STRING))

(=>
  (and
    (instance ?STRING AlphabeticString)
    (stringLength 2 ?STRING))
  (instance ?STRING Alpha2String))

(subclass Alpha2IDString AlphaIDString)
(subclass Alpha2IDString Alpha2String)

(subclass ProprietaryIdentifier Identifier)

(subclass ProductID Identifier)

(subclass StandardProductID ProductID)
(subclass StandardProductID StandardIdentifier)

(subclass UPC StandardProductID)
(subclass UPC FormalIdentifier)

(subclass ISBN StandardProductID)
(subclass ISBN FormalIdentifier)

(subclass ISMN StandardProductID)
(subclass ISMN FormalIdentifier)

(subclass ISRC StandardProductID)
(subclass ISRC FormalIdentifier)

(subclass PartyID Identifier)
(subclass AgentID PartyID)
(subclass CustomerID AgentID)
(subclass PersonID AgentID)
(subclass EmployeeID PersonID)
(subclass EmployeeNumber EmployeeID)
(subclass EmployeeNumber Identifier)
(subclass UserID AgentID)

(instance acronym BinaryPredicate)
(instance acronym AsymmetricRelation)
(domain acronym 1 SymbolicString)
(domain acronym 2 Entity)
(subrelation acronym abbreviation)
(documentation acronym EnglishLanguage "(&%acronym ?STRING
?ENTITY) means that ?STRING consists of the initial (capitalized)
letters of a multiword name for ?ENTITY.  Example: IBM is an
&%acronym identifying (naming) a company for which the full name
is International Business Machines.")

(=>
  (and
    (acronym ?STRING ?THING)
    (inString ?CHAR ?STRING))
  (instance ?CHAR AlphabeticCharacter))
;; NS: TO DO: Create UpperCaseCharacter, LowerCaseCharacter.

(instance titleInLanguage TernaryPredicate)
(domain titleInLanguage 1 SymbolicString)
(domainSubclass titleInLanguage 2 ContentBearingPhysical)
(domain titleInLanguage 3 Language)
(documentation titleInLanguage EnglishLanguage "(&%titleInLanguage
?STRING ?WORKCLASS ?LANGUAGE) means that in the &%Language ?LANGUAGE,
&%instances of the &%ContentBearingPhysical ?WORKCLASS bear the title
?STRING.")
(subrelation titleInLanguage representsInLanguage)

(=>
  (titleInLanguage ?STRING ?CBP-TYPE ?LANGUAGE) 
  (titles ?STRING ?CBP-TYPE))

(=>
  (titleInLanguage ?STRING ?CBP-TYPE ?LANGUAGE)
  (instance ?STRING LinguisticExpression))

(instance alternativeTitle TernaryPredicate)
(domain alternativeTitle 1 SymbolicString)
(domainSubclass alternativeTitle 2 ContentBearingPhysical)
(domain alternativeTitle 3 Language)
(documentation alternativeTitle EnglishLanguage "(&%alternativeTitle
?STRING ?WORKTYPE ?LANGUAGE) means that in the &%Language ?LANGUAGE,
?STRING is an alternative title for &%instances of the
&%ContentBearingPhysical ?WORKTYPE.")
(subrelation alternativeTitle titleInLanguage)

(instance sortingTitle TernaryPredicate)
(domain sortingTitle 1 SymbolicString)
(domainSubclass sortingTitle 2 ContentBearingPhysical)
(domain sortingTitle 3 Language)
(documentation sortingTitle EnglishLanguage "(&%sortingTitle ?STRING
?WORKTYPE ?LANGUAGE) means that in the &%Language ?LANGUAGE, ?STRING
is the version of the title for &%instances of the
&%ContentBearingPhysical ?WORKTYPE to be used for alphabetic
sorting.")
(subrelation sortingTitle titleInLanguage)

(instance displayTitle TernaryPredicate)
(domain displayTitle 1 SymbolicString)
(domainSubclass displayTitle 2 ContentBearingPhysical)
(domain displayTitle 3 Language)
(documentation displayTitle EnglishLanguage "(&%displayTitle ?STRING
?WORKTYPE ?LANGUAGE) means that in the &%Language ?LANGUAGE, ?STRING
is the version of the title of &%instances of &%ContentBearingPhysical
?WORKTYPE to be used for display to a &%Consumer, as specified by the
&%RightsController.")
(subrelation displayTitle titleInLanguage)

(instance abbreviatedDisplayTitle TernaryPredicate)
(domain abbreviatedDisplayTitle 1 SymbolicString)
(domainSubclass abbreviatedDisplayTitle 2 ContentBearingPhysical)
(domain abbreviatedDisplayTitle 3 Language)
(documentation abbreviatedDisplayTitle
EnglishLanguage "(&%abbreviatedDisplayTitle ?STRING ?WORKTYPE
?LANGUAGE) means that in the &%Language ?LANGUAGE, ?STRING is the
abbreviated version of the title of &%instances of
&%ContentBearingPhysical ?WORKTYPE to be used for display to a
&%Consumer, as specified by the &%RightsController.")
(subrelation abbreviatedDisplayTitle displayTitle)

(=>
  (and
    (abbreviatedDisplayTitle ?STRING ?CBP-TYPE ?LANGUAGE)
    (instance ?X ?CBP-TYPE))
  (abbreviation ?STRING ?X))

(instance referenceTitle TernaryPredicate)
(domain referenceTitle 1 SymbolicString)
(domainSubclass referenceTitle 2 ContentBearingPhysical)
(domain referenceTitle 3 Language)
(documentation referenceTitle EnglishLanguage "(&%referenceTitle
?STRING ?WORKTYPE ?LANGUAGE) means that in the &%Language ?LANGUAGE,
?STRING is the detailed reference version of the title of &%instances
of &%ContentBearingPhysical ?WORKTYPE, as specified in the
&%ReferenceDescriptiveMetadataSet.")
(subrelation referenceTitle titleInLanguage)

(instance originalTitle TernaryPredicate)
(domain originalTitle 1 SymbolicString)
(domainSubclass originalTitle 2 ContentBearingPhysical)
(domain originalTitle 3 Language)
(documentation originalTitle EnglishLanguage "(&%originalTitle ?STRING
?WORKTYPE ?LANGUAGE) means that in the &%Language ?LANGUAGE, ?STRING
is the original title of &%instances of &%ContentBearingPhysical
?WORKTYPE, as specified in the &%ReferenceDescriptiveMetadataSet.")
(subrelation originalTitle titleInLanguage)

(instance groupingTitle TernaryPredicate)
(domain groupingTitle 1 SymbolicString)
(domainSubclass groupingTitle 2 ContentBearingPhysical)
(domain groupingTitle 3 Language)
(documentation groupingTitle EnglishLanguage "(&%groupingTitle ?STRING
?WORKTYPE ?LANGUAGE) means that in the &%Language ?LANGUAGE, ?STRING
is the title of &%instances of the &%ContentBearingPhysical ?WORKTYPE.
Each &%instance of ?WORKTYPE is a &%Collection, the &%members of which
also are &%instances of &%ContentBearingPhysical.")
(subrelation groupingTitle titleInLanguage)

(=>
  (groupingTitle ?STRING ?PRODUCTTYPE ?LANGUAGE)
  (subclass ?PRODUCTTYPE Collection))

(=>
  (and
    (groupingTitle ?STRING ?PRODUCTTYPE ?LANGUAGE)
    (instance ?PRODUCT ?PRODUCTTYPE)
    (member ?OBJ ?PRODUCT))
  (instance ?OBJ ContentBearingPhysical))

(instance misspelledTitle TernaryPredicate)
(domain misspelledTitle 1 SymbolicString)
(domainSubclass misspelledTitle 2 ContentBearingPhysical)
(domain misspelledTitle 3 Language)
(documentation misspelledTitle EnglishLanguage "(&%misspelledTitle
?STRING ?WORKTYPE ?LANGUAGE) means that in the &%Language ?LANGUAGE,
?STRING is a misspelled version of the title of &%instances of
&%ContentBearingPhysical ?WORKTYPE.")
(subrelation misspelledTitle titleInLanguage)

(instance subtitle TernaryPredicate)
(domain subtitle 1 SymbolicString)
(domainSubclass subtitle 2 ContentBearingPhysical)
(domain subtitle 3 Language)
(documentation subtitle EnglishLanguage "(&%subtitle ?STRING ?WORKTYPE
?LANGUAGE) means that in the &%Language ?LANGUAGE, ?STRING is an
addendum or supplement to the title for &%instances of the
&%ContentBearingPhysical ?WORKTYPE.")

;; There can be a subtitle only if there is a title.
(=>
  (subtitle ?STRING ?WORKTYPE ?LANGUAGE)
  (exists (?TITLE)
    (and
      (instance ?TITLE SymbolicString)
      (instance ?TITLE LinguisticExpression)
      (titleInLanguage ?TITLE ?WORKTYPE ?LANGUAGE))))

;; Subtitle and title must be different.
(=>
  (and
    (titleInLanguage ?TITLE ?WORKTYPE ?LANGUAGE)
    (subtitle ?SUBTITLE ?WORKTYPE ?LANGUAGE))
  (not (equal ?TITLE ?SUBTITLE)))

(instance translatedTitle TernaryPredicate)
(domain translatedTitle 1 SymbolicString)
(domainSubclass translatedTitle 2 ContentBearingPhysical)
(domain translatedTitle 3 Language)
(documentation translatedTitle EnglishLanguage "(&%translatedTitle
?STRING ?WORKTYPE ?LANGUAGE) means that the title for &%instances of
the &%ContentBearingPhysical ?WORKTYPE in the &%Language ?LANGUAGE is
?STRING, and that ?STRING is a translation of a different (original)
title in a different &%Language.  See &%originalTitle.")
(subrelation translatedTitle titleInLanguage)

(=>
  (and
    (translatedTitle ?TRANS ?WORKTYPE ?LANG1)
    (originalTitle ?TITLE ?WORKTYPE ?LANG2))
  (and
    (not (equal ?TRANS ?TITLE))
    (not (equal ?LANG1 ?LANG2))))

(=>
  (and
    (titleInLanguage ?TITLE1 ?WORKTYPE ?LANG1)
    (originalTitle ?TITLE2 ?WORKTYPE ?LANG2)
    (not (equal ?LANG1 ?LANG2)))
  (translatedTitle ?TITLE1 ?WORKTYPE ?LANG1))

(instance keyName BinaryPredicate)
(instance keyName AntisymmetricRelation)
(instance keyName ReflexiveRelation)
(domain keyName 1 SymbolicString)
(domain keyName 2 SymbolicString)
(subrelation keyName subString)
(documentation keyName EnglishLanguage "(&%keyName ?S1 ?S2) means
that ?S1 is the &%subString of ?S2 (i.e., the component name)
typically used for alphabetical name indexing.")

(instance fullName BinaryPredicate)
(instance fullName AsymmetricRelation)
(domain fullName 1 SymbolicString)
(domain fullName 2 Entity)
(subrelation fullName names)
(documentation fullName EnglishLanguage "(&%fullName ?STRING
?OBJ) means that ?STRING is a (more or less) complete name for
?OBJ, having all of the &%parts (fields, name components)
possible for ?OBJ's name.  The &%parts of ?STRING, if any, may be
in conventional order, or in indexed (for alphabetic sorting)
order.  Examples: George W. Bush, The White House, The United
Kingdom of Great Britain and Northern Ireland.")
(subrelation conventionalLongName fullName)

(instance fullNameIndexOrder BinaryPredicate)
(instance fullNameIndexOrder AsymmetricRelation)
(domain fullNameIndexOrder 1 SymbolicString)
(domain fullNameIndexOrder 2 Entity)
(documentation fullNameIndexOrder
EnglishLanguage "(&%fullNameIndexOrder ?STRING ?OBJ) means that
?STRING is a full name for ?OBJ, having all of the
&%subStrings (fields, components) that occur in ?OBJ's complete
name.  The first component of ?STRING will be the indexed
&%subString identified by &%keyName.  Example: Bush, George W.")
(subrelation fullNameIndexOrder fullName)

(=>
  (and
    (fullName ?NAMESTRING ?THING)
    (keyName ?FIRST ?NAMESTRING)
    (stringConcatenation ?FIRST ?REST ?NAMESTRING))
  (fullNameIndexOrder ?NAMESTRING ?THING))

(=>
  (and
    (fullNameIndexOrder ?NAMESTRING ?THING)
    (keyName ?FIRST ?NAMESTRING)
    (equal ?START (StringLengthFn ?FIRST))
    (equal ?END (StringLengthFn ?NAMESTRING))
    (equal ?REST (SubstringFn ?NAMESTRING ?START ?END)))
  (stringConcatenation ?FIRST ?REST ?NAMESTRING))

(instance nameIndexOrder BinaryPredicate)
(instance nameIndexOrder AsymmetricRelation)
(domain nameIndexOrder 1 SymbolicString)
(domain nameIndexOrder 2 Entity)
(documentation nameIndexOrder EnglishLanguage "(&%nameIndexOrder
?STRING ?OBJ) means that ?STRING is a full or partial name for
?OBJ, and that the first component of ?STRING is the indexed
&%subString identified by &%keyName.  Example: Bush, George.")
(subrelation fullNameIndexOrder nameIndexOrder)
(subrelation nameIndexOrder names)

(=>
  (and
    (names ?NAMESTRING ?THING)
    (keyName ?FIRST ?NAMESTRING)
    (stringConcatenation ?FIRST ?REST ?NAMESTRING))
  (nameIndexOrder ?NAMESTRING ?THING))

(=>
  (and
    (nameIndexOrder ?NAMESTRING ?THING)
    (keyName ?FIRST ?NAMESTRING)
    (equal ?START (StringLengthFn ?FIRST))
    (equal ?END (StringLengthFn ?NAMESTRING))
    (equal ?REST (SubstringFn ?NAMESTRING ?START ?END)))
  (stringConcatenation ?FIRST ?REST ?NAMESTRING))

(=>
  (and
    (nameIndexOrder ?NAMESTRING ?THING)
    (fullName ?NAMESTRING ?THING))
  (fullNameIndexOrder ?NAMESTRING ?THING))

(instance nameAfterKeyName TernaryPredicate)
(domain nameAfterKeyName 1 SymbolicString)
(domain nameAfterKeyName 2 SymbolicString)
(domain nameAfterKeyName 3 SymbolicString)
(documentation nameAfterKeyName
EnglishLanguage "(&%nameAfterKeyName ?STRING ?KEY ?NAMESTRING)
means that ?STRING and ?KEY are &%subStrings of ?NAMESTRING, and
?STRING occurs after ?KEY in ?NAMESTRING.")

(=>
  (nameAfterKeyName ?STRING ?KEY ?NAMESTRING)
  (keyName ?KEY ?NAMESTRING))

(=>
  (and 
    (names ?NAMESTRING ?OBJ)
    (or
      (nameAfterKeyName ?STRING ?KEY ?NAMESTRING)
      (equal ?STRING ?KEY)))
  (nameIndexOrder ?NAMESTRING ?OBJ))

(=>
  (nameAfterKeyName ?STRING ?KEY ?NAMESTRING)
  (precedesInString ?KEY ?STRING ?NAMESTRING))

(=>
  (and
    (keyName ?KEY ?NAMESTRING)
    (precedesInString ?KEY ?STRING ?NAMESTRING))
  (nameAfterKeyName ?STRING ?KEY ?NAMESTRING))

(instance nameBeforeKeyName TernaryPredicate)
(domain nameBeforeKeyName 1 SymbolicString)
(domain nameBeforeKeyName 2 SymbolicString)
(domain nameBeforeKeyName 3 SymbolicString)
(subrelation nameBeforeKeyName precedesInString)
(documentation nameBeforeKeyName
EnglishLanguage "(&%nameBeforeKeyName ?STRING ?KEY ?NAMESTRING)
means that ?STRING and ?KEY are &%subStrings of ?NAMESTRING, and
?STRING occurs before ?KEY in ?NAMESTRING.")

(=>
  (nameBeforeKeyName ?STRING ?KEY ?NAMESTRING)
  (keyName ?KEY ?NAMESTRING))

(=>
  (and
    (names ?NAMESTRING ?OBJ)
    (nameBeforeKeyName ?STRING ?KEY ?NAMESTRING)
    (not (equal ?STRING ?KEY)))
  (not (nameIndexOrder ?NAMESTRING ?OBJ)))

(=>
  (and
    (keyName ?KEY ?NAMESTRING)
    (precedesInString ?STRING ?KEY ?NAMESTRING))
  (nameBeforeKeyName ?STRING ?KEY ?NAMESTRING))

(instance agentName BinaryPredicate)
(instance agentName AsymmetricRelation)
(domain agentName 1 SymbolicString)
(domain agentName 2 Agent)
(subrelation agentName names)
(documentation agentName EnglishLanguage "(&%agentName ?STRING
?OBJ) means that ?STRING is a full or partial name for the
&%Agent ?OBJ.")

(=>
  (and
    (names ?STRING ?OBJ)
    (instance ?OBJ Agent))
  (agentName ?STRING ?OBJ))

(instance humanName BinaryPredicate)
(instance humanName AsymmetricRelation)
(domain humanName 1 SymbolicString)
(domain humanName 2 Human)
(subrelation humanName agentName)
(documentation humanName EnglishLanguage "(&%humanName ?STRING
?OBJ) means that ?STRING is a full or partial name for the
&%Human ?OBJ.")
(subrelation familyName humanName)
(subrelation givenName humanName)

(=>
  (and
    (names ?STRING ?OBJ)
    (instance ?OBJ Human))
  (humanName ?STRING ?OBJ))

(=>
  (and
    (humanName ?NAMESTRING ?HUMAN)
    (familyName ?STRING ?HUMAN)
    (subString ?STRING ?NAMESTRING))
  (keyName ?STRING ?NAMESTRING))

;; This is true for AngloAmerican naming practices, but not
;; monotonically true.
(=>
  (and
    (humanName ?NAMESTRING ?HUMAN)
    (givenName ?STRING ?HUMAN)
    (subString ?STRING ?NAMESTRING))
  (not (keyName ?STRING ?NAMESTRING)))

;; NS: TO DO: further develop this vocabulary for human names,
;; taking language and culture into account.

(instance organizationName BinaryPredicate)
(instance organizationName AsymmetricRelation)
(domain organizationName 1 SymbolicString)
(domain organizationName 2 Organization)
(subrelation organizationName agentName)
(documentation organizationName
EnglishLanguage "(&%organizationName ?STRING ?OBJ) means that
?STRING is a full or partial name for the &%Organization ?OBJ.")

(=>
  (and
    (names ?STRING ?OBJ)
    (instance ?OBJ Organization))
  (organizationName ?STRING ?OBJ))

;; ICPN (International Code Product Number)
;; GRid (Global Release Identifier)
;; ISWC (International Standard Musical Work Code)

;;;;;;;;;;;;;;;;;;;;;;
;; End: Identifiers ;;
;;;;;;;;;;;;;;;;;;;;;;

