Automatic Web Service Composition Using ConGolog - CiteSeerX

4 downloads 0 Views 211KB Size Report
middle-ground ConGolog interpreter which relies on a theorem-prover with prime implicates. 1. Introduction. Semantic Web Service is the confluence of Web.
Automatic Web Service Composition Using ConGolog Minh Phan Graduate School of Science and Engineering Ritsumeikan University, Japan [email protected]

Abstract Semantic Web Service, nowadays, is emerging as a solution for interoperating distributed applications on the WWW. Web service composition is the task of combining existing web services to yield a new service in order to achieve a desired goal. In this paper, we propose a formal approach to translate OWL-S web service descriptions into primitive and complex actions of ConGolog, a high level logic programming language with sensing actions for web service composition. In addition, in order to support information gathering with search in an open world initial database, we propose an extended version of the middle-ground ConGolog interpreter which relies on a theorem-prover with prime implicates.

1. Introduction Semantic Web Service is the confluence of Web services and the Semantic Web, the two emerging trends on the World Wide Web [7]. The use of semantic markup language such as OWL-S to mark up properties, and capabilities of web services enables the automation of many tasks, including automatic web service discovery, automatic web service invocation and automatic web service composition [1]. This research is interested in the task of web service composition that combines existing web services to yield a new service which can achieve desired goals that none of the existing ones could. OWL-S language [1] views web services as actions (simple or complex) with (knowledge) preconditions and (knowledge) effects. The use of semantic enables the inference about preconditions and effects. Therefore web service composition can be conceived as planning and execution task [2, 3, 7]. Being a planning task, web service composition is distinguished by the following key features: (1) web service composition is a planning task with very

Fumio Hattori Graduate School of Science and Engineering - Ritsumeikan University, Japan [email protected] incomplete information at initial states; (2) inputs and outputs of web services are knowledge preconditions and knowledge effects; (3) composite services (or complex actions) contain programming constructs (e.g., if … then … else, while loop) which are procedural knowledge. Those features lead to a question of choosing an appropriate language and planning technique which have the abilities of representing an incomplete information planning problem, representing and reasoning about sensingactions (or information-gathering actions) and making use of web services’ procedural knowledge. Our approach is making use of ConGolog [4], a high level logic programming language which supports concurrent and sensing actions for the task of web service composition. We realize the approach by (1) proposing algorithms to translate OWL-S processes into ConGolog primitive actions and complex actions, and (2) extending the work of McIlraith, S., and Son [7] to build an extended middle-ground ConGolog interpreter which relies on the theorem-prover with prime implicates of [8] to support information gathering with search in an open world initial database.

2. Background 2.1. OWL-S In OWL-S, services are modeled as processes. A process can have (1) any number of preconditions, which must all hold in order for the process to be invoked; (2) any number of effects, which will hold after the execution of the process; (3) any number of inputs (i.e., knowledge preconditions), the information required for the execution of the process; and (4) any number of outputs (i.e., knowledge effects), the information that the process provides conditionally after its execution. Outputs and effects can have

Proceedings of the 26th IEEE International Conference on Distributed Computing Systems Workshops (ICDCSW’06) 0-7695-2541-5 /06 $20.00 © 2006

IEEE

conditions associated with them (i.e., conditional outputs and conditional effects). There are three kinds of processes in OWL-S: atomic processes, composite processes and simple processes. Atomic processes are directly invocable and have no sub-processes. Atomic processes execute in single step with the initiated input parameters. A simple process is used as an element of an abstraction to provide a view of either some atomic process, or a simplified representation of some composite process1. Composite processes are decomposable into other subprocesses which can be composite or non-composite ones. The decomposition of composite processes is specified by using control constructs, including Sequence, Split, Split+Join, Unordered, Choice, IfThen-Else, Iterate, Repeat-While, and Repeat-Until. Dealing with the task of web service composition, among all AI techniques, ConGolog seems very promising because the concept of complex actions, sensing-actions, and concurrent actions in ConGolog is very similar to the concept of composite process decomposition, output producing processes, and concurrent processes in OWL-S ontology respectively. In this paper, we adapt ConGolog logic programming language to show how ConGolog can be used with OWL-S service descriptions to automatically compose web services on the web.

2.2. ConGolog

situation s ' that results from executing a primitive action or test action and a new program δ ' that represents what remains of the program δ after having performed such an action. Final (δ , s) means that the configuration (δ , s ) is final one, that is, where the computation can be considered completed. For assembling primitive actions into complex actions that collectively comprise a program δ , ConGolog provides the following set of extralogical constructs: a a primitive action φ? test action sequence action δ1 ; δ 2

δ1 | δ 2 (π x )δ ( x)

choice of actions

δ if φ then δ1 else δ 2 endIf

iteration synchronized conditional synchronized loop

choice of arguments

*

while φ do δ endWhile δ1 || δ 2

In ConGolog, given a domain theory D, and a program δ , the execution task is to find a sequence of G G actions a such that: D |= Do(δ , S0 , do(a , S0 )). Do(δ , s, s ') is redefined in ConGolog as follows: def

Do(δ , s, s ') = ∃δ '.Trans * (δ , s, δ ', s ') ∧ Final (δ ', s ')

ConGolog [4] is an extended version of Golog [6, 8] that incorporates a rich account of concurrency. Both Golog and ConGolog are built on top of the situation calculus. In the situation calculus, the state of the world is described by functions and relations (fluents) G relativized to a situations s, e.g., F ( x , s ) [8]. On the one hand, a program δ in Golog is assigned an evaluation semantics in terms of a relation, denoted by the formulas Do(δ , s, s ') that means the Golog program δ , starting execution in the situation s will G legally terminate in situation s ' = do(a, s ), where G do(a , s ) abbreviates do(an , do(an −1 ,..., do(a1 , s))). On the other hand, in order to take into account concurrency, ConGolog adopt transition semantics or computation semantics which are based on defining single steps of computation in contrast to directly defining complete computations. Two new predicates Trans(δ , s, δ ', s ') and Final (δ , s) are defined in ConGolog. Trans(δ , s, δ ', s ') denotes that associating to a given program δ and a situation s, a new 1

Simple processes are not useful using ConGolog therefore we do not make use of them in our work.

where Trans *(δ , s, δ ', s ') implies the possible configurations (δ ', s ') that can be reached by a program δ , in a situation s are those obtained by repeatedly following the transition relation denoted by Trans starting from (δ , s ) (see [8] for details about the definition of a domain theory D and [4] for details about ConGolog).

3. Encoding OWL-S ConGolog domains

IEEE

processes

as

In this section, we propose a formal approach to translate a set OWL-S processes into a ConGolog domain D.

3.1. Assumptions In our work, we make the following assumptions: Assumption 1: Given a set of OWL-S processes K = {K1 , K 2 ,..., K n }, we assume: ٟ All atomic processes in K can either have outputs or effects, but not both. A process that produces outputs is called information gathering

Proceedings of the 26th IEEE International Conference on Distributed Computing Systems Workshops (ICDCSW’06) 0-7695-2541-5 /06 $20.00 © 2006

concurrent execution

service (also called sensing action in ConGolog). A process that has effects is called world altering service. In our work, we make use of the middle-ground ConGolog interpreter that execute online sensing actions but simulates effects of world altering actions (to be discussed later). The middle-ground ConGolog interpreter therefore can not deal with actions that have both outputs and effects. ٟ There is no Split+Join composite processes in K . ConGolog can not handle concurrency with barrier synchronization. ٟ The effects and outputs of all processes in K are not conditional. ConGolog can not handle conditional outputs and effects.

3.2. From OWL-S to ConGolog in Situation Calculus Translating functional fluents into relational fluents Our work is implemented in the logic programming language Prolog. We follow the method for implementing action theories in Prolog provided in [8] which does not support functional fluents. Therefore all functional fluents have to be translated into relational fluents as follows: G For each functional fluent f ( x , s ) = y , translate it G into the corresponding relational fluent F ( x , y, s ). From now on, we assume that all fluents in OWL-S are relational fluents. Translating OWL-S atomic process with effects Input: An OWL-S definition Q of an atomic process A with only effects Output: A ConGolog primitive action A with 1. A precondition axiom of the form: G G Poss( A( x ), s) ≡ ∏ A ( x , s ) G where ∏ A ( x , s) is a conjunction of all preconditions of A as defined in Q following the description provided in [8]. 2. A set of successor state axioms, one for each G effect fluent F ( x , s ) of A defined in Q of the form: G G G G F ( x , do(a, s)) ≡ γ F+ ( x , a), s ) ∨ F ( x , s ) ∧ ¬γ F− ( x , a, s ) G G where γ F+ ( x , a, s) and γ F− ( x , a, s) are the positive normal form effect axiom and the negative normal G form effect axiom for the fluent F ( x , s ) respectively following the description provided in [8]. Translating OWL-S atomic process with outputs Input: An OWL-S definition Q of an atomic process A with only outputs Output: A ConGolog primitive action A with 1. A precondition axiom of the form:

G G Poss( A( x ), s) ≡ ∏ A ( x , s ) G where ∏ A ( x , s) is a conjunction of all preconditions of A as defined in Q following the description provided in [8]. 2. A set of successor state axioms, one for each G output F ( x , s ) of A as defined in Q of the form: G G G F ( x , do(a, s)) ≡ γ F+ ( x , a, s) ∧ execute( A( y )) ∨ G G F ( x , s ) ∧ ¬γ F− ( x , a, s ) G where execute( A( y )) is an external functional call used to implement the middle-ground ConGolog interpreter. We will discuss it in the next section. Translating sequence processes Input: An OWL-S definition Q of a composite process C with a sequence construct. Output: A ConGolog procedure C G Proc C ( x ) δ1 :δ1 : ... :δ n endProc where δ i can be either atomic or composite component processes as defined in Q. Translating choice processes Input: An OWL-S definition Q of a composite process C with a choice construct. Output: A ConGolog procedure C G Proc C ( x ) δ1 | δ1 | ... | δ n endProc where δ i can be either atomic or composite component processes as defined in Q. Translating if-then-else processes Input: An OWL-S definition Q of a composite process C with an if-then-else construct. Output: A ConGolog procedure C G Proc C ( x ) If φ ( s) then δ1 else δ 2 endIf endProc where φ ( s) is conditions for if and δ i can be either atomic or composite component processes as defined in Q. Translating iterate processes Input: An OWL-S definition Q of a composite process C with iterate construct. Output: A ConGolog procedure C G Proc C ( x ) δ * endProc where δ can be either atomic or composite component processes as defined in Q. Translating repeat-while processes Input: An OWL-S definition Q of a composite process C with a repeat-while construct. Output: A ConGolog procedure C G Proc C ( x ) while φ ( s) do δ endWhile endProc

Proceedings of the 26th IEEE International Conference on Distributed Computing Systems Workshops (ICDCSW’06) 0-7695-2541-5 /06 $20.00 © 2006

IEEE

where φ ( s) is conditions for Repeat-While and δ can be either atomic or composite component processes as defined in Q. Translating repeat-until processes Input: An OWL-S definition Q of a composite process C with a repeat-until construct. Output: A ConGolog procedure C G Proc C ( x ) repeat δ until φ ( s) endUntil endProc where φ ( s) is conditions for repeat-until and δ can be either atomic or composite component processes as defined in Q. ConGolog has not defined repeat-until construct. We define the repeat-until construct in term of the repeat-while construct. We extend the computation semantics of ConGolog to include repeat-until construct. Trans (repeat δ until φ , s, δ ', s ') ≡ ∃γ .(δ ' = γ : while ¬φ do δ ) ∧ Trans (δ , s, γ , s '). Final (repeat δ until φ , s ) ≡ φ[ s] ∧ Final (δ , s). That is the configuration (repeat δ until φ , s) can

evolve to the configuration (γ : while ¬φ do δ , s ') if the configuration ( δ , s) can evolve to the configuration ( γ , s '). The configuration (repeat δ until φ , s) can be considered completed if φ [ s] holds and the configuration (δ , s ) is final. In the expressions, φ is a situation-suppressed expression and φ [ s] denotes the situation calculus formula obtained from φ by restoring situation variable s into all fluent names mentioned in φ . Translating unordered processes Input: An OWL-S definition Q of a composite process C with an unordered construct. Output: A ConGolog procedure C G Proc C ( x ) δ1 || δ 2 || ...|| δ n endProc where δ i can be either atomic or composite component processes as defined in Q. Readers must be confused as we use the concurrency construct of ConGolog to program OWLS unordered processes. ConGolog provides the following computational semantics to include concurrent actions Trans(δ1 || δ 2 , s, δ ', s ') ≡ ∃γ .δ ' = (γ || δ 2 ) ∧ Trans (δ1 , s, γ , s ') ∨ ∃γ .δ ' = (δ1 || γ ) ∧ Trans(δ 2 , s, γ , s '). Final (δ1 || δ 2 , s) ≡ Final (δ1 , s ) ∧ Final (δ 2 , s ). That is the atomic processes of the concurrent process δ1 || δ 2 are executed in some unspecified order

but the constraints associated with subcomponents (i.e., δ1 and δ 2 ) is still respected. Compare these computational semantics with the definition of unordered processes in the Technical Overview document of OWL-S [1], it is straightforward to realize that they are the same. We applied the concurrency construct of ConGolog with the example of unordered construct given in the Technical Overview document of OWL-S [1] and it has the following result. Example: Let a , b , c , and d be atomic processes, and X , Y , and Z , be composite processes: X = a : b - A sequence composite process Y = c : d - A sequence composite process Z = unordered ([ X , Y ]) - An unordered composite process The possible terminating situations for the program Z at the initial situation S0 applying the ConGolog concurrency semantics include {(a; b; c; d ), (a; c; b; d ), (a; c; d ; b), (c; d ; a; b), (c; a; d ; b), (c; a; b; d )} This set of possible situations is exactly the same as the one given in the Technical Overview document of OWL-S. Translating concurrency processes Input: An OWL-S definition Q of a composite process C with a concurrency construct. Output: A ConGolog procedure C G Proc C ( x ) δ1 || δ 2 || ...|| δ n endProc where δ i can be either atomic or composite component processes as defined in Q. In addition, for each atomic action A in δ i , represent it with a relational fluent to indicate the process of the action and two instantaneous actions that initiate and terminate the action. The initiating action causes the fluent become true and the terminating action causes it become false. This approach is the socalled interleaving approach of ConGolog to enable concurrency actions. 1. A precondition axiom of startA G G Poss( startA( x ), s ) ≡ ∏ A ( x , s) G where ∏ A ( x , s) is a conjunction of all preconditions of A as defined in Q. G 2. A successor axiom of the relational fluent A( x , s ) G indicating the process of action A( x ) G G A( x , do(a, s )) ≡ a = startA ∨ A( x , s ) ∧ a ≠ endA 3. A precondition axiom of endA G Poss(endA, s) ≡ A( x , s )

Proceedings of the 26th IEEE International Conference on Distributed Computing Systems Workshops (ICDCSW’06) 0-7695-2541-5 /06 $20.00 © 2006

IEEE

4. A set of successor state axioms, one for each G effect or output F ( x , s ) of A as defined in Q of the form if the action has only effects G G F ( x , do(endA, s)) ≡ γ F+ ( x , endA, s) ∨ G G F ( x , s ) ∧ ¬γ F− ( x , endA, s ) or of the form if the action has only outputs G G G F ( x , do(endA, s)) ≡ γ F+ ( x , endA, s) ∧ execute( A( y )) G G ∨ F ( x , s) ∧ ¬γ F− ( x , endA, s) With the device of instantaneous initiating and terminating actions in hand, arbitrarily complex concurrency can be represented. For example, the sequence of actions {starA; startB; endA; endB} indicates the time segments of the two actions overlap while the sequence of actions {starA; startB; endB; endA} indicates the time segment occupied by the action B is entirely contained in that occupied by the action A. Note that the axioms of the step 4 can be obtained from the successor state axioms of action A (see the algorithms of translating atomic actions with only either effects or outputs) by replacing every occurrence of a with endA.

4. Middle-ground ConGolog Interpreter In building a ConGolog interpreter, there are several approaches as outlined in [7]. [7] implements a middleground in Prolog between online [8] and offline [5] execution. The middle-ground interpreter executes online sensing actions while only simulating effects of world-altering actions. [7] argues that the middleground is appropriate for a large class of web service composition because human often follow this approach, collecting information on the Web (e.g., flight schedules) while only simulating the worldaltering actions (e.g., buying tickets) in their head until they have a completed plan to execute. To accommodate sensing actions while maintaining the ability to backtrack, [7] assumes that the truth value G of a certain output F ( x , s ) can be determined by executing an external function call, A. The call is G G denoted by execute( A( y ), s). F ( x , s ) is true iff the execution succeeds. The use of external function call allows us to have the successor state axiom of an G output fluent F ( x , s ) of the form G G G F ( x , do(a, s)) ≡ γ F+ ( x , a, s) ∧ execute( A( y )) ∨ G G F ( x , s ) ∧ ¬γ F− ( x , a, s ) In addition, they provide a set of rules that call the action A externally.

G execute( A( y )) : − < external function call > G G Note that x must be a sub set of y. If the sensing G G action A produces only one output, the x and y are the same. If the sensing action A produces more than G G F ( x1 , s), …, F ( xk , s ) then one output, G G G 2 x1 ∪ ... ∪ xk ≡ y. This technique is also suitable for sensed functional fluents (recall that functional fluents are translated into relational fluents with new parameters) because Prolog answers queries with free variables by returning possible values for these variables. However, because of relying on Prolog to do theorem proving, their middle-ground interpreter can not be used to reason about the lack of knowledge of an agent. For example, in the block world, we have a world altering action moveToTable( x), and two sensing actions senseClear ( x) and senseOnTalbe( x ) with the following axioms. Precondition axioms Poss(moveToTable( x ), s ) ≡ clear ( x, s) ∧ ¬onTable( x, s ). Poss( senseClear ( x ), s) ≡ true. Poss( senseOnTable( x ), s) ≡ true. Successor state axioms onTable( x, do(a, s )) ≡ a = senseOnTable( x ) ∧ execute(sense _ on _ table( x )) ∨ onTable( x, s) ∧ a ≠ senseOnTalbe( x ). clear ( x, do(a, s )) ≡ a = senseClear ( x ) ∧ execute( sense _ clear ( x )) ∨ clear ( x, s ) ∧ a ≠ senseClear ( x ). Now, consider the execution of the ConGolog program which moves the block A onto the table, assuming that at the initial state, the block A is clear and on the table but the Prolog agent does not know anything about that. Do( senseClear ( A): moveToTable( A), S0 , s) Instead of resulting in an empty set of possible situations, the agent responses to that query with the plan. s = do(moveToTable( A), do( senseClear ( A), S0 )) That happens because when trying to prove Poss(moveToTable( A), do(senseClear ( A), S0 )), the agent evaluates clear ( A, do( senseClear ( A), S0 )) and ¬onTable( A, do(senseClear ( A), S0 )) 2

In [7], they assume that a sensing action produces only one output.

Proceedings of the 26th IEEE International Conference on Distributed Computing Systems Workshops (ICDCSW’06) 0-7695-2541-5 /06 $20.00 © 2006

IEEE

clear ( A, do( senseClear ( A), S0 )) is proved by invoking the sensing action sense _ clear ( x ) as described in the successor state axiom of clear ( x, s ). Because of relying on negation as failure to evaluate a negative literal, in order to evaluate ¬onTable( A, do(senseClear ( A), S0 )), the agent tries to evaluate onTable( A, do(senseClear ( A), S0 )). If the evaluation returns failure then the agent will infer that ¬onTable( A, do(senseClear ( A), S0 )) is true. To evaluate onTable( A, do(senseClear ( A), S0 )), the agent performs a “one-step” regression and tries to prove onTable( A, S0 ). The agent fails because it does not know if the block A is on the table. Therefore it believes that the block A is not on the table regardless of the fact that the block A is on the table. Believing the action moveToTable( A) to be physically executable after the execution of action senseClear ( A), the agent returns the above plan. We overcome this issue by proposing an extended version of middle-ground interpreter which relies on the theorem prover with prime implicates of [8]. We began implementing the extended middle-ground interpreter with the ConGolog offline interpreter of [4]. We replaced all sub and holds clauses with sub and holds clauses of the standard Golog in [8]. Then we replaced the last holds clause with the following code. holds(W , S ) : - restoreSitArgThroughout (W , S , F ), prove( F ). We modified trans and final clauses so that they can be used with the above holds and sub clauses. We also provided code of restoreSitArgThroughout clauses which have not been realized by [8]. We included repeat-until construct with the following code. trans (repeat (C , E ), S , E1 : while(-C , E ), Sr ) : trans ( E , S , E1, Sr ). final ( repeat (C , E ), S ) : - holds (C , S ), final ( E , S ). In addition, we provided a rule that calls sensing actions externally. execute(G ) : - G. Finally, in order to regress an atom whose definition includes an external function call, we replaced the following code databaseEntails ([C | R ]) : − (tautology (C ),!, subsumed (C )), databaseEntails ( R ). of the Prolog implementation of the theorem prover ([8] pp. 267) with

databaseEntails ([C | R ]) : − (tautology (C ),!, subsumed (C ); (C = [execute(G )], execute(G )); (C = [−execute(G )], \ + execute(G ))), databaseEntails( R ). We used the extended interpreter to execute the query Do( senseClear ( A): moveToTable( A), S0 , s) and the result was an empty set of possible situations. With our interpreter, agents can reason about their lack of knowledge that can not be done with the middle ground of [7]. We modified the travel example of [7] and applied our interpreter to solve that modified problem. Those who are interested in our source code can contact us via our email.

5. Conclusion In this paper, we have proposed a formal approach to do automatic web service composition by exploiting ConGolog logic programming language. In addition, we have proposed an extended version of middleground ConGolog to support information gathering with search in an open world initial database. We believe that our ConGolog middle-ground interpreter provides a natural formalism for the task of web service composition.

6. References [1] DAML-S/OWL-S. http://www.daml.org/services/. 2004. [2] Drew McDermott. Estimated-Regression Planning for Interactions with Web Services. 2004 [3] Evren Sirin, Bijan Parsia, Dan Wu, James Hendler, and Dana Nau. HTN  planning for web service composition using SHOP2. /Journal of Web Semantics/, 1(4):377-396, 2004. [4] G. De Giacomo, Y. Lesp´erance, and H. Levesque. ConGolog, a concurrent programming language based on the situation calculus. AIJ, 121(1-2):109–169, 2000. [5] G. Lakemeyer. On sensing and off-line interpreting in Golog. In Logical Foundations for Cognitive Agents, Contrin Honor of Ray Reiter, pages 173–187, 1999. [6] H. Levesque and others. GOLOG: A logic programming language for dynamic domains. Journal of Logic Programming, 31(1-3):59–84, April-June 1997. [7] McIlraith, S., and Son, T. C. Adapting Golog for Composition of Semantic Web Services. In Proc. KRR, 482493. 2002. [8] R. Reiter. KNOWLEDGE IN ACTION: Logical Foundations for Specifying and Implementing Dynamical Systems. The MIT Press, 2001.

Proceedings of the 26th IEEE International Conference on Distributed Computing Systems Workshops (ICDCSW’06) 0-7695-2541-5 /06 $20.00 © 2006

IEEE