/*****************************************************************************/
/** Hyung-Sik PARK, U. of Iowa -- format: plain text                        **/
/*****************************************************************************/

		    A Unified Framework for
        	Object-Oriented Logic Programming

			Hyung-Sik Park
			Department of Computer Science
			University of Iowa
			Iowa City, IA 52242
			park@cs.uiowa.edu

Abstract

   Object-Oriented Logic Programming (OOLP) is one of the most promising 
approaches to developing both conventional and knowledge-based software 
systems by combining complementary features of object-oriented  programming 
and logic programming. During the last decade, a number of Object-Oriented 
Logic Programming Languages(OOLPs) have been developed. However, OOLPs still 
need a standard model unifying a variety of OOLP models, and also need to 
greatly improve its efficiency and portability. In this paper, we introduce 
several orthogonal dimensions for classifying and comparing a variety of 
OOLPs, and propose a unified framework for assertion-based OOLP.

1. Motivation

   Object-Oriented Logic Programming (OOLP) is one of the most promising 
approaches to developing both conventional and knowledge-based software 
systems. Object-oriented programming is the most powerful approach to 
coping with the inevitable changes in the design process of complex software 
systems through evolution [Cox, B. 1986; Meyer, B. 1988] with the equation 
"object-oriented = data abstraction + object types + type inheritance" 
[Cardelli, L., and Wegner, P 1985]. Logic programming (e.g. Prolog) allows us 
to declaratively specify real-world objects with the equation "algorithm = 
logic + control" [Kowalski, R. 1979]. 	

   Object-Oriented Programming Languages (OOLPs) combine complementary 
features of object-oriented and logic programming languages (e.g. Prolog). 
From the Prolog side, it takes specifiability (i.e. Prolog can be used as 
a specification language), extendibility (i.e. most changes of logic 
specification can be localized due to the context-independent meaning of 
clauses), and ease of formulating a variety of queries. From the O-O 
programming side, it takes reusability (i.e. reuse through inheritance, 
reuse through message passing, or reuse through copying), encapsulation 
through data abstraction, and information hiding (i.e. separating interface 
specification from its implementation). 	

   During the last decade, a number of Object-Oriented Logic Programming 
Languages (OOLPs) have been developed in the research community and in 
the industry. Those languages are based on several models for merging logic 
and objects. However, OOLPs still need a standard model unifying a variety 
of OOLP models, and also needs to greatly improve its efficiency and 
portability. In this paper, we introduce several orthogonal dimensions for 
classifying and comparing a variety of OOLPs, and propose a unified 
framework for assertion-based OOLP.

2. Classifying and Comparing OOLPs

   In this section, we introduce several orthogonal dimensions for classifying
OOLPs: 1) structure-based classification, 2) behavior-based classification, 3)
environment-based classification, and 4) functionality-based classification.
In the structure-based classification, OOLPs are classified into: a)
term-based OOLPs that treat user-defined terms as objects, b) fact-based OOLPs
that treat sets of unit clauses as objects, and c) clause-based OOLPs that
treat sets of clauses as objects. In the behavior-based classification, OOLPs
are classified into: a) assertion-based OOLPs that uses predicates
assert/retract to create instances and change instance variables, and b)
process-based OOLPs that treat perpetual concurrent processes as objects (i.e.
perpetual objects). A perpetual object is a process that calls itself
recursively and holds its internal state in unshared arguments [Shapiro, E.
and Takeuchi, A. 1983]. In the environment-based classification, OOLPs are
classified into: a) object-oriented OOLPs (e.g. Prolog/V) that implement logic
methods in an object-oriented programming environment, b) logic-oriented OOLPs
(e.g. ELSA-LAP) that implement objects in an logic programming environment,
and c) interface-based OOLPs (e.g. Boolean-bridge [Abbott 1987; Koschmann,
T., and Evens, M. W. 1988]) that implement an interface between an
object-oriented system and a logic programming system. In the
functionality-based classification, OOLPs can be characterized in terms of
various features supporting object-abstraction and can be classified into a
number of categories. Object abstraction [Park, H. 1990] is defined by an
equation: object-abstraction = connection-abstraction + data-abstraction +
knowledge-abstraction. In particular, object abstraction could be used as the
general criteria for comparing OOLPs.


3. A Unified Framework for Object-Oriented Logic Programming

              assertion-based  process-based
term-based        type1           type2
fact-based        type2           type5
clause-based      type3           type6

      Figuer 1  A classification of OOLPs

           AbstracKO
              AlphaKO
                   TypeKO..
                   RelationKO..
                   TaskKO..
               MetaKO
                   BetaKO..
                   GammaKO..
                   DeltaKO..

      Figure 2  A framework for application KOs


   Most of existing OOLPs can be classified as shown in figure 1: type 1 
(e.g. LOGIN[Ait-Kaci, H., and Nasr, R. 1986]), type 2 (e.g. POL[Gallaire, H. 
1986]), type 3 (e.g. Prolog/V[Digitalk, Inc.] and Orient84/K[Ishikawa, Y., 
and Tokoro, M. 1987]), type 4 (e.g. ????? ), type 5 (e.g. Vulcan[Kahn, K., 
Tribble, E.D., Miller, M.S., and Bobrow, D.G. 1987]), and type 6 (e.g. 
Mandara[Furukawa, K., et al. 1984]). 

   Based on this classification, we can think about two major frameworks 
(i.e. assertion- and process-based ones) to unify term-based, fact-based, 
and clause-based approaches. In this paper, we propose a unified framework 
for assertion-based OOLP. Figure 2 shows a framework for application KOs 
which unifies term-based, fact-based, and clause-based approaches through 
the assertion-based OOLP.  [IsTo87] defines the term "knowledge objects(KO)" 
with the following equation: KO = header part + knowledge base part + 
behavior part + monitor part. In order to provide a unified framework for 
prototyping knowledge objects through meta-abstraction (i.e. abstract object 
types), we redefine the term "knowledge object" in a more uniform way with 
the following equation:

   knowledge object = knowledge base + data operators + object connectors

   A knowledge base (or theory) KB  is a set of assertions (including 
facts/rules), where an assertion (or axiom) is a clause that is true in 
a theory. Data operators (e.g. predicates demo, insert, and delete) are 
predicates that manipulate knowledge bases as first class objects in the 
sense that data operators could use the surrogates of knowledge bases as 
arguments (i.e. terms). For example, the predicate demo(KO,Query) [Bowen, K. 
and Kowalski, R. 1982] is used to evaluate the goal Query with respect to a 
theory KO. Notice that we use terms and assertions interchangeably as data 
and knowledge respectively. Object connectors are predicates that model 
object hierarchy and communication. Object hierarchy models a permanent 
connection between knowledge objects through inheritance. Communication 
models a temporary connection between objects through message passing.

   This framework consists of abstract KOs forming a tree hierarchy, but 
application programs can form cycle-free networks by adding their own 
application-specific KOs to these abstract KOs with multiple inheritance. 
The root AbstractKO has two subKOs, AlphaKO and MetaKO. The AlphaKO is the 
object-level one that models real-world expertise. This KO has three subKOs 
(i.e. TypeKO, RelationKO, and TaskKO) to model real-world objects. The 
TypeKO models type information of entities. A TypeKO may have two subKOs: 
domainKOs and compositeKOs. The RelationKO models entities and relationships 
among entities. A RelationKO can be naturally interfaced with relational 
databases (or object-oriented databases). The TaskKO models general rules. 
A TaskKO can be used to model expertise through the analysis phase. Notice 
that TypeKOs, RelationKOs, and TaskKOs can be implemented so as to support 
term-based, fact-based, and clause-based OOLP, respectively. 

   The MetaKO may have several subKOs: BetaKO, GammaKO, and DeltaKO. The 
BetaKO is the meta-level one that models the structure and behavior about 
AlphaKOs (e.g. knowledge about representation and meta-control), the GammaKO 
is the meta-meta-level one that models the structure and behavior about 
BetaKOs, and so on. More intelligent systems needs a well-structured meta 
theory for these stratified meta-levels (i.e. Beta-, Gamma-, and Delta-KOs). 
However, it may be enough to specify only the beta-level KO in many 
practical applications. The BetaKO has three subKOs: BetaTypeKO, 
BetaRelationKO, and BetaTaskKO. The BetaRelationKO may have several types 
of subKOs including the BetaSpecKO and the BetaProofKO. In particular, the 
BetaSpecKO contains the specification of object-level representation and 
control. [Park, H. 1990] introduces the notion of abstract object types to 
specify knowledge objects. The BetaProofKO maintains the history of behavior 
(i.e. proof tree). The BetaTaskKO is to model the beta-level processes 
being composed of meta actions (e.g.  findNumberOfArguments).

4. Conclusion

   We believe that one of the most appropriate approaches to developing 
both conventional and knowledge-based software systems is to combine logic-
based analysis and object-oriented design through OOLP (Object-Oriented 
Logic Programming). However, there are still large gaps between the 
specification level and the implementation level due to the relative 
inefficiency of Prolog. To eliminate these large gaps, we need to develop 
a general framework (like the ideas of CASE) which will eventually automate 
most tedious tasks in the process of transforming the specification into an 
implementation through OOLP. 

   In this paper, we discussed several orthogonal dimensions for classifying 
and comparing OOLPs(Object-Oriented Logic Programming Languages) and 
proposed a unified framework for assertion-based OOLP. We have implemented 
the basic kernel of a prototyping environment called SmallLog [Park, H. 1991] 
which is based on the framework proposed in this paper. We are also 
designing a prototyping environment called C++Log which will merge C++ and 
Prolog. In the future, these systems will demonstrate that object-oriented 
logic programming could  gradually lead from the specification to an 
implementation through a series of formal transformation.

References

Abbott, R. Knowledge Abstraction. 1987. Communication ACM, (August), 
   pp. 664-671.

Ait-Kaci, H., and Nasr, R. 1986. LOGIN: A Logic Programming Language With 
   Built-In Inheritance. Journal of Logic Programming, Vol. 3, pp. 185-215. 

Bowen, K., and Kowalski, R. 1982. Amalgamating language and meta language 
   in logic programming. In Logic Programming, Clark, K and Tarnlund, S. 
   (eds.), Academic Press, pp. 153-172. 

Cardelli, L., and Wegner, P. 1985. On Understanding Types, Data Abstraction, 
    and Polymorphism. ACM Computing Surveys 17-4, pp. 471-522. 

Cox, B. 1986. Object Oriented Programming: An Evolutionary Approach. Addison 
    Wesley. 

Digitalk Inc.  Prolog/V documentation in Smalltalk/V Mac. 

Furukawa, K., et al. 1984. MANDARA: A Logic Based Knowledge Programming System.
     Proceedings of International Conference on Fifth Generation Computer 
     Systems, pp. 613-622. 

Gallaire, H. 1986. Merging Objects and Logic Programming: Relational Semantics.
     Proc. of AAAI-86, pp. 754-758. 

Ishikawa, Y., and Tokoro, M. 1987. Orient84/K: An Object-Oriented Concurrent 
     Programming Language for Knowledge Representation. In Object-Oriented 
     Concurrent Programming, Yonezawa, A. and Tokoro, M. (eds.), The MIT Press,
     pp. 159-198. 

Kahn, K., Tribble, E. D., Miller, M. S., and Bobrow, D. G. 1987. Vulcan: 
     Logical Concurrent Objects. In Research Directions in Object-Oriented 
     Programming, B. Shriver and P. Wegner (eds.), MIT Press, pp.75-112. 

Koschmann, T., and Evens, M. W. 1988. Bridging the Gap Between Object-Oriented 
     and Logic Programming. IEEE Software, Vol. 5, (July), pp. 36-42.

Kowalski, R. 1979. Algorithm = Logic + Control. C.ACM 22-7,  pp. 424-436. 

Meyer, B. 1988. Object-Oriented Software Construction. Prentice Hall.

Park, H. 1990. Abstract Object Types  = Abstract Knowledge Types +   Abstract 
     Data Types + Abstract Connector Types. Computer Science Tech. Report 
     TR90-4,  The University of Iowa, Iowa City, IA,  (To appear in Journal 
     of Object-Oriented Programming, June 1991). 

Park, H. 1991. A Unified Framework for Object-Oriented Design through Object-
     Oriented Logic Programming. To appear in Proceedings of the third 
     International Conference on Software Engineering and Knowledge 
     Engineering, Skokie, IL.

Shapiro, E. and Takeuchi, A. 1983. Object-Oriented Programming in Concurrent 
     Prolog. New Generation Computing Vol.1-1, pp.25-48. 
