;;; -*- Mode:Lisp; Syntax: Common-Lisp; Package:ONTOLINGUA-USER; Base:10 -*-

;;; (c) 1993 Greg Olsen and Thomas Gruber

(in-package "ONTOLINGUA-USER")

(define-theory component-assemblies (frame-ontology)

  "A COMPONENT is a structure that can have parts and connections.  The parts
are also components, and the connections are to other components.  The concept
of components defined in this theory is a fundamental abstraction that applies
in many engineering domains.  Component structures appear as physical parts in
a machine, modules in a software program, functions in a functional
description, and model fragments in a model library. The part relation for
components is called SUBCOMPONENT-OF, and it is not tied to physical
inclusion.  For named part relations, the relations HAS-SUBPART-SLOT and
SUBPART-SLOT-OF are defined.  Each subpart-slot is a unary-function from a
component to one of its subcomponent.

Connection in this theory is also an abstract primitive notion.
Two varieties of connections are defined.  The binary relation
CONNECTED-COMPONENTS is the minimal, most abstract relation between connected
components.  Connections may also be reified as CONNECTION objects.

What makes something a component is how it is related to other objects by the
subcomponent and connection relations.  That is why this theory is called
component assemblies, and why the notions of part and connection are
combined with the notion of component structure.

Components and subcomponent relations are quite different
from classes and subclass relations (CLASS and SUBCLASS-OF).
There is no property inheritence through subcomponent or connection
  :issues ("Copyright (c) 1994, Thomas R. Gruber and Gregory R. Olsen"
	   ("This is pretty abstract.  What is it for?"
	    "With this vocabulary one may define hierarchical configurations of
components.  There are tools that commit to this ontology that can draw and
analyze graphs of these hierarchies without any more information about
the nature of the components and connections.")))

(in-theory 'component-assemblies)

;; Components-&-Subcomponents

(define-class COMPONENT (?x)
  "A COMPONENT is a structure that can have parts and connections.  The concept
of components as a defined in this theory is a fundamental abstraction that
applies in many engineering domains.  Component structures need nopt
correspond to physically whole objects such as standard parts from a catalog.
The class of component, as defined here, may also be used to represent
nonphysical objects such as modules in a software program, functions in a
functional description, and model fragments in a model library.
This is a primitive concept; what makes an object a component
is how it is connected and a part of other objects."

  :def (individual-thing ?x)
  :axiom-def (and (domain-of component SUBCOMPONENT-OF)
		  (domain-of component HAS-SUBCOMPONENT)
		  (domain-of component CONNECTED-COMPONENTS)))

(define-relation SUBCOMPONENT-OF (?sub ?super)

  "(subcomponent-of ?sub ?super) means that the component ?sub
is structurally a part of component ?super.  A component cannot be a
subcomponent of itself (irrreflexivity) and two components cannot
be subcomponents of each other (antisymmetrity).

This is a primitive relation.  Formally, any irreflexive and antisymmetric
relation defined only on components will satisfy this definition.

Note that the subcomponent-of relation does not name the parts of a component.
That is, the subcomponent links are unlabeled arcs.  For named subcomponent
relations, see has-subpart-slot."

  :def (and (component ?sub)
	    (component ?super))

  :axiom-def (and (irreflexive-relation subcomponent-of)
		  (antisymmetric-relation subcomponent-of))

  :issues (("What about transitivity?"
	    "A main difference betweeen components and arbitrary
globs of matter is that components are object-like in a modeling sense;
thus, a subcomponent is not an arbtrary subregion, but a 
part of a system with a stable identity as its part. If subcomponent-of
were transitive, then there would be no level boundaries between a component
and its subcomponents and their subcomponents; for modularity reasons,
the system modeler describes the subcomponents of a component as black boxes,
rather than as arbitrary regions.")
	   ("What about mereology?"
	    "Mereological theories are concerned with the validity of
axiomatic assumptions about part/whole relationships as applied to the
physical world. That is why they often insist that the part relation is
transitive.  This ontology provides abstractions for engineering modeling;
it is the modeler's obligation to apply them meaningfully to physical domains."
	   (:see-also has-subcomponent subpart-slot-of))))

(define-relation HAS-SUBCOMPONENT (?super ?sub)
  "has-subcomponent is the inverse of subcomponent-of.  (has-subcomponent A B)
iff B is a subcomponent-of A."
  :iff-def (subcomponent-of ?sub ?super))

(define-relation CONNECTED-COMPONENTS (?a ?b)

  "Connected-components is the most general binary connection relation
between components.  If (connected-components A B), then A and B must
be components and neither can be a subcomponent-of of the other.

Connected-components is symmetric; there is no information
in the direction of connection between two components.
It is also irreflexive; a component cannot be connected
to itself.

This is an abstract relationship.  There is no commitment that the two
components much touch physically.  Even in the case of a connection between
physical components, the connection can represent abstract properties of the
interaction of the two components.  Specializations of this ontology may
impose additional constraints, such as asserting that system parameters are
shared among connected components.

Note that the connection relation between connected components
does not associate a name or type with the connection.  One may
specify that with other binary relations (e.g., thermally-connected).

  :def (and (component ?a)
	    (component ?b)
	    (not (subcomponent-of ?a ?b))
	    (not (subcomponent-of ?b ?a)))

  :axiom-def (and (irreflexive-relation connected-components)
		  (symmetric-relation connected-components)))

(define-class CONNECTION (?x)
  "A CONNECTION is an COMPONENT that represents a
connection relationships between two other components.
It is a reification of connected-components.  That means
that whereever the connected-components relation holds
between two components, there exists a connection component.
This is logical existence; this connection object may not be
present in the memory of a representation system.  Conversely,
if a representation system has allocated a data structure for
a connection object, it doesn't mean that it must explicitly
represent the implied connected-components relationship.
The practical reason for reifying a relationship is to be
able to attached other information about it. For example, one
might want to say that a particular connection is associated with
some shared parameters, or that it is of a particular type.

Connection objects are components and can therefore be subcomponents of other
components.  However, to provide for modular regularity in component systems,
this ontology prohibits one from connecting connection components.

For each pair of components related by connected-components, there exists
at least one connection object.  However, that object may not be unique,
and the same connection object may be associated with several pairs of
connected components.
  :iff-def (and (component ?x)
		(exists (?a ?b)
			(and (component ?a)
			     (component ?b)
			     (connects-components ?x ?a)
			     (connects-components ?x ?b)
			     (connected-components ?a ?b))))
  :constraints (minimum-value-cardinality ?x connects-components 2)
  :axiom-def (=> (connected-components ?a ?b)
		 (and (not (connection ?a))
		      (not (connection ?b)))))

(define-relation connects-components (?connection ?component)
  "Connects-components is a slot that maps from a connection object
to the components it connects.  Since components cannot be
connected to themselves, and there cannot be a connection object
without a connected-components relationship, then this slot
will always have at least two values.  Since connected-components
is symmetric, there is no information in the order of the values
of this slot (if order were significant, it would have a single
value that is a list)."
  ;; the slot cardinality constraint is part of the definition
  :def (and (connection ?connection)
	    (component ?component))

;;; Subpart slots

(define-relation HAS-SUBPART-SLOT (?component ?subpart-slot)
  "A component has an subpart if the subpart is given by a
unary function, called a subpart-slot, that is defined for
that component.  The value of a subpart slots on a component is
a subcomponent-of the component.
There may still be other subcomponents that aren't identified
by a named subpart slot.  Every slot that is the value of
has-subpart-slot of a component must have a value for that component."
  :def (and (component ?component)
            (subpart-slot ?subpart-slot)
	    (value-cardinality ?component ?subpart-slot 1)
	    (forall ?x
	       (=> (instance-of ?x ?component)
		   (subcomponent-of (value ?subpart-slot ?x)
  :issues ((:formerly-called has-subpart)))

(define-relation SUBPART-SLOT-OF (?part-slot ?component)
  "Part-Slot-of is the inverse of has-subpart-slot: it maps subpart slots
to the components to which they have been applied."
  :iff-def (has-subpart-slot ?component ?part-slot)
  :issues ((:formerly-called part-slot-of)))

(define-class SUBPART-SLOT (?unary-function)
  "A supart slot is a unary function from COMPONENTs
to other components.  It is antisymmetric and irreflexive."

  :def (and (unary-function ?unary-function)
            (domain ?unary-function component)
            (range ?unary-function component)
            (antisymmetric-relation ?unary-function)
            (irreflexive-relation ?unary-function))
  :issues (("Should subpart-slot be a partial order?")))

This Lisp-to-HTML translation was brought to you by
François Gerbaux and Tom Gruber