Compositional algebra for interactive data access

25
Vol. 25, No. 5, pp. 367–391, 2000 2000 Elsevier Sciences Ltd. All rights reserved Printed in Great Britain 0306-4379/00 $20.00 + 0.00 367 COMPOSITIONAL ALGEBRA FOR INTERACTIVE DATA ACCESS GIANLUCA MORO 1 , ANTONIO NATALI 1 , and CLAUDIO SARTORI 1,2 1 Department of Electronics, Computer Science and Systems, University of Bologna, Viale Risorgimento 2, I-40136 Bologna, Italy 2 CSITE-CNR, Department of Electronics, Computer Science and Systems, University of Bologna, Italy An important issue for the success of a database application is the effectiveness of its interface. Frequently a relevant part of the programming effort is devoted to the generation of interfaces. The visual programming environments reduce only partly this effort, and in particular, things become more complicated when data coming from different sources (different views in the same database or even views from different databases or systems) are to be related and must cooperate in the data navigation and manipulation task. To overcome this problem we present a new database access paradigm based on an algebra on the domain of computational abstractions called "services" which include both dimensions: the data access computation and the user interaction. This means that the interaction is not implemented by using separated constructs as happens for traditional computational models; on the contrary, as the interaction is an integral part of the service paradigm, the user interaction is computed starting from the declarative specification of the data access itself. The combination of services in a service expression through the operators defined by the service algebra makes it possible to generate cooperating user interfaces for complex data navigation and manipulation. Through algebraic properties, which hold both from the data and user interface point of view, the service expressions can be simplified and optimized guaranteeing their initial semantics. The paper shows the application of the service algebra to the relational environment by means of a simple extension to SQL. Finally, the paper describes a tool based on a three tier architecture and on Java technology for developing and distributing services in Web environment. Services and combination of services expressed with the service algebra are automatically translated into Java objects, allowing the rapid development of platform independent data access services. © 2000 Elsevier Science Ltd. All rights reserved Interactive Data Access, Service, Algebra, SQL, Relational DBMS, Java, Middleware 1. INTRODUCTION An important issue for the success of a database application is the effectiveness of its interface, and frequently a relevant part of programming effort is devoted to the generation of user interfaces. At present, many front-end database tools provide browsing capabilities according to a relational view, at the cost of very low (or virtually zero) programming effort. But things become more complicated when the data from different sources are to be combined, for instance in a master-detail relationship. Some tools can do this quite simply in a single database environment, but this is the actual limit. Let us consider, as an example, that a purchasing office has available a couple of applications for browsing mail-order catalogues and for computing parcel service fares, given the size and the weight of the item to ship. Let us suppose that a new purchasing procedure requires that an employee selects an item from a couple of mail-order catalogues, then orders item to be shipped using the parcel service with the cheapest fare, based on the size and weight of the item. Provided that the catalogues and the parcel services make available a relational view of their data, the present technology would allow two different solutions: the old applications are simple SQL queries to be issued through a front-end; the user has to analyze the result of the catalogues queries and issue a query to the parcel service, depending on the result of the previous one; the old applications are ad hoc programs and a new ad hoc application is to be generated, possibly with an integrated user presentation. The first solution does not imply programming effort; the queries are reused, but leaves to the user the Recommended by Maurizio Lenzerini

Transcript of Compositional algebra for interactive data access

,QIRUPDWLRQ6\VWHPVVol. 25, No. 5, pp. 367–391, 2000 2000 Elsevier Sciences Ltd. All rights reserved

Printed in Great Britain0306-4379/00 $20.00 + 0.00

367

COMPOSITIONAL ALGEBRA FOR INTERACTIVE DATA ACCESS

GIANLUCA MORO1, ANTONIO NATALI1, and CLAUDIO SARTORI1,2

1Department of Electronics, Computer Science and Systems, University of Bologna, Viale Risorgimento 2, I-40136 Bologna, Italy2CSITE-CNR, Department of Electronics, Computer Science and Systems, University of Bologna, Italy

5HFHLYHG0DUFKLQILQDOUHYLVHGIRUP-XQH

$EVWUDFW An important issue for the success of a database application is the effectiveness of its interface.Frequently a relevant part of the programming effort is devoted to the generation of interfaces. The visualprogramming environments reduce only partly this effort, and in particular, things become more complicatedwhen data coming from different sources (different views in the same database or even views from differentdatabases or systems) are to be related and must cooperate in the data navigation and manipulation task. Toovercome this problem we present a new database access paradigm based on an algebra on the domain ofcomputational abstractions called "services" which include both dimensions: the data access computation and theuser interaction. This means that the interaction is not implemented by using separated constructs as happens fortraditional computational models; on the contrary, as the interaction is an integral part of the service paradigm,the user interaction is computed starting from the declarative specification of the data access itself. Thecombination of services in a service expression through the operators defined by the service algebra makes itpossible to generate cooperating user interfaces for complex data navigation and manipulation. Through algebraicproperties, which hold both from the data and user interface point of view, the service expressions can besimplified and optimized guaranteeing their initial semantics. The paper shows the application of the servicealgebra to the relational environment by means of a simple extension to SQL. Finally, the paper describes a toolbased on a three tier architecture and on Java technology for developing and distributing services in Webenvironment. Services and combination of services expressed with the service algebra are automatically translatedinto Java objects, allowing the rapid development of platform independent data access services.© 2000 Elsevier Science Ltd. All rights reserved

.H\ZRUGV Interactive Data Access, Service, Algebra, SQL, Relational DBMS, Java, Middleware

1. INTRODUCTION

An important issue for the success of a database application is the effectiveness of its interface, andfrequently a relevant part of programming effort is devoted to the generation of user interfaces. At present,many front-end database tools provide browsing capabilities according to a relational view, at the cost ofvery low (or virtually zero) programming effort. But things become more complicated when the data fromdifferent sources are to be combined, for instance in a master-detail relationship. Some tools can do thisquite simply in a single database environment, but this is the actual limit.

Let us consider, as an example, that a purchasing office has available a couple of applications forbrowsing mail-order catalogues and for computing parcel service fares, given the size and the weight ofthe item to ship. Let us suppose that a new purchasing procedure requires that an employee selects an itemfrom a couple of mail-order catalogues, then orders item to be shipped using the parcel service with thecheapest fare, based on the size and weight of the item. Provided that the catalogues and the parcelservices make available a relational view of their data, the present technology would allow two differentsolutions:• the old applications are simple SQL queries to be issued through a front-end; the user has to analyze

the result of the catalogues queries and issue a query to the parcel service, depending on the result ofthe previous one;

• the old applications are ad hoc programs and a new ad hoc application is to be generated, possiblywith an integrated user presentation. The first solution does not imply programming effort; the queries are reused, but leaves to the user the

†Recommended by Maurizio Lenzerini

GIANLUCA MORO HWDO368

responsibility of transferring the results of one query as selection conditions of the subsequent one. The second solution, on the contrary, thanks to a (possibly visual) programming language implements

the necessary links, at the cost of losing flexibility: the data flow is hard-coded and the program can bereused only at the cost of additional programming effort. At this level, reuse means, for instance, toassemble and specialize objects from the object library of the existing applications (if available).

At an abstract level, reuse of data access should mean aggregating and integrating existing userinterfaces with a quite standard presentation logic: for instance, to obtain the union of the two cataloguesabove and to automatically generate a query to the parcel service with the appropriate size and weightvalues.

Our idea is to exploit this abstract view of data access and to introduce a new database accessparadigm, the VHUYLFH, with the following logical characteristics:• a service has an interface automatically generated starting from a data access declarative specification• some mechanisms for the combination of services are available; the combined service implements a

sort of cooperation among the original services and automatically generates a combined interface,according to a precise semantic grounded on an algebraic structure. A second important issue in database applications is that of software architecture. At present most

solutions rely on the client-server architecture, and the client applications are compiled for a specificsoftware environment and LQVWDOOHG in the user machine.

Our claim is that the service should be resident in the server machine, being part of the database (likethe stored procedures) and have the capability to migrate on the demanding machine without installationor configuration.

Examining the current technology, we realized that neither the traditional technologies nor the mostrecent ones such as World Wide Web [4] (in short Web) and Java, are able to fully satisfy therequirements above. Mainly there exists no computational environment able to support the compositionsemantics at the user interface level.

The access to a database occurs usually through SQL, a declarative language not computationallycomplete based on the relational algebra [33]. SQL does not provide for any grammar construct for theuser interaction with data, so it cannot be considered an interactive language. In order to overcome thislimitation, SQL can be used together with a programming language such as C++, Pascal, Java etc.

At this low abstraction level, data access means providing code for accessing remote andheterogeneous databases, code for manipulating results, code for presenting results, including code forobtaining cooperating behaviors between several user interfaces. At a higher abstraction level it meansnavigating through data for exploring them independently from their location.

There are several commercial tools for data access (JDesignerPro [6], Powerbuilder [28], Ms Access[18] etc.) which may reduce some difficulties due to the low abstraction level. Using all of them, the uservisually builds user interfaces for displaying a query result. Some of them allow visually associating atmost two user interfaces in a master-detail relationship. Two or more user interfaces aggregated throughrelationships become cooperating when the user interaction on an interface may produce effects on theothers.

For more complex aggregations with respect to the two master-detail level, these tools require the userto write code with an imperative language for implementing the desired cooperation. So they are nearer toa low level abstraction rather than to a higher one, because the user must deal with both SQL and animperative language.

Moreover, programming the cooperation between user interfaces prevents new automaticaggregations, because their cooperation logic is hard-coded. Therefore, new data access can be obtainedonly through new programming effort.

What is needed is a computational environment able to support the composition semantics forautomatic aggregation of user interfaces independently from their specifics display contents. This meansthat new applications, developed with current tools, cannot cooperate at the interface level with existingones, unless the cooperation has been designed in advance.

Moreover, these tools are usually limited to a single database model, mainly the relational one. Another limitation of the model employed by these data access tools regards the software architecture.

All of them store applications for data access, including user interfaces, into a file for a specifiedoperating environment. This makes it impossible to use the applications in a world-wide network ofheterogeneous machines like the Web. To obtain concurrent remote execution, the applications, and

Compositional Algebra for Interactive Data Access 369

possibly their run-time environment, are to be stored and properly installed in the client machine. The recent technology, based on Web and Common Gateway Interface standard (CGI) [24], provides a

way to access remote DBMS through HTML pages called Forms. With respect to the above mentionedtools, a Form has only a better capability to migrate on demanding machine, but it has several limitationsbecause the HTML formalism is by far too poor for the definition of an interactive user interface [5].

Our main objectives is to make interaction an integrating part of the computational process for dataaccess. In addition, a set of operators for the combination of interactive data accesses is provided. Wedefine the VHUYLFHas a computational abstraction which include two dimensions: data access computationand user interaction. We also introduce the VHUYLFHDOJHEUD as a set of operators for the combination ofservices, with a precise semantics for both the above dimensions.

In this way, it becomes possible to combine interactive accesses in a fashion similar to the combinationof algebraic expression, and thus reuse user interactions without any programming effort.

We point out that the ideas introduced in this work are mainly related to the VHPDQWLFV of interactivedata access and of combination of different interactive data accesses. Minor attention is devoted to thepresentation aspects which can be dealt with independently as a third dimension. For this reason, theimplemented tool described in Section 0 is mainly a “proof of concept” and its actual user interface hasonly basic features. Nevertheless, it is currently used for developing and distributing in Web environmentsome administrative services of our department.

This work, which is based on the idea presented in [22], introduces formally in Section 2 the notion ofservice grounded on a service algebra, and presents in Section 3 a declarative compositional language forservices in relational environment, by extending the syntax and semantics of SQL. As this compositionalprocess satisfies the closure property with respect to the service set, it is possible to define complexservices with arbitrarily nested compositions.

Section 0 describes the implemented tool (called JAccess) from two points of view: the usage and thearchitecture. The solution proposed is able to overcome the limitations above mentioned:• the data access services are stored on server machines, as they are part of the database, like stored

procedures;• services are able to migrate on the demanding machine without installation or configuration, and,

being autonomous, they do not require any software support, except for a Java enabled Web browser.Therefore each service may be used concurrently by more than one user in a world-wide network of

heterogeneous machines like the Web environment.Section 5 describes the related works and Section 6 concludes the paper.

2. THE SERVICE AS A NEW DATABASE ACCESS PARADIGM

In order to show the usefulness of a new paradigm for database access, let us suppose we are interestedin finding out the address of a parcel service who requires the minimum fare for a given distance. Let usassume we have two available functions:• JHWBDGGUHVVQDPH retrieves the address of the parcel service by means of its QDPH;• JHWBQDPHBZLWKBPLQLPXPBIDUHVL]HZHLJKW retrieves the name of the parcel service which offers the

minimum fare for the given LWHPVL]HDQGZHLJKW.Both functions have an argument for which they expect a single constant value; in the first case it is a

string of characters, while in the second case it is a number. To accomplish our task, we might composethe first function with the second one, that is JHWBDGGUHVVJHWBQDPHBZLWKBPLQLPXPBIDUHVL]HZHLJKW.Now let us suppose that more than one parcel service name is available for shipping our goods at the sameminimum fare for the given parameters. In this case, a FDUGLQDOLW\ PLVPDWFK occurs between the twofunctions because JHWBDGGUHVVQDPH receives more than one expected value. To solve this problem, wemay think of correcting the code of the functions to handle the mismatch.

If we change our approach in handling this situation without considering it an error to correct, wemight observe that the end-user itself could resolve the cardinality mismatch by letting her/him to select avalue from the intermediate result in such a way to supply the first function with a single value, asexpected. On the other hand, if only one parcel service results from the first function, we do not want toannoy the user with a useless interaction.

GIANLUCA MORO HWDO370

GUIU66

[_N · ·

X6[Q_NQ

Fig. 1: The Service Model

In other words the interaction, which has been considered as a simple means for taking input fromexternal sources, now becomes the harmonizer for bringing back the computation on traditional basis aswell, while offering a way to make software more flexible and less vulnerable.

Since as the IXQFWLRQ of traditional computational models does not offer such behavior, we introducethe concept of VHUYLFHas a base for building a new paradigm able to include the interaction as an integralpart of the model itself. In other words, the interaction should not be forced through specific programmingconstructs, but should be explicitly considered as a first class concept and dealt with according to a limitedset of standard schemes.

Our main goal is to provide a new model for data access which allows working at a high level ofabstraction by simply taking care of the navigation through data for exploring them. This means that oncethe data demands and the navigations are declaratively specified, the low level functionalities and thecooperating user interfaces could be automatically generated.

In this section we formally define this new paradigm by introducing the concept of VHUYLFH. A servicehas a specific task to perform and a user interface with a behavioral logic implied by the task specificationitself. The service may get tuple sequences from input parameters and return a tuple sequence as a result.The composition of two or more services generates a service with a new common user interface providingboth the original individual behavioral logic and a new collaborative behavior for carrying out a newcomposite task. This means that existing services are able to cooperate also at interface level although thecooperation was not designed in advance.

In Section 2.2 we show that this paradigm is based on an algebraic structure (the service algebra) madeup of several operators, including the composition. Since all of these operators satisfy the closure propertywith respect to the service definition, we are able to build complex services by writing service algebraexpressions.

This model explicitly takes into account user interaction and is based on a well formed semantic aswill be shown later. Explicit treatment of user interaction provides a more powerful computational model[19, 34]. In addition, by means of a set of algebra properties, we are able to simplify and optimize serviceexpressions into a minimal form guaranteeing the same semantic of initial expressions.

'HILQLWLRQV

Let D1Dn be n constant terms, we call WXSOH the vector τ = (D1Dn ) where DULW\τ = n is its arity.A WXSOHVHTXHQFHσ = [τ1 ,..,τm] makes up an ordered set of tuples and FDUGσ = m denotes its FDUGLQDOLW\.[] denotes an empty sequence, therefore FDUG[] = 0; let τi ∈ σ be the tuple (or tuples) with highest arityin σ, that is arity(τi) = n, then JUDGHσ = n denotes the arity of sequence σ.

We define a service 6 (Figure 1) as an “agent” provided with computational capability and with thefollowing properties:1. the result of 6 indicated with U6, is always a tuple sequence, possibly empty;2. J6 is the graphical user interface (GUI) of service 6, which may be either visible or invisible; the

general structure of J6 is a window presenting a sequence of tuples and letting the user select (orinsert) some of them;

3. X6 indicates the tuple sequence the user may select from U6 by interacting with J6, X6 ⊆ U6becomes the final result of 6;

4. 6"[ i_N i points out the i-th input parameter of service 6 the question mark indicates that theservice uses the received values as data; a double question mark indicates that input data are used asinstructions to modify the service itself in order to obtain higher level services (see Section 3.2); thesingle question mark can be omitted; the input parameter accepts only a tuple sequence σi , such that

Compositional Algebra for Interactive Data Access 371

(a) (b)

Fig. 2: (a) GUI of an Elementary Service, (b) GUI of a Parametric Service

FDUGσi ≤ N i (for 1 ≤ N i ≤ Q - where Q∞ indicates the maximum cardinality† of the sequence); ifFDUGσi = 0, that is σi = [ ], then 6does not start its computation and its result is U6 = [ ].In other words, no matter what the source is, 6 produces a set of tuples U6 which are presented to the

user when its GUI J6 is visible. The minimal requirements for the GUI are to let the user browse thetuples and possibly select a subset X6 of them and to close the service.

We should emphasize that we are not proposing a specific model for user interaction, but areintroducing an LQWHUDFWLYHDOJHEUDwhose expressions generate LQWHUDFWLRQSRLQWV. These interaction pointsallow the user to address the final result of an algebra expression addressing indeed the data access resultwhile the expression computation is in progress. This is, in our opinion, a significant breakthrough withrespect to other computational models which are mainly oriented only to data access computation (e.g.relational algebra, relational calculus, datalog [33]). This limitation leads to building systems in which itbecomes necessary to implement and insert (more or less manually) the interaction between two (or more)data access expressions (e.g. SQL as hosted language within imperative languages). The specificpresentation style is a third dimension, orthogonal to user interaction and data access, which can be dealtwith independently.

Figure 2 shows the user interfaces of two services in the present simple implementation. Figure 2ashows the results of a service called Subjects()which is a simple selection of subjects with their NAMEand ID. Figure 2b is a parametric service called Teachers(?x|1)which accepts a tuple sequence ofcardinality one: at run time the user is prompted for parameter input. It retrieves NAME and ID of teachersbelonging to the board of examiners of a user specified subject ID.

A service can have a set of input parameters to influence its execution and its result, and since eachparameter accepts a sequence of tuples, according to a maximum cardinality, the result of one or moreservices can be the input for another one. In other words the combination of services by means of complexexpressions gives rise to the combination of their interfaces as well; in this way the model is able tocompute the user interaction by automatically generating interfaces with user interaction points.

6HUYLFH$OJHEUD

From the definition of service it derives that a service output may be an input for another service; thisfact leads us to think of an operators set able to make up an algebra structure. The main advantage analgebra can offer is related to the closure property: it guarantees that each result of an operation onservices is a service to which we can again apply algebra operators. We are thus able to build servicesmore and more complex by aggregating (and reusing) simpler existing services through declarativeexpressions of service algebra.

†For brevity the cardinality indicator can be omitted for Ni = 1.

GIANLUCA MORO HWDO372

Some results can be found in the literature for the formalization of interaction; for instance, in [10]formal models for the specification of human-computer interaction are described. These models, for themost part, are able to express unambiguously at the design level the behavior of a system from the point ofview of its interactions with the external environment. Despite their usefulness, however they do notrepresent FRPSXWDWLRQDO models that can formalize computational processes (e.g. relational calculus,lambda calculus etc.). In other words, these models are devised to specify, rather than to compute. Wegner[34] and Milner [19] focused more on the investigation of the interaction from a computational point ofview by founding the area of LQWHUDFWLYHFRPSXWLQJ. Wegner argues that interactions cannot be describedby algorithms, due to the intrinsically non-algorithmic evolution of interaction between user and machine.A main feature of the service model is that of having user interaction as an integral part; the servicealgebra operators are devised as a computational framework able to drive the interactive behavior of thegraphical user interfaces of services and, according to Wegner, this feature in some way improves theclassic computational model based on the Turing Machine [31]. In fact, the user, being part of thecomputation of a service expression, may address the computation itself by interacting with the graphicaluser interface of the service generated by an algebraic expression. Moreover, the service algebra satisfiesseveral properties, as shown in Section 2.4. In the following we define the algebra operators and thenshow an example of combined service by using several operators. Since the service model deals withtuples, some operators are directly inspired by relational algebra [33]; however, in addition to thecomputational aspects, they have a specific impact on the user interaction.

$OJHEUD2SHUDWRUV

Let 3 be an infinite set of parameter names, and let [\] range over parameter names. Let ,be a setof service identifiers, each one with its own arity. Let $%& range over service identifiers. Let 456range over services or service expressions, which are of six kinds as follows.

&RPSRVLWLRQ Let 56 be two services such that 5has arity n > 0, that is 5"[1_N1"[n_Nn where [ i(for 1≤ L ≤ Q) is an input parameter, then we define

5"[1_N1"[ i-1_N i-1"6_N i"[ i+1_N i+1"[n_Nn

as the composition of 5 o 6 for [ i_N i with the following semantics

1) for each other unbound input parameter [ j of 5(j ≠ i), it displays a graphical user interface, such as anedit box, in order to let the user insert at most N j tuples;

2) and in parallel one of the two following alternatives:a) if FDUGU6 ≤ N i then U6 becomes the input value for [ i in service 5 and J6 the

graphical user interface of 6 turns invisible;b) if FDUGU6 > N i then J6 turns visible in order to let the user select at most N i tuples from

U6 and then X6 becomes the input value for [ i (we call this situation &DUGLQDOLW\0LVPDWFK).

The temporal order is not significant, in fact (2a) or (2b) may occur in parallel to (1). In general, thecomposition is a n-ary operation; in fact if 5 has arity > 1 then we are able to compose 5 with n > 1services.

6XPPDWLRQ A summation Si

i∈Ν∑ , where i < ∞ , is a service whose result U is equal to a tuple sequence

containing the union of results of each service, that is U6 LL∈ΝU . We write ∅ for the empty summation,

and call it empty service as the service which can do nothing. The binary summation can be thought as aservice "[1_Q "[2_Q with two input parameters whose cardinality is unlimited therefore 6162 =

"61_Q "62_Q . By the definition of composition both 61 and 62 do not make visible their user

interface because a cardinality mismatch cannot occur. For this reason, 6162 generates a single user

interface, J6162 displaying the summation result U6162

Compositional Algebra for Interactive Data Access 373

&DUWHVLDQ SURGXFW Let 61,..,6n be n services and U61U6n their results; then we define the&DUWHVLDQSURGXFW 61 × × 6n as a service whose result is the cartesian product of U61× × U62displayed by a unique graphical user interface JU61×× U62 for the same reason described in theprevious operator.

'LIIHUHQFH Let 61, 62 be two services; then we define the difference 61-62 as the service whose resultU61-62 contains the tuples of U61which are not contained in U62 a single user interface J61-62displays the result as in the summation operator

3URMHFWLRQ Let 6 be a service and σ = [(K1), ...,(K i )] a tuple sequence such that JUDGHU6 S ≥FDUGσ = i and K j ∈ 1, ..., S ∩ N (for 1 ≤ j ≤ i) then SURM6σ is a service with JUDGHUSURM6σ =FDUGσ and the attributes of 6 which are in the positions indicated by K1, ..., K i become the onlyattributes available for U6.Nevertheless, JSURM6σ is the same as J6. In other words, the projection modifies the result but notits presentation.

+LGH Let 6 be a service whose JUDGHU6 S and let σ = [(K1 ), ...,(K i )] be a tuple sequence such thatS≥ card(σ) = i and K j ∈ 1,..., S ∩ N (for 1 ≤ j ≤ i) then KLGH6σ is the same as 6 but it does notdisplay the attributes in the positions K1, ..., K i; in other words this operator hides the presentation of a setof service attributes but its result remains unchanged (UKLGH6σ U6).

The syntax of services can be summarized as follows:

6 ::= ∅ | 61o 62

| 61 + 62 | 61× 62 | 61 - 62

| SURM6 ,<sequence of integers>| KLGH6 ,<sequence of integers>

The priority among operators is the following in descendent order from left to right:

o , KLGH, SURM > × > + > - .

Let Ω be the universe set of services, then (Ω,o , KLGH, SURM, × , +, -) is an algebraic structure, since theoperators satisfy the closure property with respect to the set Ω. In fact, applying these operators toservices as illustrated above, the result is always a service to which these operators are again applicable.

Figure 3 shows an example of the combined usage of FRPSRVLWLRQSURMHFWLRQand KLGH, starting fromthe two independent services of Figure 2. The purpose of this service is to retrieve the teachers’ namesbelonging to the board of examiners of a user-selected subject. It can be obtained by combining the twoservices of Figure 2 through the following expression:

hide(Teachers(proj(hide(Subjects(),[(2)]),[(2)])|1),[(2)])

The first service executed is the inner one, Subjects. Since it retrieves more than one tuple, whileTeachers, the outer service, expects only one, a cardinality mismatch occurs and the interface presentingthe result of Subject is displayed. The inner hide operator hides the second attribute from the displayedresult, that is subject ID, leaving the data result unchanged. The proj operator projects the data result onthe second attribute, again the subject ID, leaving unchanged the displayed result. The user does no longersees the column† subject ID, but when she/he selects a subject tuple, its ID value is the only attributepassed to service Teachers, which retrieves the teachers belonging to that board of examiner. Finally,the outer hide operator hides the column teacher ID leaving the data result unchanged.

More details on this example and its specification in a relational environment are in Section 3.4.

†The hide operator works on the display result independently from the kind of presentation style. For instance, by applying the

hide operator to a result displayed through a three dimensions graph, the display result can be projected to a two dimensions graph.

GIANLUCA MORO HWDO374

'HILQHG6HUYLFHV

Let$\1\n be a defined service where each \ i (for 1≤ L≤ Q) is either a service or an unboundinput parameter. For any service identifier $ (with arity n) there must be a unique GHILQLQJHTXDWLRQ

def$[1_N1 ,[n_Nn := 6

where the parameter names [1[n are distinct and are the only parameter names which may be freein 6

Defining equations could introduce recursion, since 6 may contain any service identifier, even $ itself.In order to limit our attention to ILQLWH services, i.e. services with finite behavior, we require that the rightside of a defining equation $ may contain calls to service identifiers defined before $ avoiding thus directand indirect recursion. Of course, this is a sufficient condition for the termination. Additional investigationis necessary to explore the problems of recursive definitions and its impact on the service algebra.

'HULYHG2SHUDWRUV

Several operators can be derived on the basis of the previous ones by defining them as new servicesthrough def equations. Some examples of derived operators are the ELQDU\PXOWLSOLFDWLRQ, the HTXDO fortesting whether two services return the same result, the FRQFDWHQDWLRQ to concatenate two tuples selectedby the user from the results of two services, and the GLVSOD\GDWDYDOXH to manage lookup tables. All ofthem can be used to simplify expressions writing (details in [23]). As an example, the definition of thedisplay data/value operator follows.

'LVSOD\'DWD9DOXH Let 6 be a service with JUDGHU6 S , and \ an input parameter accepting a tuplesequence whose content is an ordered set of natural numbers, that is σy = [τy1

,..,τyn] where τyi

= (D i ) ∈ 1,..., S such that FDUGσy≤ S (for 1 ≤ L≤ n). Thus GGY6σy is the service 6 with the following behavior:it hides, on J6 the presentation of the attributes at the positions indicated by numbers belonging to σy;these hidden attributes only make up the service result set from the data point of view; we can obtain thesebehaviors by defining the following service:

Fig. 3: Example of Combined Services

Compositional Algebra for Interactive Data Access 375

def GGY[_Q\_Q:= SURMKLGH[\\

Sections 3, 3.3.3, 3.4 and 3.5 present some usage examples of this operator.

8VHU,QWHUDFWLRQDQG'DWD$FFHVV&RPSXWDWLRQ7ZR2UWKRJRQDO'LPHQVLRQVLQ'DWD0DQLSXODWLRQ

Before presenting the properties of the service algebra we need to highlight the impact of interaction inthe algebra itself. In every algebra the properties hold because two or more identical occurrences of thesame symbol, being considered of the same value, can give rise to simplifications, and therefore to theapplication of the relative properties.

This means that there must exist a precise way to establish when two occurrences of the same symbolare considered identical. For example, in a math expression of functions such as I[I[I[, thethree occurrences of x are considered identical because they assume the same value, conversely for thesame reason, the three occurrences of I are not considered identical. In fact, I[ does a computation ingeneral different from that of I[, while, on the contrary, I[ I[ can be simplified by writing∗I[

An analogous criterion must also exist in the service algebra in order to establish when two or moreoccurrences of a service are considered identical. The service algebra together with the computation ofdata takes into account the user interaction (Figure 4) because the service model subsumes bothdimensions. This implies that two occurrences of a service are considered identical when both occurrencesare identical on both dimensions. In other words, two occurrences considered identical in a traditionalalgebra (without the interaction aspect), could be considered different in the service algebra because theycould be different from the user interaction point of view.

For instance, let us consider the expression 4565 (Figure 4 lower left) as belonging to atraditional algebra (with the only data computation dimension), then the two occurrences of the samesymbol 5 are considered identical because they share the same computed value. If we consider the sameexpression as belonging to the service algebra, the two occurrences of 5 are identical from the datacomputation point of view but they could be different from the user interaction point of view. In fact if werewrite the same expression by changing the expected cardinality, that is 45_65_ (Figure 4 upperleft), for the two occurrences of the service 5 is expected the same result U5 and two distinct userselections X5 Therefore, in this case U5 is computed just once and if FDUGU5 > 2, then twocardinality mismatches occur and two distinct user interfaces are generated in order to let the user select atmost one tuple from the first one and at most two tuples from the second one. Therefore, in this case thetwo occurrences of 5 cannot be considered identical and they cannot be reduced to one from the userinteraction point of view, in other words one interface is not sufficient while one computation is.

When two occurrences of the same symbol depend on different service expressions, that is they havedifferent expressions as arguments, they compute different results. For instance let us consider theexpression 5657 (Figure 4 lower right) where 5might represent in a traditional algebra a functionwith distinct arguments. In this case, the two occurrences of 5 cannot be considered identical from thedata point of view because in general two distinct arguments produce two distinct results. Also in theservice algebra the same expression generates for the two occurrences of 5 two distinct computations andone interface because the plus operator displays its result in a single interface (see Section 2.2.1). Inaddition, in the service algebra two distinct computations for two occurrences of 5 can give rise to twodistinct interfaces as well. In fact, the expression 456857† (Figure 4 upper right) generates forthe two occurrences of 5 two computations as in a traditional algebra but also two interfaces because twocardinality mismatches and two distinct user selections can occur.

So in the service algebra two or more occurrences of a service 5 are considered identical if they cannotcompute two different results and do not generate two different user selections. In other words, two ormore occurrences of a service 5 are considered identical if one computation and one interface is generatedfor all of them.

†When the cardinality is omitted, it means one tuple expected (see Section 2.1).

GIANLUCA MORO HWDO376

Finally, the alias can be used to force different interfaces. For example the expression 5[65\6generates for the two 6a single computation and two distinct interfacesAs the two 5may receive twodistinct arguments, there will be two distinct computations for 5.

3URSHUWLHVRIWKH6HUYLFH$OJHEUD

A description of the algebraic properties of the operators introduced in Section 2.2.1 follows. Theproperties hold both at the data level and the user interface level, in that the algebraic simplification ofservice expressions determines the simplification of corresponding GUIs as well. From the data point ofview the algebraic operators satisfy some usual properties, such as associative, commutative, reflexive,distributive, and absorbing. These properties are analogous to those of relational algebra, (see, forinstance [33]), more details on this are in [23].

The algebraic properties related to the user interface deriving from the algebraic combination ofservices characterize the service algebra and it is worth considering them in detail. As a generalobservation, it may be the case that a user produces a complex operation by combining a set of existingservices with the algebra operators. The algebraic properties are a tool to simplify/optimize an expression,as happens, for instance, in a relational environment.

$VVRFLDWLYH3URSHUW\1a) Composition:

since :o ;o < is written in the form :;< independently from left or right association, thenonly one combination of the corresponding user interfaces is possible;

1b) Summation:

;<: generates an interface for the result of ;< ; as this result is summed to :, then wehave only one user interface for the final result;

;<: generates an interface for the result of <:, as this result is summed to ; then wehave only one user interface for the final result;

1c) Cartesian product:

by changing in 1b + into × this proof becomes identical to 1b;

&RPPXWDWLYH3URSHUW\2a) Summation:

;< generates the same interface of <;, since the operator does not produce interfaces for itsoperands but only for the final result;

5HIOH[LYH3URSHUW\3a) Summation:

;; generates one user interface for the result whose content is identical to ;, then J;; =J;;

4 5 65 Å1 C o m p uta tion ,1 In te rface fo r bo th 5

4 5 |1 +6 5 |2 Å1 C o m p u tation ,2 In terfaces fo r bo th5 ifFDUG 5 !

4 5 6 8 5 7 Å2 C o m p uta tions,2 In te rfaces fo r bo th 5

5 6 5 7 Å2 C o m p u tation s,1 In terface fo r bo th 5

Fig. 4: Data Computation and User Interaction

Compositional Algebra for Interactive Data Access 377

4) 'LVWULEXWLYH3URSHUW\4a) Cartesian product with respect to summation:

;× <: generates the same interface of ;× <;×:, that is J;× <: =J;× <;×: because both operators do not produce interfaces for its operands but only forthe final result whose contents in both cases are identical;

4b) Cartesian product with respect to difference:by replacing in 4a the + with -, the proof for ;× <-: becomes identical to 4a;

5) $EVRUELQJ/DZV5a) Summation with respect to difference:

J;;-: = J; because both operators do not produce interfaces for its operands but only forthe final result whose contents is equal to U;;

6) 7KH(PSW\6HUYLFHThe properties regarding the empty service hold also from the user interface point of view:

6a) ∅ as neutral element for the summation:

J∅; = J; that is ∅; generates the same interface of ; because generates the onlyinterface for final result;

6b) ∅ as absorbing element for the Cartesian product:

J;× ∅ = J∅× ; = J∅

6c) Projection: SURM∅, [(p1),...,(pk)] = ∅, the projection of the empty service is the empty service

also at interface level whatever be [(p1),...,(pk)].

0DSSLQJ([SUHVVLRQVRI6HUYLFHVWR*8,

The user interface of a software has an outstanding role in making its usage understandable andcomfortable.

For obtaining this result, the user interface should communicate to the user the semantics of its usagethrough its organization and arrangement. For example, in a master-detail relationship among two sets ofitems, when the user selects an item from the master interface, its details are presented in thecorresponding interface. The semantics of these kind of interactions could be communicated to the user byarranging the interfaces according to precise rules. This approach can be well exploited in the servicealgebra because, being the user interaction an integral part of the model, the user interactions areautomatically computed from service expressions. This section will show that this fact allows specifying aEHKDYLRUDO UXOH for interface arrangement, rather than to program interfaces and theirarrangement/cooperation.

Let us consider again Figure 3. It is the result of a composition where the output of Subjects is fed asinput to Teachers. For this reason, we can say that Teachers GHSHQGV on Subjects and the interfacemust take into account this dependence. Moreover, this dependence does not influence the way the singleservices are presented. An implementation of the service algebra must perform adequate choices for thepresentation of the services and for their arrangement and dependencies when combined in complexexpressions. For instance, the present implementation of JAccess shows the master set of items as a list (orlistbox) in a window which is child of the window of the detail. A different implementation could makedifferent choices as well, for instance, floating menus for the detail. The added value provided by theservice algebra is that the interface of the combined service can be computed and activated whennecessary on the basis of precise rules and actual data. As a general rule, we assume that in an expressionwhere the input of a service 6 depends on the output of a service 7 (e.g. 67) when the interface of 7 isvisible the interface of 6 must also be visible, in order to let the user watch both the result of a tuplechoice in 7and the result of 6which is influenced by 7. A way for guaranteeing this property is arrangingJ7 insideJ6in such a way that J7becomes a child window of J6. In this case when the user movesthe parent interface, that is J6 the child interface J7 follows the parent interface through the samemovement. This GHSHQGHQFHcan be viewed as a binary relationship D which determines a partial orderingamong services in an expression.

GIANLUCA MORO HWDO378

(a) 5 and 7 not Overlapped in Separated Subwindows (b) 5 and 7 Overlapped in Separated Tabfolder

Fig. 5: Two Representations of Mutually Independent User Interfaces of Services 5 and 7 of the Expression 657

Let us consider a slightly more complicated expression 657. In this case 6 depends on 5 and on 7(that is 6D5 and 6D7 ), but 5 and 7 are not in relationship. This means that the result of 5 and 7aremutually independent; their results do not depend on each other, therefore their interfaces areindependent, too. As an example, let 6 be a service which retrieves boards of examiners which containmore than a given number of members and which contain a given teacher. 5 is the service which retrievesthe set of teachers and 7 retrieves a set of numbers which represent the number of members of each board.

Then on the basis of the relationship D, Figure 5 presents two possible mappings of 657 to GUI(the present implementation of JAccess allows both, depending on configuration parameters).

The next section explains in detail the mapping from service expressions to user interfacesorganization; the mapping is carried out by taking into account four base expressions and, as an example,four complex expressions.

%DVHDQG&RPSOH[([SUHVVLRQV

According to the dependence relationship, Table 1 shows what interfaces are generated by applyingoperators to service expressions and how they are arranged together.

The upper part of the table refers to the four base expressions (with the relative GUIs), from whichsome more complex expressions, illustrated in the lower part, are derived. The symbols XYW and Zdenote services, while the symbol RSindicates an operator.

The first expression represents a single service which generates a user interface displaying the result.In the second one a binary operator is applied to two services and the result is displayed in a single userinterface. The third expression is a composition between two services, X ° Y; X output depends on Yinput, that is X D Y, therefore according to the rule defined in previous section they are to be mutuallyvisible in a parent-child relationship.

Let us describe a complex expression, for instance the expression 6. It is to be dealt with according tothe base expressions 2 and 3, because it contains a binary operation among two service compositions. Forthis reason, this complex expression generates three interfaces: the first two are for X and Y while thethird is for the result of the operator applied to W. Additionally, as W depends on X and Y, the last twoare arranged within W, finally, as X and Y do not depend each other, X can overlap Y and vice versa.Analogous considerations can be made for expressions 5, 7 and 8.

Compositional Algebra for Interactive Data Access 379

%$6((;35(66,216

(1) ;Generates a GUI

(2) ;RS<Generates a single GUI

with the result of RS

(3) ;°<Generates 2 GUIs in

parent-child relationshipbecauseX D Y

(4) RS;Generates at most a GUI

based on X

X

X RSY Y

X

RS(X)

&203/(;(;35(66,216

(5) :;RS<By 2,3 it generates2 GUIs in parent-child relationship

becauseW D (XRSY)

(6) :;RS:<By 2, 3 it generates 3GUIs, X and Y can

overlap, while W is inparent-child relationship

with X and Y

(7) :;RS<;By 1, 2 and 3 it generates

2 GUIs in parent-childrelationship because

(W(X) RS Y(X)) D X

(8) :;RS<=By 2, 3 it generates 3GUIs, X and Z can

overlap, while W RS Y isin parent-child

relationship with X and Z

X RSYW

X

W(X) RS W(Y)Y X

W(X) RS Y(X)

X

W(X) RS Y(Z)Z

Table 1: Base and Complex Expressions and Relative Generated Interfaces

The service algebra guarantees that each expression is a service, therefore all GUIs generated by anexpression are displayed within a comprehensive interface. As mentioned in Section 2.1 each interface hasto provide at least a FORVH button and VFUROOEDUV (or option to change the dimensions) whenever the displayarea of the expression does not fit in the interface. Of course, this last rule is recursively enforced also byeach GUI of service subexpressions involved in the expression.

3. SERVICES IN RELATIONAL ENVIRONMENT

The service model makes data access more convenient, thanks to the abstraction level it is groundedon. The main advantages are the following:• it eliminates the code for accessing databases, and for manipulating results;• it eliminates the code for giving cooperating behaviors to several user interfaces in order to navigate

interactively through data;• it eliminates the code for integrating data sources of different data models, for example relational and

object databases;• thanks to the architectural choice, a service can be remotely developed and concurrently used in a

world wide network of heterogeneous machines like the Web.

Up to now we have not described any language for implementing services and this means that theservice model, including service algebra, is independent from any existing data model. For this reason, wemay think of implementing some services by using SQL and some other by using an object query languageand then combine them by writing declarative service expressions.

In this section, we show the extension of the relational query language SQL with the service algebraoperators. The extensions are mainly related to the user interaction and, at a smaller extent, to SQLsemantics. We introduce the question mark symbol within a SQL statement as a SDUDPHWHU forrepresenting a variable (more generally a tuple sequence), whose values are determined run-time by theuser interaction.

For instance, let us consider the following master-detail service 6:

GIANLUCA MORO HWDO380

1) the master part displays at first a sequence of courses whose result contains as display value (seeSection 2.2.3) the course names and as data value the course id selected by the user (with a label“select a course id”);

2) the detail part displays an empty window; every time the user selects a course from the master(\1 indicates the expected cardinality), the subjects belonging to it populate the detail;

6 select subject_id, subject_name, teacher_idfrom subjectswhere course_id = ? (ddv( (select course_id, course_name from courses order by course_name),[(1)] ) )\1 as† select a course id”

64/([WHQVLRQVIRU5HODWLRQDO6HUYLFHV

A SQL statement, whose constant terms respect the following Backus Naur Form, is a relationalservice:

<Constant> ::= <Number>|<String>|<Date>| ?<parameter><Card> <label>

| ?(<Service Expression>) <Card> <label>

<Card> ::= \<Natural Number> | \n | λ

<label> ::= as <text string> | λ

<Service Expression>::= <Service Expression> Â<Factor3>|<Factor3>

<Factor3> ::= <Factor2> | <Factor3> - <Factor2>

<Factor2> ::= <Factor>|<Factor2>+<Factor>|<Factor2> ∗Á<Factor>

<Factor> ::= <Term> | <Factor> × <Term>

<Term> ::= <Service> | <Projection> | <Hide>

<Service> ::= <SQL Statement> *| <Service Identifier>

| (<Service Expression>)

<Service Identifier>::= <Identifier>(<Arguments>) | <Identifier>()

<Arguments> ::= <Service Expression> <card> <label>, <Arguments>

| <Service Expression> <card> <label>

<Projection> ::= proj(<Service Expression>,<Integer List>)

<Hide> ::= hide(<Service Expression>,<Integer List>)

The SQL syntax is extended simply by allowing as an alternative to the FRQVWDQW a question markstanding for a nested service expression or an input box. The semantics of the question mark is to activatea possible user interaction in order to obtain values to be used as constants. In case of ?<parameter> theuser edits values by an input box while in case of ?(<Service Expression>) we have a serviceexpression composition. Therefore, when a cardinality mismatch occurs, the user selects values from thecorresponding result set.

†In the next examples we omit labels for keeping the body of services as simple as possible.

‡Here we use the multiplication and concatenation in infixed notation for uniformity with the summation operator; they are the

derived operators mentioned in Section 2.2.3.*At the moment we confine our attention to the select statement.

Compositional Algebra for Interactive Data Access 381

The BNF above provides for service identifiers, as described in Section 2.2.1. For any serviceidentifier $ (with arity n) there must be a unique GHILQLQJHTXDWLRQdef$[1|N1 ,[n|Nn := 6wherethe input parameters [1 [n are distinct and are the only parameter names which may occur free in 6 asillustrated in Section 2.1.

Defining equations provide recursion, since 6 may contain any service identifier, even $ itself. Asobserved in Section 2.2.1, we limit our attention to non-recursive services, in such a case relationalservices.

+LJKHU/HYHO6HUYLFH0HWD6HUYLFH

In order to obtain higher level services, we extend the attribute and table term of SQL BNF asfollows:

<Attribute> ::= [<Table>.|<Alias>.]<Identifier>| ??<Service Expression>

The extensions above allows replacing an Attribute (or an attribute list) with the result of a serviceexpression, while the following allows replacing a Table (or a table list) with the result of a serviceexpression:

<Table> ::= [<owner>.]<Identifier>| ??<Service Expression>

With these extensions a service expression may change during its computation in consequence of theuser interaction. For example, by changing the attribute list in the group by clause of a SQL statement, theservice is able to calculate and display different aggregations (see data cube [2]).

In addition, a higher order service allows the definition of meta-services for performing query byexample because the service expression can be instanced by the user during the interaction.

2SHUDWLRQVZLWK5HODWLRQDO6HUYLFHVDQG([DPSOHV

The following two subsections focus attention on the effect of the user interaction in the comparison oftuples and on the concept of weak compatibility among tuples and among services. The reminder of thesection shows the application of the service algebra operators through some examples.

7KH,QWHUDFWLRQLQWKH6WUXFWXUHG&RPSDULVRQRI7XSOHV

In general, a comparison of two tuples can be reformulated as a set of comparisons component bycomponent connected by AND. For instance let us consider this comparison between two tuples variablesof arity 2:

(x,y) = (v,w)

in SQL (as in other languages) this comparison can be reformulated as follows:

x = v AND y = w.

According to the service paradigm, the tuple sequence returned as a final result of a service 6 becomingpossibly input argument for another composed servicecan be in general also a subset X6of the tuplesselected by the user from U6. For this reason, let us consider a comparison between a variable tuple andthe tuple selected by the user from the result of a composed service:

(a) (x,y) = ?(select v,w from ...)\1

if we rewrite the expression (a) according to the above described pattern, we obtain

(b) x = ?(select v from ...)\1 AND y = ?(select w from ...)\1

the semantics of (b) would be different from (a). In fact, let us suppose that the tuple sequence displayedto the user by the inner service in (a) is the following:

GIANLUCA MORO HWDO382

[(v1,w1),(v2,w2)]

then the user, because of a cardinality mismatch, must choose one of the two valid tuples.On the contrary, in case of (b) the composed services are two, and two cardinality mismatch occur,displaying to the user two tuple sequences:

[(v1),(v2)] and [(w1),(w2)]

The user might select from the first sequence the tuple (v1) and from the second sequence the tuple (w2)generating in this way the tuple (v1,w2), which does not exist in the database.For this reason, due mainly to the interaction aspect, the expression (a) cannot be rewritten as (b), and inthe service paradigm the approach should be different.The solution can be deduced from Section 2.3, where we point out that two or more identical occurrencesof a service in an expression are considered the same service. For convenience let us call VW the innerservice above mentioned in (a):

select v,w from ...

The expression (a) can be rewritten as follows:

x = ?(proj(VW, [(1)]))\1 AND y = ?(proj(VW, [(2)]))\1

The two occurrences of service VW, as explained in Section 2.3 are identical and therefore considered thesame service with a single computation and a single user interface.The consequence is that the user selects a single tuple and through the projection operator the firstcomponent Y is compared with x while the second component w is compared with y.However, in order to ease facilitate the writing of expressions, our extension of SQL includes thestructured comparison according to that described in the next section.

:HDNO\&RPSDWLEOH7XSOHV

SQL gives a notion of compatibility which is valid for atomic values, and it makes reference to theassignment compatibility between variables as in typed programming languages, but the notion ofcompatibility between tuples requires identity of grade and assignment compatibility for each component.In order to improve the reusability of services, we propose weaking this notion of compatibility byintroducing the oriented relation of ZHDNFRPSDWLELOLW\.

Let τa = (D1Dn) and τb = (E1Em) be two tuples where DULW\τa = Q and DULW\τb = P, then τa isweakly compatible with τb if, and only if, the following condition is satisfied:

Q ≤ P and for each M (1 ≤ M ≤ n) the data type of Dj is assignment compatible with the data type of Ej.If the previous condition holds in both directions, then τa and τb are FRPSDWLEOHand P = Q.It is possible to nest a relational service inside another if the tuple in the nesting position in the

external service is weakly compatible with the tuples returned by the inner service. In this case theexternal service is weakly compatible with the inner one. This condition is also useful to avoid typemismatching at run-time because it allows to check mismatch type in operations among services atcompile-time.

We can observe that the concept of weak compatibility is not a first class concept because if twoservices are weakly compatible they can be made compatible by applying the projection operator to theinner one.

&RPSRVLWLRQRI5HODWLRQDO6HUYLFHV

Let us consider the new service 5 to retrieve all the exams for a given set of subjects and display foreach exam the mark, date and student id:

5 select stud_mark, date, stud_idfrom examswhere subject_id in ?x\n

Then, let us consider the previous service 6 introduced in Section 3 which retrieves all subjects

Compositional Algebra for Interactive Data Access 383

belonging to a given course selected by the user. By composing 5 o 6 we obtain a new service whichretrieves all the exams referring to subjects belonging to a given course selected by the user:

5o 6 select stud_mark, date, stud_idfrom examswhere subject_id in ? (select subject_id,subject_name,teacher_id from subjects where course_id = ?

(GGY((select course_id,course_name from courses

order by course_name ),[(1)] ) )\1 )\n

If the database contains more than one course then this composed service generates two GUI (see baseexpression number 3 in Section 2.6):1) the first (inside the second) contains a list of courses from which the user has to select one2) the second GUI displays the final result containing the set of relative exams.

The subjects belonging to the selected course are not displayed because a cardinality mismatch cannotoccur since its value is Q.

Since the GUIs corresponding to the above expression remain available until the user does not closethem, every time the user selects (through the mouse or keyboard) a course name, the relative examspopulate the second window.

Generally, a service can contain zero or more parameters and there is no limitation by principle to thenumber of nested compositions.

Though the tuple type returned by 6 is made up by three attributes (subject_id, subject_nameand teacher_id), it is compared with a tuple formed by the single attribute subject_id. This isallowed thanks to the weaken compatibility described in previous subsection. In fact the condition forcomposing a service 5 with a service 6 (that is 5 o 6) is that the comparison tuple (or nested tuple)belonging to 5 must be weakly compatible with tuples returned by 6 . In this case, we say 5 is weaklycompatible with 6 .

3URMHFWLRQRI5HODWLRQDO6HUYLFHV

Let us consider the service 6 defined in Section 3 and introduce a new service 4 to display, from ateacher id, his/her name and affiliation department:

4 select t.teacher_id, t.teacher_name, d.department_namefrom teachers t, departments dwhere t.teacher_id = ?x\1 and t.department_id = d.department_id

Now by selecting a course we would like to navigate on subjects up to teachers and departments. Then weshould compose 4 o 6 , but the comparison tuple for 4 (in this case, the atomic value) teacher_id doesnot semantically match with the tuple returned by 6 (the three values subject_id, subject_name,teacher_id).

The projection operator allows the comparison of the two tuples and the combined service is writtenas follows:

4 o SURM6[(3)]

GIANLUCA MORO HWDO384

$8VH&DVHRIWKH&RPSRVLWLRQ3URMHFWLRQDQG+LGH

Section 2.2.1 described the algebra operators and a service example (Figure 3) obtained by combiningtwo services through the algebra operators (Figure 2). The purpose of this section is to show a way toexpress such services by using the extended SQL.

The example of Section 2.2.1 (Figure 3) retrieves the teacher’s names belonging to the board ofexaminer of a specified subject selected by the user.

Subjects Select Name, IDfrom SubjectListas "Subject List"

Teachers Select Name, IDfrom BoardOfExaminerswhere subject_id = ?x\1 as "Input a Subject ID"as "Board Of Examiner of a given Subject"

Table 2: Services of Figure 2 Expressed in Extended SQL

Table 2 contains services of Figure 2, that is Subjects and Teachers. Subjects is the servicewhich retrieves the list of subjects with their Name and ID, “Subject List” is the service display label whenits GUI is visible. Teachers is the service which retrieves Name and ID of teachers which are members ofthe board of examiner of a given subject, that is the pa meter x. “Input a Subject ID” is the display label ofthe parameter while “Board Of Examiner of given Subject” is the service display label.

To obtain the service of Figure 3 we can write one of the following equivalent expressions of Table 3.The algebraic expression on the left side combines the two services by using only the algebra operators:its result is equivalent to the expression on the right side which contains services explicitly expressed inextended SQL.

hide( Teachers( proj( hide( Subjects(),[(2)] ),[(2)] )|1 ),[(2)])

hide( (Select Name, ID from BoardOfExaminers where subject_id = ?( proj( hide( (Select Name, ID from SubjectList as "Subject List" ),[(2)] ),[(2)] ) as "Input a Subject ID" )\1 as "Board Of Examiner of a given Subject" ),[(2)])

Table 3: Equivalent Expressions of the Combined Service of Figure 3

First the inner SQL statement is executed to retrieve the name and identifier of the subjects. Then thehide operator makes invisible the second attribute, that is the identifier, leaving unchanged the data resultset. On the contrary, the projection operator projects this data result set on the identifier, again the secondattribute, leaving unchanged the displayed result.

When the cardinality of the retrieved subjects is greater than one, a cardinality mismatch is raised andthe result of the inner service is displayed to let the user select a subject. For example, by selecting)RQGDPHQWLGL,QIRUPDWLFD,,,† (see Figure 3), we obtain, on the bottom, the result of the external service,that is the correspondent board of examiners.

†In English )XQGDPHQWDOVRI&RPSXWHU6FLHQFH,,,

Compositional Algebra for Interactive Data Access 385

The above service expressions can be simplified by using the derived display data/value operator (GGYdefinition in Section 2.2.3) as shown in Table 4:

hide( Teachers( GGY( Subjects(),[(2)] )|1 ),[(2)])

hide( (Select Name, ID from BoardOfExaminers where subject_id = ?( GGY((Select Name, ID from SubjectList as "Subject List" ),[(2)] ) as "Input a Subject ID" )\1 as "Board Of Examiner of a given Subject" ),[(2)])

Table 4: Services of Table 3 Expressed with the GGY Operator

6HUYLFHVIRU0RGLI\LQJWKH'DWDEDVH

Since the SQL extensions regard the constant term (as shown in Section 3.1), a service may also usethe update, insert and delete SQL statement for modifying the database. The input parameters of an insertmay be placed in the values clause. Let us consider a service 8 for inserting subjects with thecorresponding course and teacher. If we had built the service 6 by defining the inner part, which retrievesthe courses (see Section 3), as a separate service 7, that is:

7 GGY((select course_id, course_name from courses

order by course_name ),[(1)]

)

we would be able to obtain the service 8 by reusing the service 7through the composition as follows:

8 insert into subjects(course_id,subject_id, subject_name, teacher_id) values(?(T),?x,?y,?(GGY((select teacher_id,

teacher_name from teachers order by 2 )[(1)] ) ))

As the first and last parameter of service 8 are both bounded to services (with expected cardinality =1, omitted), two list boxes displaying course names and teacher names respectively are generated(Figure 6). The other unbound parameters generate two edit boxes.

When the user presses the OK button, all input data provided become constant term of the insertstatement which store them on the database. For what concerns the position of input parameters in theupdate and delete statements, there is no difference with respect to select or insert. In fact, the parametersmay be placed everywhere a constant is allowed: for the update, in the where clause or in the right side ofset clause, while for the delete in the where clause only.

GIANLUCA MORO HWDO386

Fig. 7: Main Window of JAccess Applet

4. JACCESS: A TOOL FOR DATA ACCESS SERVICES IN WEB ENVIRONMENT

The tool is a Java applet [3, 25] plus a middleware using the JDBC package [9, 12, 13] for relationalDBMS connectivity and the RMI package (Remote Method Invocation) [26, 27, 30] which is the JavaDistributed Object Model used for the communication between applet and middleware.

It runs on whatever operating environment equipped with a Java enabled browser and can beconnected to every DBMS provided with a JDBC driver (currently the main supported DBMSs areOracle, SQL Server and Informix†).

The current implementation of the tool, called JAccess (Figure 7) [20, 21], allows the developmentand distribution of services in Web environment by involving two types of actors:• the end-user accesses the services, possibly subject to permissions on a group-wise basis (Figure 7 and

Figure 10)• the developer remotely creates, modifies and deletes the services in a declarative style by means of the

extended SQL (all the low level functionalities are automatically generated by the system) (Figure 8and Figure 9) and manages users and group permissions (Figure 9 and Figure 10).

Menu options (Figure 8) are enabled on the basis of the user type, for example an end-user can executeservices on a group-wise basis but cannot create/remove/modify services or user permissions, therefore allmenu options are disabled, except Connection and Help. Contrarily these menus are enabled for theservice developer.

With reference to Figure 9, the developer creates a service (in this case the service of Figure 3,Table 3) by specifying the expression, including extended SQL expressions and algebra expressions, anddefining the service name, which service groups it belongs to, and authorizb user groups to execute it.

†A complete list of available JDBC drivers can be found at http://industry.java.sun.com/products/jdbc/drivers.

Fig. 6: A Modifying Service

Compositional Algebra for Interactive Data Access 387

Fig. 8: Menu Items of JAccess

Fig. 9: Window for Creating Services

The window of Figure 10 makes it possible to transmit execution permissions of a user group to otheruser groups by means of the multiple inheritance mechanism. For instance in the domain of ourdepartment the VWXGHQWVgroup (row 4) inherits execution permissions (directly) from LQWHUQHWXVHUVgroup(column 2); WHFKQLFDOVWDIIgroup (row 6) inherits (directly) from the VWXGHQWV group and also (indirectly)from LQWHUQHW XVHUVgroup due to the transitive property. A direct inheritance between two user groupsbecomes enabled by clicking on the relative square, while the derived indirect inheritances are computedautomatically. In general a user group can inherit from two or more other groups: for instance XVHUDGPLQLVWUDWRUVgroupinherits from both VWXGHQWVand WHDFKHUVgroupsand a user group can be inheritedfrom two or more other user groups, for instance XVHU DGPLQLVWUDWRUV group is inherited from bothDGPLQLVWUDWRUVand VHFUHWDULDWgroups

GIANLUCA MORO HWDO388

Fig. 10: Hierarchy of Execution Permissions among User Groups

-$FFHVV6HUYHU

-$FFHVV&OLHQW

-$FFHVV&OLHQW

-$FFHVV&OLHQW

DBMS 1 DBMS n

:::6HUYHU

'%066HUYHUV

:::&OLHQWV

(4) demand servicescompiled into a Javaobjects network

(5) servicemigration andexecution onclient demand

(1)Executionof JAccessclient onclient side

(3) demand servicesare retrieved fromthe main dbms

1HWZRUN

1HWZRUN

(2) services demandsfrom clients

(6) data access requestsfrom services runningon clients

(0) Migrationof JAccessclient onclient side

(7) modifying andretrieving datafrom dbms forJAccess server

(8) user interactionwith service results

Fig. 11: Architecture of JAccess

The main components of JAccess architecture (depicted in Figure 11) are the following [23]:• the client is a thin Java applet whose main purposes are to realize the JAccess user interface and to

provide a suitable environment for the execution of services coming from the JAccess Server throughthe network; when a user visits the JAccess page on the Web server, the client migrates on the user’smachine (step 0, 1 and 2 of Figure 11);

• one or more heterogeneous DBMSs located in a network of heterogeneous machines manage thedatabases and interact with the JAccess Server via a JDBC interface; one of the DBMS stores theservices and configuration data of JAccess (SULPDU\DBMS);

• the JAccess Server runs on the Web Server machine, and is a Java application with the following mainpurposes:

1. translates services into Java object networks and delivers them to the demanding clientmachines (step 3, 4 and 5 of Figure 11);

Compositional Algebra for Interactive Data Access 389

2. provides the view of the different databases as a list of different sources, hiding to the usersand the service developers both the details of the location of the data and the heterogeneity ofDBMSs;

3. addresses the client’s request to the DBMS servers and delivers back the results (step 6, 7 and8 of Figure 11).

As concerns the second point, the current version of the tool allows a service SQL statement to refer toany number of tables belonging to the same data source. Therefore, at the moment, a simple service (i.e. aservice based on a single SQL statement) cannot access two distinct data sources. But this is not a realobstacle because a service expression, in general made up of several services, can have more than oneSQL statement involving tables of different data sources.

The tool is available at http://www2.ingce.unibo.it/jaccess and a more detailed description of thearchitecture and implementation is reported in [23].

5. RELATED WORKS

As mentioned in Section 1, several commercial tools provide technological solutions for the automaticgeneration of interfaces to databases, but none of them offers a general theoretical framework or generalmechanisms for the combination of interactive data access services.

In the area of HCI the works related to data access can be divided into two groups: one group isinterested in the aspect of visual queries formulation and data presentation [7, 14, 15, 17, 29, 32], theother group concentrates on user interface design models [10, 11] and on formal models to expressinteractive systems behavior.

The works in the first group deal mainly with the interesting topic of visualization techniques of dataand user friendly interaction for formulating queries. They are complementary to our work, sinceadvanced presentation interfaces can be built on top of the service algebra, whose present implementation,JAccess, is provided only with basic presentation features.

The works in the second group provide models for the VSHFLILFDWLRQ of interaction and are useful inorder to design unambiguous interactive systems. However, at the best of our knowledge none of theseworks provides a FRPSXWDWLRQDO model, such as the service algebra, which can combine interactivecomputational abstractions for data access. For this reason we can say that our contribution is original andcomplementary to the works known in the literature on interactive data access.

With respect to the semantics of complex services in service algebra, the work [16] deal with theproblem of the expressive power of querying a limited set of views. This could be applied to the servicealgebra, providing a theoretical framework to determine the expressive power of the algebraiccombination of services, given a fixed set of initial services.

6. CONCLUSIONS

We presented a new database access paradigm called VHUYLFHwhich is mainly oriented to interactivedata access. We defined an algebra for services allowing several kinds of combination. The algebra dealsboth with the computational and user interaction aspects. The user interaction is based on graphical userinterfaces. The result allows to declaratively define complex data access at an higher abstraction level withrespect to present languages and development tools. We implemented a tool, based on Java, allowingconcurrent and cooperative usage of services in a network of heterogeneous machines, in Webenvironment, and are experimenting it in real-world environment.

Additional work must be done in order to obtain a full featured environment for database applications.In fact, the notion of service is characterized by three dimensions: data access computation, userinteraction and presentation, but at present we covered mainly the first two dimensions and in particular,we formally defined, through the algebra, when a user interaction is necessary and can be automaticallyprompted. In order to allow more powerful and flexible presentations, a service could be provided with akind of style-sheet [1, 8].

Other directions for extensions are both on the logical and implementation side. For the logical side weare studying recursive services and additional operators for the presentation (such as the data cube). Inparticular, recursion has a strong theoretical impact on the model and on the algebra. For the technological

GIANLUCA MORO HWDO390

side, thanks to a three tier architecture, an additional server component could allow overcoming the limitof having simple services on a single data source. The JAccess server could generate a virtual centralizeddatabase able to integrate several data sources. In this way the presence of several DBMSs located in thenetwork, possibly different with respect to the brand or to the data model, would become completelytransparent to the service developer and the end-user.

Finally, the issue of performance is still to be addressed. Both the architectural choices and theimplementation aspects influence the usage of the network, which is probably the main bottleneck of thesystem.

$FNQRZOHGJHPHQWV Gianluca Moro wishes to thank his family Giuseppe, Ferminia, Roberto and Monica for their precious andcontinuous encouragement.

REFERENCES

[1] S. Abiteboul, B. Amann, S. Cluet, A. Eyal, L. Mignet, and T. Milo. Active views for electronic commerce. 3URFHHGLQJVRIWKHWK9/'%&RQIHUHQFH, Edinburgh, Scotland, pp. 138-149 (1999).

[2] S. Agrawal, R. Agrawal, P. Deshpande, A. Gupta, J. Naugthon, S. Sarawagi, and R. Ramakrishanan. On the computation ofmultidimensional aggregates. 3URFHHGLQJVRIWKHQG9/'%&RQIHUHQFH, Bombay, India, pp. 506-521 (1996).

[3] K. Arnold and J. Gosling. 7KH -DYD 3URJUDPPLQJ /DQJXDJH, 6HFRQG (GLWLRQ. Addison-Wesley, ISBN 0-201-31006-6(1998).

[4] T. Berners-Lee, R. Cailliau, J. F. Groff, and B. Pollerman. World-wide web: the information universe (OHFWURQLF1HWZRUNLQJ5HVHDUFK$SSOLFDWLRQVDQG3ROLF\, (2):74-82 (1992).

[5] J. Bosak. ;0/-DYDDQG)XWXUHRIWKH:HE. http://sunsite.unc.edu/pub/sun-info/standards/xml/why/xmlapps.htm (1997).

[6] BulletProof Corp. JDesignerPro. 2QOLQH3UHVV.LW, http://www.bulletproof.com/presskit/ (1999).

[7] T. Catarci, S. Chang, M. F. Costabile, S. Levialdi, and G. Santucci. A graph-based framework for multiparadigmatic visualaccess to databases. ,((( 7UDQVDFWLRQRQ.QRZOHGJHDQG'DWD(QJLQHHULQJ(3):455-475 (1996).

[8] S. Ceri, P. Fraternali, and S. Paraboschi. Data-driven one-to-one web site generation for data-intensive applications3URFHHGLQJVRIWKHWK9/'%&RQIHUHQFH, Edinburgh, Scotland, pp. 615-626 (1999).

[9] Connect Software Inc. )DVW)RUZDUG, white paper, http://www.connectsw.com/html/white_paper.html (1999).

[10] A. Dix. Formal methods, in perspectives on HCI, diverse approaches. $FDGHPLF3UHVV/LPLWHG, pp. 9-41, ISBN 0-12-504575-1, San Diego, CA (1995).

[11] T. Griffiths HW DO. Exploiting model-based techniques for user interfaces to database 3URFHHGLQJV RI ,),3&RQIHUHQFH RQ9LVXDO'DWDEDVH6\VWHPV, Italy, pp. 21-46, Chapman & Hall (1998).

[12] G. Hamilton, S. White, and M. Hapner. JDBC 2.1 API version 0.1. 6XQ 0LFURV\VWHPV ,QF

ftp://ftp.javasoft.com/pub/jdbc/jdbc2.1.frame.pdf, http://java.sun.com/products/jdk/1.3/docs/guide/jdbc/index.html (1999).

[13] G. Hamilton, S. White, M. Hapner, M. Fisher, and R. Cattell-'%&$3,7XWRULDODQG5HIHUHQFH6HFRQG(GLWLRQ8QLYHUVDO'DWD$FFHVVIRUWKH-DYD3ODWIRUP-DYD6HULHVAddison-Wesley, ISBN 0201433281 (1999).

[14] Y.E. Ioannidis, M. Livny, S. Gupta, and N. Ponnekanti. ZOO: a desktop experiment management environment3URFHHGLQJVRIWKHQG9/'%&RQIHUHQFH, Bombay, India, pp. 274-285 (1996).

[15] Y. E. Ioannidis, M. Livny, A. Ailamaki, A. Narayanan, and A. Therber. ZOO: a desktop experiment managementenvironment$&06,*02', USA, pp. 580-583 (1997).

[16] A.Y. Levy, A. Rajaraman, and J.D. Ullman. Answering queries using limited external processors.3URFHHGLQJVRI WKHWK

$&06,*$&76,*02'6,*$576\PSRVLXPRQ3ULQFLSOHVRI'DWDEDVH6\VWHPV, Montreal, Canada, pp. 227-237 (1996).

[17] M. Livny HWDO. DEVise: integrated querying and visual exploration of large datasets3URFHHGLQJVRI$&06,*02', pp.301-312, USA (1997).

[18] Microsoft Corp. Microsoft Access 95 Information. 0LFURVRIW 3UHVV, http://www.microsoft.com/access/learn_acc95.htm(1997).

[19] R. Milner. Elements of interaction.&RPPXQLFDWLRQRI$&0 (1):78-89 (1993).

[20] G. Moro, A. Natali, and C. Sartori. Distribution of DBMS Services: a Java-based Solution. 3RVWHUVHVVLRQRIQG,WDOLDQ-DYD&RQIHUHQFH, Milan (1997); work awarded by Sun microsystems Italia; (Extended version in Technical Report n. CSITE-006-97, DEIS - University of Bologna).

[21] G. Moro, A. Natali, and C. Sartori. JAccess 2.0: a tool for implementing the service model. 3RVWHUVHVVLRQRIUG,WDOLDQ-DYD

&RQIHUHQFH, Milan (1998).

[22] G. Moro, A. Natali, and C. Sartori. Data access services and automatic generation of cooperating interfaces. 3URFHHGLQJVRI&RRSHUDWLYH ,QIRUPDWLRQ 6\VWHPV &RRS,6¶ in cooperation with 9/'%¶, UG ,)&,6 &RQIHUHQFH, ,((( &RPSXWHU

Compositional Algebra for Interactive Data Access 391

6RFLHW\, pp. 176-185, New York (1998); (([WHQGHG YHUVLRQ Technical Report n. CSITE-005-98, DEIS - University ofBologna, June 1998, http://www-db.deis.unibo.it/sartori/lavoro/coopis98ex.pdf).

[23] G. Moro. $&RPSRVLWLRQDO$OJHEUD IRU'DWD$FFHVV DQG8VHU ,QWHUDFWLRQ.Ph. D. Thesis, DEIS - University of Bologna(1999).

[24] NCSA. 7KH&RPPRQ*DWHZD\,QWHUIDFH, http://hoohoo.ncsa.uiuc.edu/cgi (1999).

[25] A. Newman. Special Edition Using Java. 4XH &RUSRUDWLRQ, ISBN 0-789-71529-5, http://www.mcp.com/publishers/que/catalog/que_bud.cfm (1998).

[26] R. Orfali and D. Harley. &OLHQW6HUYHU3URJUDPPLQJZLWK-DYDDQG&25%$6HFRQG(GLWLRQ.Wiley, ISBN 0-471-24578-X(1998).

[27] R. Orfali, D. Harkey, and J. Edwards. 7KH (VVHQWLDO 'LVWULEXWHG 2EMHFWV 6XUYLYDO *XLGH.Wiley, ISBN 0-471-12993-3(1996).

[28] PowerSoft Inc. 3RZHU%XLOGHURQOLQHERRNV, http://calas.powersoft.com/pb5.html (1999).

[29] R. Rao and S. K. Card. Exploring large table with the table lens. 3URFHHGLQJV RI &+,¶ $&0, Colorado, pp. 403-404(1995).

[30] Sun microsystems Inc. -DYD 5HPRWH 0HWKRG ,QYRFDWLRQ 'LVWULEXWHG &RPSXWLQJ )RU -DYD, white paper,http://java.sun.com/marketing/collateral/javarmi.html (1999).

[31] A. Turing. Computing machinery and intelligence.0LQG(236):33-60 (1950).

[32] L. Tweedie. Interactive visualization artifacts: how can abstraction inform design ?.3URFHHGLQJVRI&+,¶$&0, Colorado,pp. 73-74 (1995).

[33] J. Ullman. Principles of Knowledge Base and Database Systems. 9ROXPH,9ROXPH,,&RPSXWHU6FLHQFH3UHVV,ISBN 0-7167-8158-1, ISBN 0-7167-8162-X, Computer Science Press (1988, 1989).

[34] P. Wegner. Why interaction is more powerful than algorithms. &RPPXQLFDWLRQVRIWKH$&0 (5):80-91 (1997).