9
3" 2 : from the Ana!ys!s Mode ls Design process in OO-Method obtains a forma! 00 specification from the result an t Analysis models. The main property of thi s process is that the specification is generated in an automated way by using a translator that converts graphic into a textual 00 specification. This specification, written in Oasis, constitutes a complete, formal System Repository. Object Model Information Management The whole system classes are obtained from the Object Model. Elementary classes in the CCD are translated into elementary Oasis classes, where we declare attributes variable and derived), static integrity constraints, derivation formulas for derived attributes and (private and shared) events . All th is informatio n is included in the source Object Model. Complex classes of the resultant Oasis specification come from every class relationship defined in the CCD with aggregation and inheritance (specialization and generalization). Dynamic Model Information Management. Trigger relationship s, event preconditions, process definition attached to any class and global interactions are obtained from the Dynamic Model with its two diagrams: State Transition Diagrams (STD) and Object Interaction Diagram (OlD). Given a class and it s corresponding STD, the information obtained includes preconditions and processes. Preconditions appear as transitions label s, and process definition is achieved as a result of every path associated with the diagram. In the figure 9 it can be seen specification paragrap hs th at are obtained from the STD of th e figure 8 for the class book. REA.;relurrif 8\1s ill'lbl6"'fels& Figure 8: STD corresponding to the class book

UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

32 ][)tSg~ OA~S genetr~ton from the Anayss Models

Design process in OO-Method obtains a forma 00 specification from the resultant Analysis

models The main property of this process is that the specification is generated in an automated way by

using a translator that converts graphic infor~ation into a textual 00 specification This spec ification

written in Oasis constitutes a complete formal System Repository

Object Model Information Management

The whole system classes are obtained from the Object Model Elementary classes in the CCD

are translated into elementary Oasis classes where we declare attributes (c~nstant variable and derived)

static integrity constraints derivation formulas for derived attributes and (private and shared) events All

th is informatio n is included in the source Object Model

Complex classes of the resultant Oasis specification come from every class relationship defined

in the CCD with aggregation and inheritance (specialization and generalization)

Dynamic Model Information Management

Trigger relationships event preconditions process definition attached to any class and global

interactions are obtained from the Dynamic Model with its two diagrams State Transition Diagrams

(STD) and Object Interaction Diagram (OlD)

Given a class and its corresponding STD the information obtained includes preconditions and

processes Preconditions appear as transitions labels and process definition is achieved as a result of

every path associated with the diagram In the figure 9 it can be seen specification paragrap hs th at are

obtained from the STD of th e figure 8 for the class book

REArelurri f 81s illlbl6felsamp

Figure 8 STD corresponding to the class book

As n exampJe we ob ail the following preconditions and processes sections of the

corresJonding Oasis soec ifi cation from th e previous diagram

precorditions

REA return if available=false

REP loan available=rue

UB destroy-book if available=true

processes BOOK=LlBnew_book bull BOOKO

BOOKO=REA Ioan bull BOOK1 + LIB destroLbook

BOOK1=REA returnmiddot BOOKO

Figure 9 Preconditions and processes sections for the book class

Triggers and global interactions sections of the resultant specification are also obtained in an

automated way from the 010 where all relevant information is included In figure 10 we see the OID

corresponding to the library example from where we obtain a trigger declaration for the book class (see

figure 11) or a global interaction ( figure 12 ) representing a execution involving an event of the reader

class followed by an event orthe librarian class

Figure 10 (simplified) Object Interaction Diagram for the Library

triggers

object buLcoPY if tirnes_not_ava ilablegt10

Figure 11 Book c lass trigger obta ined from the 01 D

~------------

global ntpra~i( ~

figure 12 GOb2 interactions obtained from the OO

FunctionalModel Information Management

Valuation formulas of the specification in Oasis are directly obtained from the information

extracted during the dialog with the Analyst while generating the Functional Model Lets see how to deal

wilh every atlrib te category

On one hand the problem is easy to solve when dealing with discrete-domain vailled attributes

as attribute values denoting valid situations have been introduced during the functional modelling

process as well as carrier actions we can directly build va luation formulas Next we show valuation

formulas related to table 7 generated in the previous Analysis step

valuations

[REA loan] available=false

(REA return] ava ilable=true

Figure 13 Valuation formulas for the available book class attribute

On the other hand when dealing with push-pop attributes we know the incremental and

decremental actions together with the function that precises the particular modification to be applied to

the object when the involved event is activated We also know also any potential reset action with the

corresponding argument fi xing the resultant attribute value For instance for attribute book_number of

class book we will have

valuations

book_number=N[REI loan] book_number=N+ 1

book_number= [REA rpturn] book_number-N-1

------~ Fiqure 14 Valua~ion for Ul 3 for thE attribute book__numbe r of e class reader

functional modelling process contains those actions assigning a new value to the involved attribute This

value is determined by an event argument The following formula refers to this situation and corresponds

to the information introduced in the table 6

valuations

[UB locate(B)] bookself=B

Figure 15 Valuation formula for the attribute bookself of book class

4- Conclussions

We have presented the main features of the OO-Method proposal with the obvious strict space

limitations focusing in its basic contributions the blending of well-known 00 methods with formal

specification languages and the automatic design and implementation from graphic models obtained in

the Analysis step In this way OO-Method comes close to the ideal of a rapid prototyping Software

Development environment for creating complex industrial strenght applications portable across many

platforms

At the moment graphic tools have been developed ([PeI94)) to support the Methodology in both

declarative and imperative environments ([Pen94Pas96-2]) using Relational and Object Oriented servers

A Windows-based Case tool is about to be delivered in the context of a University-Enterprise Contract

managed by the Computing Technology Institute of Valencia The objective of this project whose

scheduled deadline date is on May 3011 1996 is to generate an industrial Case tool fully OO-Method

compliant using well-known visual programming environments (Delphi PowerBuilder ) for code

generation

References

[80094] 800chG Objec t Oriented Design with Applications The Benjam inCumm ings Publ ishing Company Inc 1994

[Har94] Hartmann T SaakeG JungclausR HartelPKusch J Rev ised Version 0 the Modelling Language Troll (Troll version 20) Technische Universital 8raunschweig lnformatik-Berichte 94-03 April 1994

[h e92) Jae8j501 IChltstesol rJosson Overgaard G ObjecI Oriented Sof tware EIg ~~er 1g a Use Case Driven Approach Reading Massachusetts Addison -Vesey

[Pas91] PastorOCasamayor JC A Deductive and Object Oriented Environment lor Software Production Proc of the Workshop in Expert SystemsAi and Software Engineering Application lLPS-91 San Diego USA

[Pas92- [] PastorOHayesFBearS OASIS An Object Oriented Specification Language CAiSE92 LCNS 593 pags 348-36j Springer Verlag

[Pas92-2] Pastor 0 DiseFio y Desarrollo de un Entorno de Produccion A utomatica de Sojiware basado en el Modelo Orientado a Objetos Phd Thesis managed by Isidro Ramos [992 DSIC-UPV (Valencia)

[pas92-3] PastorO OO-METHOD An Object Oriented Methodology lor Software Production ell Actas de DEXA 92 Spriger-Verlag pags 12 J-127 [SBN 3-211-82400-6

[Pas93] PastorORamoslCanos 1H From Analysis to Design in an Object Oriented and Deductive Environment DSXA 93 LCNS 720 pags667-673 Springer-Verlag

(Pas95] PastorO Ramos I Oasis 2 I I A Class-DeJtnition Language to Model Inormation Systems Using an Object-Oriented Approach February 94 (I a ed) Mars 95 (2 ed) October 95 (3 de)

[Pas96- I] PastorOPelechano V BonetB Ramos l OO-Method 20 una metodologia de An6isis y DiseFio Orientacla a Objetos Technical Report DSIC-UPV 1996

[Pas96-2] PastorOMeseguerJRomeroJ I3arberaJM Descripcion del entomo graJtco de la herramienta CASE OO-METHOD Technical Report DSIC-UPV 1996

[Pas96-3] PastorOPei echanoV BonetB Ramos I Using OO-Method a practical guide to software modeling Technical Report DSIC-UPV 1996

[PeI94] Pelechano V OO-Method Implementacion de un entomo graJtco para el Analisis y DiseFio de Sistemas de Inormacion Orientados a Objeto Proyecto Fin de Carrera managed byr Oscar Pastor December 94 Facultat dlnformatica Universitat Politecnica de Valencia

[Pen94] Penades MC Actualizaciones ConsullaS y Programas en una Base de Datos Orientada a Objetos Proyecto Fin de Carrera managed by JH Canos Facultat dinformatica Universitat Politecnica de Valencia

[Ser87] SernadasASernadasCEhrichHD Object-Oriented Specification 0 Databases An Algebraic Approach In PMStocker WKent eds Proc VLDB 87 pg-107-116 Morgan Kaufmann 1987

[Ram90] Ramos l Logic and 00 Databases a Declarative Approach Porc of the Dexa 90 SpringershyVerlag J990

[Ram92] Ramos1PastorOCanos1 H On the use 0Algebras as Semantic Domains oObject Societies In the Proc of the 3rd International Workshop of the deductive Approach for DB an IS Roses (Costa B~ava) 1992

[Ram93] RamoslPastorO CuevasJDevesaJObjects as Observable Processes Proceedings of the 3rd Workshop on the Deductive Approach to Information System Design Roses Costa Brava 1993

[Rum9l] Rumbaugh JBlaha M Permerlani W Eddy FLorensen W Object Oriented Modeling and Design Englewood Cliffs Nj Prentice-Hall

[Wir90] Wirfs-Brock RWilkerson BWiener L Designing Object Oriented Software Englewood Cliffs NJ Prentice- Hall

- Knowedge~Base Ar(h~tecturc

f r Object Societies

Jose H Can6s Me Penadcs 1 Ramos and O Pastor

T)epart~rnent de Sistcmes Informati cs i Computac6 ) ersi lat Poiitccnica de VaieIlCi

Camf de Vera sIn E-46071 Valencia (Spain)

jhcanosds i c upv es

Abstract

This paper introduces I(AOS a Deductive Active and Object-Oriented Database Management System (DAOODBMS) built at DSIC over a Knowledge-Base Management System (KBMS) We have based its construction on the advantages of such a system so we have definitely made what we could call an object layer on top of the knowledge-based systems An operational prototype that is a first version of a DAOODBMS compliant with almost all characteristics coliected in documents Sitch as the OODBMS Manifesto and the standard ODMG-93 is currently available OIi fP-UX workstations

1 Introduction

Despite the great efforts that the Information Management Community has made in the last few months to establish a standard model for ODBMS at every level (Object Definition Language (ODL) Object Management Language (OML) Object Query Language (OQL) etc) the main ideas oftbe object paradigm diminish as the abstraction level decreases to the physical level where we can find records in the purest relational style This represents a serious interface mismatch against the object model we are trying to implement

This paper introduces KAOS a DAOODBMS built at DSIC with the aim of reducing the impedance mismatch described above JJ1 fact it is a system where only one language is used as ODL OQL and OML (database programming language) The KAOS system starts from the object model underlying OASIS a formal specification language ([1]) which uses dynamic logics to describe (the state and) the behaviour of objects through well-formed formulae on these logics A declarative semantics based on Kopke structures ([2]) and a Plotkin-style operational semantics ([3]) have converted OASIS in to a very suitable tool for rapid prototyping as well as for becoming the unified language we mentioned earlier

We will first introduce KBMS1 ([4]) he system on which KAOS was built Next we will write about the implementation of the OASIS model over KBMS 1 and will finish showing the system architecture and describing its basic features We are not dealing here about how KAOS is (almost) full Manifesto ([5]) and ODMG-93 ([6]) compliant neither with how the OASIS language has become the only language to interact with the system For more infonnalion about lhcse topi cs pJease see [78]

111 I ~Jt I1

KBMS1 is a Knowledge-Base Management System developed at the Hewlett-Packard Laboratories in Bristol UK IL is a logic programming-based tool that allows for the storage retrieval and update of large amounts of knowledge By knowledge we mean sets of (Hom) clauses written in kbProlog a Prolog language extended with theories and primitives to handle there theories

The theories provide a partltlOning of the knowledge base (KB) a theory is an unordered set of procedures (a procedure being an ordered set of Hom clauses with the same functor and arity of the atom on their heads) They are flrst class objects and their updates are treated in a declarative manner so that a program is not able to produce side-effecting updates on itself as happens with assert and retract in Prolog We may then make deductions over theories that are not updated at deduction time

There are two ways to refer to theories through their name and through their theory identifier A special kind of Lheories the so-called system theories contains all the other theories defined in the knowledge system They provide the logical organisation of theodes and their metatheories and store the system~ staLe represented by the contents of the theories it contains at a given moment

Each theory has three meta-theories associated to it the interpreter theory the assimilator theory and the attribute theory

Interpreter Assimilator

Theory

Attribute Theory

Melalhcories

Figure 1 Internl representation of a kbProiog theory

The interpreter theories are the query interface for theories (every query to a theory is handled by its interpreter) To query a theory we have to use the kbProlog predicate prove (Thry I Qry S) by which we are asking the theory Thry the query Qry in the state of the system represented by the system theory S Qry may be any Prolog goal we wish to demonstrate in Thry

Similarly assimilator theories are the updating interface for theories To make changes in a theory we must use the predicate upda te (Thry I Upd I S I NewS) by which we produce the update Upd in Thry switching from a system state S to a new one NewS in which Thry has already been updated (we can consider that NewS=Upd ( S) )

2

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 2: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

As n exampJe we ob ail the following preconditions and processes sections of the

corresJonding Oasis soec ifi cation from th e previous diagram

precorditions

REA return if available=false

REP loan available=rue

UB destroy-book if available=true

processes BOOK=LlBnew_book bull BOOKO

BOOKO=REA Ioan bull BOOK1 + LIB destroLbook

BOOK1=REA returnmiddot BOOKO

Figure 9 Preconditions and processes sections for the book class

Triggers and global interactions sections of the resultant specification are also obtained in an

automated way from the 010 where all relevant information is included In figure 10 we see the OID

corresponding to the library example from where we obtain a trigger declaration for the book class (see

figure 11) or a global interaction ( figure 12 ) representing a execution involving an event of the reader

class followed by an event orthe librarian class

Figure 10 (simplified) Object Interaction Diagram for the Library

triggers

object buLcoPY if tirnes_not_ava ilablegt10

Figure 11 Book c lass trigger obta ined from the 01 D

~------------

global ntpra~i( ~

figure 12 GOb2 interactions obtained from the OO

FunctionalModel Information Management

Valuation formulas of the specification in Oasis are directly obtained from the information

extracted during the dialog with the Analyst while generating the Functional Model Lets see how to deal

wilh every atlrib te category

On one hand the problem is easy to solve when dealing with discrete-domain vailled attributes

as attribute values denoting valid situations have been introduced during the functional modelling

process as well as carrier actions we can directly build va luation formulas Next we show valuation

formulas related to table 7 generated in the previous Analysis step

valuations

[REA loan] available=false

(REA return] ava ilable=true

Figure 13 Valuation formulas for the available book class attribute

On the other hand when dealing with push-pop attributes we know the incremental and

decremental actions together with the function that precises the particular modification to be applied to

the object when the involved event is activated We also know also any potential reset action with the

corresponding argument fi xing the resultant attribute value For instance for attribute book_number of

class book we will have

valuations

book_number=N[REI loan] book_number=N+ 1

book_number= [REA rpturn] book_number-N-1

------~ Fiqure 14 Valua~ion for Ul 3 for thE attribute book__numbe r of e class reader

functional modelling process contains those actions assigning a new value to the involved attribute This

value is determined by an event argument The following formula refers to this situation and corresponds

to the information introduced in the table 6

valuations

[UB locate(B)] bookself=B

Figure 15 Valuation formula for the attribute bookself of book class

4- Conclussions

We have presented the main features of the OO-Method proposal with the obvious strict space

limitations focusing in its basic contributions the blending of well-known 00 methods with formal

specification languages and the automatic design and implementation from graphic models obtained in

the Analysis step In this way OO-Method comes close to the ideal of a rapid prototyping Software

Development environment for creating complex industrial strenght applications portable across many

platforms

At the moment graphic tools have been developed ([PeI94)) to support the Methodology in both

declarative and imperative environments ([Pen94Pas96-2]) using Relational and Object Oriented servers

A Windows-based Case tool is about to be delivered in the context of a University-Enterprise Contract

managed by the Computing Technology Institute of Valencia The objective of this project whose

scheduled deadline date is on May 3011 1996 is to generate an industrial Case tool fully OO-Method

compliant using well-known visual programming environments (Delphi PowerBuilder ) for code

generation

References

[80094] 800chG Objec t Oriented Design with Applications The Benjam inCumm ings Publ ishing Company Inc 1994

[Har94] Hartmann T SaakeG JungclausR HartelPKusch J Rev ised Version 0 the Modelling Language Troll (Troll version 20) Technische Universital 8raunschweig lnformatik-Berichte 94-03 April 1994

[h e92) Jae8j501 IChltstesol rJosson Overgaard G ObjecI Oriented Sof tware EIg ~~er 1g a Use Case Driven Approach Reading Massachusetts Addison -Vesey

[Pas91] PastorOCasamayor JC A Deductive and Object Oriented Environment lor Software Production Proc of the Workshop in Expert SystemsAi and Software Engineering Application lLPS-91 San Diego USA

[Pas92- [] PastorOHayesFBearS OASIS An Object Oriented Specification Language CAiSE92 LCNS 593 pags 348-36j Springer Verlag

[Pas92-2] Pastor 0 DiseFio y Desarrollo de un Entorno de Produccion A utomatica de Sojiware basado en el Modelo Orientado a Objetos Phd Thesis managed by Isidro Ramos [992 DSIC-UPV (Valencia)

[pas92-3] PastorO OO-METHOD An Object Oriented Methodology lor Software Production ell Actas de DEXA 92 Spriger-Verlag pags 12 J-127 [SBN 3-211-82400-6

[Pas93] PastorORamoslCanos 1H From Analysis to Design in an Object Oriented and Deductive Environment DSXA 93 LCNS 720 pags667-673 Springer-Verlag

(Pas95] PastorO Ramos I Oasis 2 I I A Class-DeJtnition Language to Model Inormation Systems Using an Object-Oriented Approach February 94 (I a ed) Mars 95 (2 ed) October 95 (3 de)

[Pas96- I] PastorOPelechano V BonetB Ramos l OO-Method 20 una metodologia de An6isis y DiseFio Orientacla a Objetos Technical Report DSIC-UPV 1996

[Pas96-2] PastorOMeseguerJRomeroJ I3arberaJM Descripcion del entomo graJtco de la herramienta CASE OO-METHOD Technical Report DSIC-UPV 1996

[Pas96-3] PastorOPei echanoV BonetB Ramos I Using OO-Method a practical guide to software modeling Technical Report DSIC-UPV 1996

[PeI94] Pelechano V OO-Method Implementacion de un entomo graJtco para el Analisis y DiseFio de Sistemas de Inormacion Orientados a Objeto Proyecto Fin de Carrera managed byr Oscar Pastor December 94 Facultat dlnformatica Universitat Politecnica de Valencia

[Pen94] Penades MC Actualizaciones ConsullaS y Programas en una Base de Datos Orientada a Objetos Proyecto Fin de Carrera managed by JH Canos Facultat dinformatica Universitat Politecnica de Valencia

[Ser87] SernadasASernadasCEhrichHD Object-Oriented Specification 0 Databases An Algebraic Approach In PMStocker WKent eds Proc VLDB 87 pg-107-116 Morgan Kaufmann 1987

[Ram90] Ramos l Logic and 00 Databases a Declarative Approach Porc of the Dexa 90 SpringershyVerlag J990

[Ram92] Ramos1PastorOCanos1 H On the use 0Algebras as Semantic Domains oObject Societies In the Proc of the 3rd International Workshop of the deductive Approach for DB an IS Roses (Costa B~ava) 1992

[Ram93] RamoslPastorO CuevasJDevesaJObjects as Observable Processes Proceedings of the 3rd Workshop on the Deductive Approach to Information System Design Roses Costa Brava 1993

[Rum9l] Rumbaugh JBlaha M Permerlani W Eddy FLorensen W Object Oriented Modeling and Design Englewood Cliffs Nj Prentice-Hall

[Wir90] Wirfs-Brock RWilkerson BWiener L Designing Object Oriented Software Englewood Cliffs NJ Prentice- Hall

- Knowedge~Base Ar(h~tecturc

f r Object Societies

Jose H Can6s Me Penadcs 1 Ramos and O Pastor

T)epart~rnent de Sistcmes Informati cs i Computac6 ) ersi lat Poiitccnica de VaieIlCi

Camf de Vera sIn E-46071 Valencia (Spain)

jhcanosds i c upv es

Abstract

This paper introduces I(AOS a Deductive Active and Object-Oriented Database Management System (DAOODBMS) built at DSIC over a Knowledge-Base Management System (KBMS) We have based its construction on the advantages of such a system so we have definitely made what we could call an object layer on top of the knowledge-based systems An operational prototype that is a first version of a DAOODBMS compliant with almost all characteristics coliected in documents Sitch as the OODBMS Manifesto and the standard ODMG-93 is currently available OIi fP-UX workstations

1 Introduction

Despite the great efforts that the Information Management Community has made in the last few months to establish a standard model for ODBMS at every level (Object Definition Language (ODL) Object Management Language (OML) Object Query Language (OQL) etc) the main ideas oftbe object paradigm diminish as the abstraction level decreases to the physical level where we can find records in the purest relational style This represents a serious interface mismatch against the object model we are trying to implement

This paper introduces KAOS a DAOODBMS built at DSIC with the aim of reducing the impedance mismatch described above JJ1 fact it is a system where only one language is used as ODL OQL and OML (database programming language) The KAOS system starts from the object model underlying OASIS a formal specification language ([1]) which uses dynamic logics to describe (the state and) the behaviour of objects through well-formed formulae on these logics A declarative semantics based on Kopke structures ([2]) and a Plotkin-style operational semantics ([3]) have converted OASIS in to a very suitable tool for rapid prototyping as well as for becoming the unified language we mentioned earlier

We will first introduce KBMS1 ([4]) he system on which KAOS was built Next we will write about the implementation of the OASIS model over KBMS 1 and will finish showing the system architecture and describing its basic features We are not dealing here about how KAOS is (almost) full Manifesto ([5]) and ODMG-93 ([6]) compliant neither with how the OASIS language has become the only language to interact with the system For more infonnalion about lhcse topi cs pJease see [78]

111 I ~Jt I1

KBMS1 is a Knowledge-Base Management System developed at the Hewlett-Packard Laboratories in Bristol UK IL is a logic programming-based tool that allows for the storage retrieval and update of large amounts of knowledge By knowledge we mean sets of (Hom) clauses written in kbProlog a Prolog language extended with theories and primitives to handle there theories

The theories provide a partltlOning of the knowledge base (KB) a theory is an unordered set of procedures (a procedure being an ordered set of Hom clauses with the same functor and arity of the atom on their heads) They are flrst class objects and their updates are treated in a declarative manner so that a program is not able to produce side-effecting updates on itself as happens with assert and retract in Prolog We may then make deductions over theories that are not updated at deduction time

There are two ways to refer to theories through their name and through their theory identifier A special kind of Lheories the so-called system theories contains all the other theories defined in the knowledge system They provide the logical organisation of theodes and their metatheories and store the system~ staLe represented by the contents of the theories it contains at a given moment

Each theory has three meta-theories associated to it the interpreter theory the assimilator theory and the attribute theory

Interpreter Assimilator

Theory

Attribute Theory

Melalhcories

Figure 1 Internl representation of a kbProiog theory

The interpreter theories are the query interface for theories (every query to a theory is handled by its interpreter) To query a theory we have to use the kbProlog predicate prove (Thry I Qry S) by which we are asking the theory Thry the query Qry in the state of the system represented by the system theory S Qry may be any Prolog goal we wish to demonstrate in Thry

Similarly assimilator theories are the updating interface for theories To make changes in a theory we must use the predicate upda te (Thry I Upd I S I NewS) by which we produce the update Upd in Thry switching from a system state S to a new one NewS in which Thry has already been updated (we can consider that NewS=Upd ( S) )

2

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 3: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

~------------

global ntpra~i( ~

figure 12 GOb2 interactions obtained from the OO

FunctionalModel Information Management

Valuation formulas of the specification in Oasis are directly obtained from the information

extracted during the dialog with the Analyst while generating the Functional Model Lets see how to deal

wilh every atlrib te category

On one hand the problem is easy to solve when dealing with discrete-domain vailled attributes

as attribute values denoting valid situations have been introduced during the functional modelling

process as well as carrier actions we can directly build va luation formulas Next we show valuation

formulas related to table 7 generated in the previous Analysis step

valuations

[REA loan] available=false

(REA return] ava ilable=true

Figure 13 Valuation formulas for the available book class attribute

On the other hand when dealing with push-pop attributes we know the incremental and

decremental actions together with the function that precises the particular modification to be applied to

the object when the involved event is activated We also know also any potential reset action with the

corresponding argument fi xing the resultant attribute value For instance for attribute book_number of

class book we will have

valuations

book_number=N[REI loan] book_number=N+ 1

book_number= [REA rpturn] book_number-N-1

------~ Fiqure 14 Valua~ion for Ul 3 for thE attribute book__numbe r of e class reader

functional modelling process contains those actions assigning a new value to the involved attribute This

value is determined by an event argument The following formula refers to this situation and corresponds

to the information introduced in the table 6

valuations

[UB locate(B)] bookself=B

Figure 15 Valuation formula for the attribute bookself of book class

4- Conclussions

We have presented the main features of the OO-Method proposal with the obvious strict space

limitations focusing in its basic contributions the blending of well-known 00 methods with formal

specification languages and the automatic design and implementation from graphic models obtained in

the Analysis step In this way OO-Method comes close to the ideal of a rapid prototyping Software

Development environment for creating complex industrial strenght applications portable across many

platforms

At the moment graphic tools have been developed ([PeI94)) to support the Methodology in both

declarative and imperative environments ([Pen94Pas96-2]) using Relational and Object Oriented servers

A Windows-based Case tool is about to be delivered in the context of a University-Enterprise Contract

managed by the Computing Technology Institute of Valencia The objective of this project whose

scheduled deadline date is on May 3011 1996 is to generate an industrial Case tool fully OO-Method

compliant using well-known visual programming environments (Delphi PowerBuilder ) for code

generation

References

[80094] 800chG Objec t Oriented Design with Applications The Benjam inCumm ings Publ ishing Company Inc 1994

[Har94] Hartmann T SaakeG JungclausR HartelPKusch J Rev ised Version 0 the Modelling Language Troll (Troll version 20) Technische Universital 8raunschweig lnformatik-Berichte 94-03 April 1994

[h e92) Jae8j501 IChltstesol rJosson Overgaard G ObjecI Oriented Sof tware EIg ~~er 1g a Use Case Driven Approach Reading Massachusetts Addison -Vesey

[Pas91] PastorOCasamayor JC A Deductive and Object Oriented Environment lor Software Production Proc of the Workshop in Expert SystemsAi and Software Engineering Application lLPS-91 San Diego USA

[Pas92- [] PastorOHayesFBearS OASIS An Object Oriented Specification Language CAiSE92 LCNS 593 pags 348-36j Springer Verlag

[Pas92-2] Pastor 0 DiseFio y Desarrollo de un Entorno de Produccion A utomatica de Sojiware basado en el Modelo Orientado a Objetos Phd Thesis managed by Isidro Ramos [992 DSIC-UPV (Valencia)

[pas92-3] PastorO OO-METHOD An Object Oriented Methodology lor Software Production ell Actas de DEXA 92 Spriger-Verlag pags 12 J-127 [SBN 3-211-82400-6

[Pas93] PastorORamoslCanos 1H From Analysis to Design in an Object Oriented and Deductive Environment DSXA 93 LCNS 720 pags667-673 Springer-Verlag

(Pas95] PastorO Ramos I Oasis 2 I I A Class-DeJtnition Language to Model Inormation Systems Using an Object-Oriented Approach February 94 (I a ed) Mars 95 (2 ed) October 95 (3 de)

[Pas96- I] PastorOPelechano V BonetB Ramos l OO-Method 20 una metodologia de An6isis y DiseFio Orientacla a Objetos Technical Report DSIC-UPV 1996

[Pas96-2] PastorOMeseguerJRomeroJ I3arberaJM Descripcion del entomo graJtco de la herramienta CASE OO-METHOD Technical Report DSIC-UPV 1996

[Pas96-3] PastorOPei echanoV BonetB Ramos I Using OO-Method a practical guide to software modeling Technical Report DSIC-UPV 1996

[PeI94] Pelechano V OO-Method Implementacion de un entomo graJtco para el Analisis y DiseFio de Sistemas de Inormacion Orientados a Objeto Proyecto Fin de Carrera managed byr Oscar Pastor December 94 Facultat dlnformatica Universitat Politecnica de Valencia

[Pen94] Penades MC Actualizaciones ConsullaS y Programas en una Base de Datos Orientada a Objetos Proyecto Fin de Carrera managed by JH Canos Facultat dinformatica Universitat Politecnica de Valencia

[Ser87] SernadasASernadasCEhrichHD Object-Oriented Specification 0 Databases An Algebraic Approach In PMStocker WKent eds Proc VLDB 87 pg-107-116 Morgan Kaufmann 1987

[Ram90] Ramos l Logic and 00 Databases a Declarative Approach Porc of the Dexa 90 SpringershyVerlag J990

[Ram92] Ramos1PastorOCanos1 H On the use 0Algebras as Semantic Domains oObject Societies In the Proc of the 3rd International Workshop of the deductive Approach for DB an IS Roses (Costa B~ava) 1992

[Ram93] RamoslPastorO CuevasJDevesaJObjects as Observable Processes Proceedings of the 3rd Workshop on the Deductive Approach to Information System Design Roses Costa Brava 1993

[Rum9l] Rumbaugh JBlaha M Permerlani W Eddy FLorensen W Object Oriented Modeling and Design Englewood Cliffs Nj Prentice-Hall

[Wir90] Wirfs-Brock RWilkerson BWiener L Designing Object Oriented Software Englewood Cliffs NJ Prentice- Hall

- Knowedge~Base Ar(h~tecturc

f r Object Societies

Jose H Can6s Me Penadcs 1 Ramos and O Pastor

T)epart~rnent de Sistcmes Informati cs i Computac6 ) ersi lat Poiitccnica de VaieIlCi

Camf de Vera sIn E-46071 Valencia (Spain)

jhcanosds i c upv es

Abstract

This paper introduces I(AOS a Deductive Active and Object-Oriented Database Management System (DAOODBMS) built at DSIC over a Knowledge-Base Management System (KBMS) We have based its construction on the advantages of such a system so we have definitely made what we could call an object layer on top of the knowledge-based systems An operational prototype that is a first version of a DAOODBMS compliant with almost all characteristics coliected in documents Sitch as the OODBMS Manifesto and the standard ODMG-93 is currently available OIi fP-UX workstations

1 Introduction

Despite the great efforts that the Information Management Community has made in the last few months to establish a standard model for ODBMS at every level (Object Definition Language (ODL) Object Management Language (OML) Object Query Language (OQL) etc) the main ideas oftbe object paradigm diminish as the abstraction level decreases to the physical level where we can find records in the purest relational style This represents a serious interface mismatch against the object model we are trying to implement

This paper introduces KAOS a DAOODBMS built at DSIC with the aim of reducing the impedance mismatch described above JJ1 fact it is a system where only one language is used as ODL OQL and OML (database programming language) The KAOS system starts from the object model underlying OASIS a formal specification language ([1]) which uses dynamic logics to describe (the state and) the behaviour of objects through well-formed formulae on these logics A declarative semantics based on Kopke structures ([2]) and a Plotkin-style operational semantics ([3]) have converted OASIS in to a very suitable tool for rapid prototyping as well as for becoming the unified language we mentioned earlier

We will first introduce KBMS1 ([4]) he system on which KAOS was built Next we will write about the implementation of the OASIS model over KBMS 1 and will finish showing the system architecture and describing its basic features We are not dealing here about how KAOS is (almost) full Manifesto ([5]) and ODMG-93 ([6]) compliant neither with how the OASIS language has become the only language to interact with the system For more infonnalion about lhcse topi cs pJease see [78]

111 I ~Jt I1

KBMS1 is a Knowledge-Base Management System developed at the Hewlett-Packard Laboratories in Bristol UK IL is a logic programming-based tool that allows for the storage retrieval and update of large amounts of knowledge By knowledge we mean sets of (Hom) clauses written in kbProlog a Prolog language extended with theories and primitives to handle there theories

The theories provide a partltlOning of the knowledge base (KB) a theory is an unordered set of procedures (a procedure being an ordered set of Hom clauses with the same functor and arity of the atom on their heads) They are flrst class objects and their updates are treated in a declarative manner so that a program is not able to produce side-effecting updates on itself as happens with assert and retract in Prolog We may then make deductions over theories that are not updated at deduction time

There are two ways to refer to theories through their name and through their theory identifier A special kind of Lheories the so-called system theories contains all the other theories defined in the knowledge system They provide the logical organisation of theodes and their metatheories and store the system~ staLe represented by the contents of the theories it contains at a given moment

Each theory has three meta-theories associated to it the interpreter theory the assimilator theory and the attribute theory

Interpreter Assimilator

Theory

Attribute Theory

Melalhcories

Figure 1 Internl representation of a kbProiog theory

The interpreter theories are the query interface for theories (every query to a theory is handled by its interpreter) To query a theory we have to use the kbProlog predicate prove (Thry I Qry S) by which we are asking the theory Thry the query Qry in the state of the system represented by the system theory S Qry may be any Prolog goal we wish to demonstrate in Thry

Similarly assimilator theories are the updating interface for theories To make changes in a theory we must use the predicate upda te (Thry I Upd I S I NewS) by which we produce the update Upd in Thry switching from a system state S to a new one NewS in which Thry has already been updated (we can consider that NewS=Upd ( S) )

2

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 4: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

functional modelling process contains those actions assigning a new value to the involved attribute This

value is determined by an event argument The following formula refers to this situation and corresponds

to the information introduced in the table 6

valuations

[UB locate(B)] bookself=B

Figure 15 Valuation formula for the attribute bookself of book class

4- Conclussions

We have presented the main features of the OO-Method proposal with the obvious strict space

limitations focusing in its basic contributions the blending of well-known 00 methods with formal

specification languages and the automatic design and implementation from graphic models obtained in

the Analysis step In this way OO-Method comes close to the ideal of a rapid prototyping Software

Development environment for creating complex industrial strenght applications portable across many

platforms

At the moment graphic tools have been developed ([PeI94)) to support the Methodology in both

declarative and imperative environments ([Pen94Pas96-2]) using Relational and Object Oriented servers

A Windows-based Case tool is about to be delivered in the context of a University-Enterprise Contract

managed by the Computing Technology Institute of Valencia The objective of this project whose

scheduled deadline date is on May 3011 1996 is to generate an industrial Case tool fully OO-Method

compliant using well-known visual programming environments (Delphi PowerBuilder ) for code

generation

References

[80094] 800chG Objec t Oriented Design with Applications The Benjam inCumm ings Publ ishing Company Inc 1994

[Har94] Hartmann T SaakeG JungclausR HartelPKusch J Rev ised Version 0 the Modelling Language Troll (Troll version 20) Technische Universital 8raunschweig lnformatik-Berichte 94-03 April 1994

[h e92) Jae8j501 IChltstesol rJosson Overgaard G ObjecI Oriented Sof tware EIg ~~er 1g a Use Case Driven Approach Reading Massachusetts Addison -Vesey

[Pas91] PastorOCasamayor JC A Deductive and Object Oriented Environment lor Software Production Proc of the Workshop in Expert SystemsAi and Software Engineering Application lLPS-91 San Diego USA

[Pas92- [] PastorOHayesFBearS OASIS An Object Oriented Specification Language CAiSE92 LCNS 593 pags 348-36j Springer Verlag

[Pas92-2] Pastor 0 DiseFio y Desarrollo de un Entorno de Produccion A utomatica de Sojiware basado en el Modelo Orientado a Objetos Phd Thesis managed by Isidro Ramos [992 DSIC-UPV (Valencia)

[pas92-3] PastorO OO-METHOD An Object Oriented Methodology lor Software Production ell Actas de DEXA 92 Spriger-Verlag pags 12 J-127 [SBN 3-211-82400-6

[Pas93] PastorORamoslCanos 1H From Analysis to Design in an Object Oriented and Deductive Environment DSXA 93 LCNS 720 pags667-673 Springer-Verlag

(Pas95] PastorO Ramos I Oasis 2 I I A Class-DeJtnition Language to Model Inormation Systems Using an Object-Oriented Approach February 94 (I a ed) Mars 95 (2 ed) October 95 (3 de)

[Pas96- I] PastorOPelechano V BonetB Ramos l OO-Method 20 una metodologia de An6isis y DiseFio Orientacla a Objetos Technical Report DSIC-UPV 1996

[Pas96-2] PastorOMeseguerJRomeroJ I3arberaJM Descripcion del entomo graJtco de la herramienta CASE OO-METHOD Technical Report DSIC-UPV 1996

[Pas96-3] PastorOPei echanoV BonetB Ramos I Using OO-Method a practical guide to software modeling Technical Report DSIC-UPV 1996

[PeI94] Pelechano V OO-Method Implementacion de un entomo graJtco para el Analisis y DiseFio de Sistemas de Inormacion Orientados a Objeto Proyecto Fin de Carrera managed byr Oscar Pastor December 94 Facultat dlnformatica Universitat Politecnica de Valencia

[Pen94] Penades MC Actualizaciones ConsullaS y Programas en una Base de Datos Orientada a Objetos Proyecto Fin de Carrera managed by JH Canos Facultat dinformatica Universitat Politecnica de Valencia

[Ser87] SernadasASernadasCEhrichHD Object-Oriented Specification 0 Databases An Algebraic Approach In PMStocker WKent eds Proc VLDB 87 pg-107-116 Morgan Kaufmann 1987

[Ram90] Ramos l Logic and 00 Databases a Declarative Approach Porc of the Dexa 90 SpringershyVerlag J990

[Ram92] Ramos1PastorOCanos1 H On the use 0Algebras as Semantic Domains oObject Societies In the Proc of the 3rd International Workshop of the deductive Approach for DB an IS Roses (Costa B~ava) 1992

[Ram93] RamoslPastorO CuevasJDevesaJObjects as Observable Processes Proceedings of the 3rd Workshop on the Deductive Approach to Information System Design Roses Costa Brava 1993

[Rum9l] Rumbaugh JBlaha M Permerlani W Eddy FLorensen W Object Oriented Modeling and Design Englewood Cliffs Nj Prentice-Hall

[Wir90] Wirfs-Brock RWilkerson BWiener L Designing Object Oriented Software Englewood Cliffs NJ Prentice- Hall

- Knowedge~Base Ar(h~tecturc

f r Object Societies

Jose H Can6s Me Penadcs 1 Ramos and O Pastor

T)epart~rnent de Sistcmes Informati cs i Computac6 ) ersi lat Poiitccnica de VaieIlCi

Camf de Vera sIn E-46071 Valencia (Spain)

jhcanosds i c upv es

Abstract

This paper introduces I(AOS a Deductive Active and Object-Oriented Database Management System (DAOODBMS) built at DSIC over a Knowledge-Base Management System (KBMS) We have based its construction on the advantages of such a system so we have definitely made what we could call an object layer on top of the knowledge-based systems An operational prototype that is a first version of a DAOODBMS compliant with almost all characteristics coliected in documents Sitch as the OODBMS Manifesto and the standard ODMG-93 is currently available OIi fP-UX workstations

1 Introduction

Despite the great efforts that the Information Management Community has made in the last few months to establish a standard model for ODBMS at every level (Object Definition Language (ODL) Object Management Language (OML) Object Query Language (OQL) etc) the main ideas oftbe object paradigm diminish as the abstraction level decreases to the physical level where we can find records in the purest relational style This represents a serious interface mismatch against the object model we are trying to implement

This paper introduces KAOS a DAOODBMS built at DSIC with the aim of reducing the impedance mismatch described above JJ1 fact it is a system where only one language is used as ODL OQL and OML (database programming language) The KAOS system starts from the object model underlying OASIS a formal specification language ([1]) which uses dynamic logics to describe (the state and) the behaviour of objects through well-formed formulae on these logics A declarative semantics based on Kopke structures ([2]) and a Plotkin-style operational semantics ([3]) have converted OASIS in to a very suitable tool for rapid prototyping as well as for becoming the unified language we mentioned earlier

We will first introduce KBMS1 ([4]) he system on which KAOS was built Next we will write about the implementation of the OASIS model over KBMS 1 and will finish showing the system architecture and describing its basic features We are not dealing here about how KAOS is (almost) full Manifesto ([5]) and ODMG-93 ([6]) compliant neither with how the OASIS language has become the only language to interact with the system For more infonnalion about lhcse topi cs pJease see [78]

111 I ~Jt I1

KBMS1 is a Knowledge-Base Management System developed at the Hewlett-Packard Laboratories in Bristol UK IL is a logic programming-based tool that allows for the storage retrieval and update of large amounts of knowledge By knowledge we mean sets of (Hom) clauses written in kbProlog a Prolog language extended with theories and primitives to handle there theories

The theories provide a partltlOning of the knowledge base (KB) a theory is an unordered set of procedures (a procedure being an ordered set of Hom clauses with the same functor and arity of the atom on their heads) They are flrst class objects and their updates are treated in a declarative manner so that a program is not able to produce side-effecting updates on itself as happens with assert and retract in Prolog We may then make deductions over theories that are not updated at deduction time

There are two ways to refer to theories through their name and through their theory identifier A special kind of Lheories the so-called system theories contains all the other theories defined in the knowledge system They provide the logical organisation of theodes and their metatheories and store the system~ staLe represented by the contents of the theories it contains at a given moment

Each theory has three meta-theories associated to it the interpreter theory the assimilator theory and the attribute theory

Interpreter Assimilator

Theory

Attribute Theory

Melalhcories

Figure 1 Internl representation of a kbProiog theory

The interpreter theories are the query interface for theories (every query to a theory is handled by its interpreter) To query a theory we have to use the kbProlog predicate prove (Thry I Qry S) by which we are asking the theory Thry the query Qry in the state of the system represented by the system theory S Qry may be any Prolog goal we wish to demonstrate in Thry

Similarly assimilator theories are the updating interface for theories To make changes in a theory we must use the predicate upda te (Thry I Upd I S I NewS) by which we produce the update Upd in Thry switching from a system state S to a new one NewS in which Thry has already been updated (we can consider that NewS=Upd ( S) )

2

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 5: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

[h e92) Jae8j501 IChltstesol rJosson Overgaard G ObjecI Oriented Sof tware EIg ~~er 1g a Use Case Driven Approach Reading Massachusetts Addison -Vesey

[Pas91] PastorOCasamayor JC A Deductive and Object Oriented Environment lor Software Production Proc of the Workshop in Expert SystemsAi and Software Engineering Application lLPS-91 San Diego USA

[Pas92- [] PastorOHayesFBearS OASIS An Object Oriented Specification Language CAiSE92 LCNS 593 pags 348-36j Springer Verlag

[Pas92-2] Pastor 0 DiseFio y Desarrollo de un Entorno de Produccion A utomatica de Sojiware basado en el Modelo Orientado a Objetos Phd Thesis managed by Isidro Ramos [992 DSIC-UPV (Valencia)

[pas92-3] PastorO OO-METHOD An Object Oriented Methodology lor Software Production ell Actas de DEXA 92 Spriger-Verlag pags 12 J-127 [SBN 3-211-82400-6

[Pas93] PastorORamoslCanos 1H From Analysis to Design in an Object Oriented and Deductive Environment DSXA 93 LCNS 720 pags667-673 Springer-Verlag

(Pas95] PastorO Ramos I Oasis 2 I I A Class-DeJtnition Language to Model Inormation Systems Using an Object-Oriented Approach February 94 (I a ed) Mars 95 (2 ed) October 95 (3 de)

[Pas96- I] PastorOPelechano V BonetB Ramos l OO-Method 20 una metodologia de An6isis y DiseFio Orientacla a Objetos Technical Report DSIC-UPV 1996

[Pas96-2] PastorOMeseguerJRomeroJ I3arberaJM Descripcion del entomo graJtco de la herramienta CASE OO-METHOD Technical Report DSIC-UPV 1996

[Pas96-3] PastorOPei echanoV BonetB Ramos I Using OO-Method a practical guide to software modeling Technical Report DSIC-UPV 1996

[PeI94] Pelechano V OO-Method Implementacion de un entomo graJtco para el Analisis y DiseFio de Sistemas de Inormacion Orientados a Objeto Proyecto Fin de Carrera managed byr Oscar Pastor December 94 Facultat dlnformatica Universitat Politecnica de Valencia

[Pen94] Penades MC Actualizaciones ConsullaS y Programas en una Base de Datos Orientada a Objetos Proyecto Fin de Carrera managed by JH Canos Facultat dinformatica Universitat Politecnica de Valencia

[Ser87] SernadasASernadasCEhrichHD Object-Oriented Specification 0 Databases An Algebraic Approach In PMStocker WKent eds Proc VLDB 87 pg-107-116 Morgan Kaufmann 1987

[Ram90] Ramos l Logic and 00 Databases a Declarative Approach Porc of the Dexa 90 SpringershyVerlag J990

[Ram92] Ramos1PastorOCanos1 H On the use 0Algebras as Semantic Domains oObject Societies In the Proc of the 3rd International Workshop of the deductive Approach for DB an IS Roses (Costa B~ava) 1992

[Ram93] RamoslPastorO CuevasJDevesaJObjects as Observable Processes Proceedings of the 3rd Workshop on the Deductive Approach to Information System Design Roses Costa Brava 1993

[Rum9l] Rumbaugh JBlaha M Permerlani W Eddy FLorensen W Object Oriented Modeling and Design Englewood Cliffs Nj Prentice-Hall

[Wir90] Wirfs-Brock RWilkerson BWiener L Designing Object Oriented Software Englewood Cliffs NJ Prentice- Hall

- Knowedge~Base Ar(h~tecturc

f r Object Societies

Jose H Can6s Me Penadcs 1 Ramos and O Pastor

T)epart~rnent de Sistcmes Informati cs i Computac6 ) ersi lat Poiitccnica de VaieIlCi

Camf de Vera sIn E-46071 Valencia (Spain)

jhcanosds i c upv es

Abstract

This paper introduces I(AOS a Deductive Active and Object-Oriented Database Management System (DAOODBMS) built at DSIC over a Knowledge-Base Management System (KBMS) We have based its construction on the advantages of such a system so we have definitely made what we could call an object layer on top of the knowledge-based systems An operational prototype that is a first version of a DAOODBMS compliant with almost all characteristics coliected in documents Sitch as the OODBMS Manifesto and the standard ODMG-93 is currently available OIi fP-UX workstations

1 Introduction

Despite the great efforts that the Information Management Community has made in the last few months to establish a standard model for ODBMS at every level (Object Definition Language (ODL) Object Management Language (OML) Object Query Language (OQL) etc) the main ideas oftbe object paradigm diminish as the abstraction level decreases to the physical level where we can find records in the purest relational style This represents a serious interface mismatch against the object model we are trying to implement

This paper introduces KAOS a DAOODBMS built at DSIC with the aim of reducing the impedance mismatch described above JJ1 fact it is a system where only one language is used as ODL OQL and OML (database programming language) The KAOS system starts from the object model underlying OASIS a formal specification language ([1]) which uses dynamic logics to describe (the state and) the behaviour of objects through well-formed formulae on these logics A declarative semantics based on Kopke structures ([2]) and a Plotkin-style operational semantics ([3]) have converted OASIS in to a very suitable tool for rapid prototyping as well as for becoming the unified language we mentioned earlier

We will first introduce KBMS1 ([4]) he system on which KAOS was built Next we will write about the implementation of the OASIS model over KBMS 1 and will finish showing the system architecture and describing its basic features We are not dealing here about how KAOS is (almost) full Manifesto ([5]) and ODMG-93 ([6]) compliant neither with how the OASIS language has become the only language to interact with the system For more infonnalion about lhcse topi cs pJease see [78]

111 I ~Jt I1

KBMS1 is a Knowledge-Base Management System developed at the Hewlett-Packard Laboratories in Bristol UK IL is a logic programming-based tool that allows for the storage retrieval and update of large amounts of knowledge By knowledge we mean sets of (Hom) clauses written in kbProlog a Prolog language extended with theories and primitives to handle there theories

The theories provide a partltlOning of the knowledge base (KB) a theory is an unordered set of procedures (a procedure being an ordered set of Hom clauses with the same functor and arity of the atom on their heads) They are flrst class objects and their updates are treated in a declarative manner so that a program is not able to produce side-effecting updates on itself as happens with assert and retract in Prolog We may then make deductions over theories that are not updated at deduction time

There are two ways to refer to theories through their name and through their theory identifier A special kind of Lheories the so-called system theories contains all the other theories defined in the knowledge system They provide the logical organisation of theodes and their metatheories and store the system~ staLe represented by the contents of the theories it contains at a given moment

Each theory has three meta-theories associated to it the interpreter theory the assimilator theory and the attribute theory

Interpreter Assimilator

Theory

Attribute Theory

Melalhcories

Figure 1 Internl representation of a kbProiog theory

The interpreter theories are the query interface for theories (every query to a theory is handled by its interpreter) To query a theory we have to use the kbProlog predicate prove (Thry I Qry S) by which we are asking the theory Thry the query Qry in the state of the system represented by the system theory S Qry may be any Prolog goal we wish to demonstrate in Thry

Similarly assimilator theories are the updating interface for theories To make changes in a theory we must use the predicate upda te (Thry I Upd I S I NewS) by which we produce the update Upd in Thry switching from a system state S to a new one NewS in which Thry has already been updated (we can consider that NewS=Upd ( S) )

2

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 6: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

- Knowedge~Base Ar(h~tecturc

f r Object Societies

Jose H Can6s Me Penadcs 1 Ramos and O Pastor

T)epart~rnent de Sistcmes Informati cs i Computac6 ) ersi lat Poiitccnica de VaieIlCi

Camf de Vera sIn E-46071 Valencia (Spain)

jhcanosds i c upv es

Abstract

This paper introduces I(AOS a Deductive Active and Object-Oriented Database Management System (DAOODBMS) built at DSIC over a Knowledge-Base Management System (KBMS) We have based its construction on the advantages of such a system so we have definitely made what we could call an object layer on top of the knowledge-based systems An operational prototype that is a first version of a DAOODBMS compliant with almost all characteristics coliected in documents Sitch as the OODBMS Manifesto and the standard ODMG-93 is currently available OIi fP-UX workstations

1 Introduction

Despite the great efforts that the Information Management Community has made in the last few months to establish a standard model for ODBMS at every level (Object Definition Language (ODL) Object Management Language (OML) Object Query Language (OQL) etc) the main ideas oftbe object paradigm diminish as the abstraction level decreases to the physical level where we can find records in the purest relational style This represents a serious interface mismatch against the object model we are trying to implement

This paper introduces KAOS a DAOODBMS built at DSIC with the aim of reducing the impedance mismatch described above JJ1 fact it is a system where only one language is used as ODL OQL and OML (database programming language) The KAOS system starts from the object model underlying OASIS a formal specification language ([1]) which uses dynamic logics to describe (the state and) the behaviour of objects through well-formed formulae on these logics A declarative semantics based on Kopke structures ([2]) and a Plotkin-style operational semantics ([3]) have converted OASIS in to a very suitable tool for rapid prototyping as well as for becoming the unified language we mentioned earlier

We will first introduce KBMS1 ([4]) he system on which KAOS was built Next we will write about the implementation of the OASIS model over KBMS 1 and will finish showing the system architecture and describing its basic features We are not dealing here about how KAOS is (almost) full Manifesto ([5]) and ODMG-93 ([6]) compliant neither with how the OASIS language has become the only language to interact with the system For more infonnalion about lhcse topi cs pJease see [78]

111 I ~Jt I1

KBMS1 is a Knowledge-Base Management System developed at the Hewlett-Packard Laboratories in Bristol UK IL is a logic programming-based tool that allows for the storage retrieval and update of large amounts of knowledge By knowledge we mean sets of (Hom) clauses written in kbProlog a Prolog language extended with theories and primitives to handle there theories

The theories provide a partltlOning of the knowledge base (KB) a theory is an unordered set of procedures (a procedure being an ordered set of Hom clauses with the same functor and arity of the atom on their heads) They are flrst class objects and their updates are treated in a declarative manner so that a program is not able to produce side-effecting updates on itself as happens with assert and retract in Prolog We may then make deductions over theories that are not updated at deduction time

There are two ways to refer to theories through their name and through their theory identifier A special kind of Lheories the so-called system theories contains all the other theories defined in the knowledge system They provide the logical organisation of theodes and their metatheories and store the system~ staLe represented by the contents of the theories it contains at a given moment

Each theory has three meta-theories associated to it the interpreter theory the assimilator theory and the attribute theory

Interpreter Assimilator

Theory

Attribute Theory

Melalhcories

Figure 1 Internl representation of a kbProiog theory

The interpreter theories are the query interface for theories (every query to a theory is handled by its interpreter) To query a theory we have to use the kbProlog predicate prove (Thry I Qry S) by which we are asking the theory Thry the query Qry in the state of the system represented by the system theory S Qry may be any Prolog goal we wish to demonstrate in Thry

Similarly assimilator theories are the updating interface for theories To make changes in a theory we must use the predicate upda te (Thry I Upd I S I NewS) by which we produce the update Upd in Thry switching from a system state S to a new one NewS in which Thry has already been updated (we can consider that NewS=Upd ( S) )

2

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 7: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

111 I ~Jt I1

KBMS1 is a Knowledge-Base Management System developed at the Hewlett-Packard Laboratories in Bristol UK IL is a logic programming-based tool that allows for the storage retrieval and update of large amounts of knowledge By knowledge we mean sets of (Hom) clauses written in kbProlog a Prolog language extended with theories and primitives to handle there theories

The theories provide a partltlOning of the knowledge base (KB) a theory is an unordered set of procedures (a procedure being an ordered set of Hom clauses with the same functor and arity of the atom on their heads) They are flrst class objects and their updates are treated in a declarative manner so that a program is not able to produce side-effecting updates on itself as happens with assert and retract in Prolog We may then make deductions over theories that are not updated at deduction time

There are two ways to refer to theories through their name and through their theory identifier A special kind of Lheories the so-called system theories contains all the other theories defined in the knowledge system They provide the logical organisation of theodes and their metatheories and store the system~ staLe represented by the contents of the theories it contains at a given moment

Each theory has three meta-theories associated to it the interpreter theory the assimilator theory and the attribute theory

Interpreter Assimilator

Theory

Attribute Theory

Melalhcories

Figure 1 Internl representation of a kbProiog theory

The interpreter theories are the query interface for theories (every query to a theory is handled by its interpreter) To query a theory we have to use the kbProlog predicate prove (Thry I Qry S) by which we are asking the theory Thry the query Qry in the state of the system represented by the system theory S Qry may be any Prolog goal we wish to demonstrate in Thry

Similarly assimilator theories are the updating interface for theories To make changes in a theory we must use the predicate upda te (Thry I Upd I S I NewS) by which we produce the update Upd in Thry switching from a system state S to a new one NewS in which Thry has already been updated (we can consider that NewS=Upd ( S) )

2

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 8: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

21 Persiste1ce

KBMS1 vias built over the relational DB mlager ALLBASESQL in order to be able to deal with persistent theories This Wily knowledge bases can be stored 2nd retrieved in a DB-like style as well as stored and retrieved efficiently (which is more important) The size of a knowledge base is only limited by the theoretical capacity of the storage manager (about 10 15 bytes)

3 Objects in KBMS1

The notion of theory yields a set of characteristics which are nicely close to the object paradigm concepts each theory has its own identifier that distinguishes it from others and its contents are encapsulated throu gh its interpreter assimilator and attribute metatheories It is to demonstrate goals in theories which are different from those that generate there goals (in the most genuine messagemethod-style interaction)

Therefore it seems to be worthwhile to study the ablility of kbProlog to act as the OASIS object language We could do that simply by defining an appropiate representation for objects as theories It mllst be remembered that in the OASIS object model objects are fonnal theories in dynamic logic

We will represent an object in a given state as a kbProlog theol) This theory will contain predicates indicating what the current value of all the objects attributes is Hence two different states of an object will be represented by two theories that differ in the value of at least one attribute of the object The associated interpreter and assimilator metatheories will contain the observation and update methods resp while the attribute theory win store some object properties such as integrity constraints triggering relationships etc The set of ncttheories compose what in the 00 approach is called a type (ie a set of properties)

The actual contents of the theory that reprcsentsan object state as well as that of the meta theories depends on the inference strategy chosen for the runtime system In the following paragraphs we will discuss each of the two main tendencies To illustrate our discussion we will take as a target the OAS1S specificaticrl of the books in a library which appears in figure 2 It can be seen how following a clausal specification style we made up an OASIS spec An object has static properties (a t tr ibu tes) whose value (not the signature) may vary over time and behaviour ones (events) that are directly related to the change of state of the object as shown in the valuations paragraph The valuations are composed of a set of dynamic fonnulae A dynamic formula is of the form ltgt[e]cp where ltgt and cp are first-order fonnulae and e is an event and has the following intuitive meaning in a state in which ltgt holds after the occurrence of the event e a new state will be reached in which cp must necessarily hold

Associated with one event of the objects signature the event responsible for the creation of an object is in fact a service offered by the class to which the object belongs to The same can be said about object destruction although we could have non t1p(trhlp hP f I ( rl n hlprn rp( 0 irmiddotf~ middot thpon ] 11 ( Ipnl hprl ~ttp onll(t ()11

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4

Page 9: UN ENSA YO INTRODUCTORIO A LA INFORMATICA …mismas acelera el envejecimiento de los sistemas de informacion y de los sistemas informaticos que los apoyan, incrementando la complejidad

may produce an event rejection if the state to which this event leads to is not constraintshycompliant

class bo ok constant_attributes

key c ode (nat) tit le (s tring)

constraints Nnat static

code(N) amp Ngtl amp NltlOOO variable_attributes available (boo l) valuation

[new_book) available (true) [l oan) available(false) [return) a va il a ble(true)

end_valuation

private_events new new_bo ok destroy destr_book

shared_events loan with re ad~r return with reader

preconditions destr_book lt- available(true) loan lt - ava ilable (true) return lt- available(false)

processes book lt- new_ boo k amp loan amp bookO bookO lt- (l o an o r return) amp boo k O or bookl boo kl lt- destr_boo k

end_class

Figure 2 OASIS specijication of the class b o ok

In the processes section the correct lives of the objects are described using a process description fonnalism In the class of the figllre 2 we have used a Prolog-like syntax where the sequence operator is represented by amp the choice by or and the iteration is implemented by tail recursion (see [910] for a discussion about the process nature of objects)

Forward Inference In query-oriented systems where the number of updates is less than thenumber of queries it is more convenient to have the object states explicitly stored in the database We may do it through an object representation like that in figure 3 how we define the current value of an objects attribute (WIthout distinction between constant and variable) by means of a Prolog ground fact can be seen

Any query or update to an object will be handled by the interpreter and assimilator theories resp that along with the attribute theory constitute the type associated to the class book Every class instance shares the same metatheories

4