Active Semantic Web Services: A programming model for ... - limsi

4 downloads 11344 Views 91KB Size Report
email: [email protected] .... and compose with other DAML-S compliant web services ... duces a HTML document corresponding to the com-. ponent's ...
Active Semantic Web Services: A programming model for agents in the semantic web Nicolas Sabouret Laboratoire d’Informatique de Paris 6 (LIP6) 8, rue du Capitaine Scott, 75015 Paris, France email: [email protected]

Abstract

We call active semantic web services (ASWS) such agents. They have the following properties:

In this paper, we propose a programming model for agents in the semantic web, based on XML. It integrates in a single representation both the structural data description and the action description. We present an execution model that gives access at runtime to the agent’s actions description, so as to be able to answer formal requests about its actions, for instance. We show how this model can 1) integrate communication protocols standards for web services (WSDL, DAML-S, etc) and 2) take into account the proactive nature of agents in the semantic web, especially for humancomputer interaction.

1. The description of structural data and actions are integrated in a single representation. This allows the component to be queried about both the information it processes and the data manipulation operations. 2. The description of the agent abilities (corresponding to the service description in DAML-S) is integrated with the description of the actions it actually performs on the data. ASWS can thus reason about their own actions, at any time of the execution, in order to interact with other components (agents or services) and to provide explanations about their functioning.

Keywords: Semantic Web Services, Reasoning about Actions, Active Software Components, HumanComputer Interaction.

1 1.1

In order to achieve these two first goals, we need to program active components directly in XML. 3. Once activated by the initial connection, ASWS can perform actions without any user interaction: they are proactive. They are not limited to a reactive behaviour like classical web services or CGI-scripts. They behave more like agents integrating structured information.

Context of the study Active components and web services

Current trends in the semantic web propose to enhance web pages information with semantics, in order to make it processable by software components (services, agents, etc) [1]. These components are characterised by a functioning [5] and, unlike CGI scripts which simply process, manipulate or produce information in the web, the functioning of an active component is part of the information. Thus, human or agent users want to be able to query these components about their actions. The semantic web must therefore be able to represent and to manipulate not only structural knowledge, but also functional information. That is to say: agents must be integrated into the semantic web. Current efforts lead to “web services”. Many description models were proposed, like WSDL [2], WSMF [4] or DAML-S [3]. They offer protocols to define reactive web resources and their properties from the actions point of view. However in all these models, the service description is separated from the processed information. Moreover, it is separated from the processing actions (the core service) itself: it is only a model of (or an interface to) the service, which is seen as a “black box”. In this paper, we propose to make use of the web services standards as a support for agents in the semantic web.

1.2 Previous work Within the InterViews project1 , we proposed a programming language and an execution model for active components in XML [11, 10], based on tree rewriting [6, 8]. Components in this model have access at runtime to the description of the component’s actions and execution. They can therefor answer questions about their functioning [12, 9], using the language’s operational semantics. Moreover, the structural part of the component and the action description are integrated within a single representation. We call this model VDL (for View Design Language). The description of a component is a tree (an XML document) and its runtime consists of rewriting the document at each execution step, depending on the concepts it contains, like in rewriting logics [8]. This model is Turing-complete (it is possible to model any Turing machine in VDL) and linear in time and space w.r.t. the equivalent Turing machine. We completely defined the operational semantics of the language in [11] and we implemented it in Java2 . 1 http://www.limsi.fr/Individu/jps/interviews 2 Demos

1

are available on our web page: http://www-oasis.

1.3

Outlines of the paper

The values defined within actions are embedded into value elements.

In this paper, we show how this active components description model can be used for defining active semantic web services (ASWS). We first recall the VDL model. We then present the client-server architecture within our services are implemented. We show how it can integrate service description standards like DAML-S and WSDL in order to invoke and compose with other DAML-S compliant web services or agents. We illustrate this model with a DVD rent service.

The view and value elements can contain any element, even not defined within the vdlp schema. Thus our model can integrate actions descriptions within any structured document so as to turn in into an active component.

2

2.3.1 References

2.3 Actions

The VDLp model

2.1

Reference to other elements of the document (to modify them or simply to use their content within an action) is done by XPath expressions [14] embedded within path and get elements. The path element is used within basic actions to refer to an element that will be modified by the action. The get element is used to get the “value” of an element within arithmetic operations.

Observers

The execution model we propose for active components in XML is based on the notion of observers. An observer is an external software component that looks in the XML document for specific elements, according to a DTD or XML schema. It then interprets these elements so as to perform specific actions. The interpretation function of an observer defines the semantics of the elements. For our study, we must distinguish two kinds of ob- 2.3.2 Arithmetic operations servers: Arithmetic operations are defined using the following ele1. Static observers: they do not modify the document. ments: plus, times, minus and inverse for numbers; equals For instance, an XSLT [15] interpretation that pro- and "greater than" for relations; and, or, not, true and duces a HTML document corresponding to the com- false for booleans. In the vdlp observer’s schema, all these arithmetic operations are gathered within the operation ponent’s graphical user interface (GUI). group, together with the get and the value elements. Note 2. The dynamic observer that rewrites the XML docu- that value elements can contain either numerical values, ment at each execution step, according to the elements serialised as a string content, or specific elements whose that describe the component’s actions. The XML de- structure is defined in an external schema or DTD. scription of the component is serialised at each execuWe defined in [11, 10] a canonical interpretation on tion step so that the static observers can interpret it. terms. The interpretation of a value is the interpretation In this paper, we will only present the dynamic observer that of its content (e.g. 2 is interpreted as the integer 2). The interpretation of arithmetic elements is the corresponding runs ASWS, called vdlp as a reference to the InterViews project. In this execution model, based on tree rewriting, operation. The interpretation of a get is the content of the element referred to by the Xpath expression within the get. the actions are described explicitly (both in the XML abFor instance, 1 + x2 is represented in our model by the folstraction and in the document serialised at every execution step). This allows us to answer requests about the compo- lowing element: nent’s actions, using the language’s operational semantics which is defined by the vdlp observer’s interpretation function. Many examples are given in [12, 9].

2.2

1 //variable/x 2

The VDLp observer

2.2.1 General principle The vdlp observer’s syntax is defined by an XML schema available on our web page3 . We only give here the main elements:

2.3.3 Basic actions

There exists three basic actions to modify an XML document in our model: add to add sub-elements to an element, put to replace the content (all the sub-elements) of an el• The variables “values” (i.e. the data that will be manip- ement by a new one, del to remove an element and all its ulated) are, by definition, the elements contents. This sub-elements. Basic actions must contain at least one path conforms with the W3C recommendations. element. Moreover, add and put actions must contain at least one element in the operation group, so as to define lip6.fr/~sabouret/demos. 3 http://www-oasis.lip6.fr/~sabouret/xml/vdl.xsd the elements that will be added. • An active component is defined by an XML tree with root view.

2

action1 //variable[@name="test"] action2 //bar //variable[@name="foo"] //variable[@name="foo"] 1

Figure 1: Actions preconditions Action1 is performed when the “test” variable is evaluated to true. It increments the value of the “foo” variable. Moreover, if the user sent a “ok” external event, the sub-action action2 removes the “bar” element. 2.3.4 Preconditions

proposed by DAML-S for service composition (Sequence, Concurrent, Split, Split + Join, U nordered, Choice, If − T hen− Else, Repeat− U ntil and Repeat− W hile). The main difference with DAML-S is that the component’s internal actions are not within a “black box”: it is integrated together with the service description (and reciprocally, the service composition is defined in VDL). Thus, an ASWS based on an active component can answer answer requests on “how” and “why” it invokes a given service at a given time of execution. The second difference (which is actually a corollarcorollary of the first one) is that VDL-based services are active and not only reactive. They act like agents, capable of taking initiatives, for instance to tell the user about some important fact or to look for and invoke some other agent’s actions. Moreover, they should be able to interact with other agents and services using web services’ standards. This would turns them into situated autonomous agents, sensing then environment using UDDI requests and SOAP messages. In this paper, we focus on the first part: we show how pro-activity is done within our model.

Each basic action can be provided by two kinds of preconditions: • Boolean guards, defined within a guard element. This element that must contain operation-based elements evaluableevaluated to true or f alse. • External events, used to represent the interaction with a human or agent user. An external event is an XML element that can be sent to the component at runtime. The event element allows the programmer to define which events will be processed and how. Within an action, the eventGet element, whose syntax is the same as get, is used to access the sub-elements of the event being processed. Actions are elements that contain at least one basic action, precondition or sub-action. They are materialised by the action element. An action is only performed if all its preconditions are satisfied. The preconditions of an action are, by definition, the set of guard and event elements among its direct sub-elements. Moreover, when an action is a subaction, the parent action’s preconditions are also preconditions to the sub-action. An example is given on figure 1.

3 Active Semantic Web Services

In this section, we present the general architecture of VDLbaser web services, called ASWS. We also present the obActive components in VDL have access at runtime to a de- servers that are responsible for their execution. scription of their actions and structure. Thus, they can answer user’s questions about their actions. These questions 3.1 General architecture are dealt with by a reasoning about action observer. We In our model, the agent’s code in VDL integrates in a single developed such an observer in [9]. Our action model does not make use of classical pro- representation the data, the actions, the user’s interface and gramming languages operators, like if , while, and so on, the interaction capabilities. It is defined within an XML coming from the classical ‘instruction-value’ model used at document that conforms to the schema of three observers: the implementation level. On the contrary, like web services • The vdlp observer that runs the service by rewriting description and composition models (WSFL4 , WSMF [4], the component at each execution step, as presented DAML-S [3]...), it is at the conceptual level, in which the previously. operational semantics of actions is materialised by their preconditions. In particular, our component description model • The HTML observer which produces, at each execuallows the programmer to describe all the process constructs tion step, an HTML web page corresponding to the 4 http://www.ebpml.org/wsfl.htm service’s GUI.

2.4

Notes regarding related work

3

... ... ... ... ... ... ...

HTML Interface Observer

GET POST

chatbox HTML page

Browser

External event

Client

Requests processing

Questions about actions and changes

WSDL observer

VDL code serialised

DAML−S observer

VDL interpreter Other web services HTTP server Figure 2: ASWS general architecture. • The web service declaration observer which generates and manages the WSDL and DAML-S description files responsible for interaction with other services or agents.

From the point of view of a agent, the ASWS functionalities, registered within a UDDI directory, are reduced to this connection ability. As soon as the ASWS’s instance6 begins to run, the web service observer generates DAML-S and WSDL description, specific to the instance and accesWhen the agent manipulates too much or too critical data, sible by the agent-user using the ID number it was given. it can be defined within an XML database. The data is then Since the description of these functionalities is integrated manipulated by the component using SQL-based requests within the VDL code, they can be modified at runtime. Our described in XML. Figure 2 shows the general architecture (long term) aim is to allow an ASWS to be adaptative to the user’s operational capabilities. of ASWS.

3.2

3.3 Execution observer

Activation

The vdlp observer rewrites the active component (i.e. the ASWS instance) at each execution step. As a consequence, ASWS are proactive: they behave like agents running on the web server and interacting with the user and/or other agents.

Each user (human or agent) interacts with a different instance of the ASWS. When connecting to the web service, the user actually calls a CGI script that: 1. Give a unique ID number to the user. 2. Copies the initial VDL description in an XML file associated to this ID.

3.3.1 External events The user can interact with an ASWS using external events embedded into SOAP message of the form:

3. Launches the VDL interpreter on this newly created document/instance. The user interacts with this instance which is rewritten at each execution step depending on the ongoing interaction.

... SOAP headers ... ... The external event (XML tree) ...

4. For human users, the script returns a web page (the service’s home page) built by the HTML interface observer applied to the initial service description. 5 For agent (or services) users, the ID number is given as a parameter in the SOAP output message.

These messages can be produced either by other agents or by the HTML browser when the user interacts through the GUI web page.

5 This

mechanism is transparent for the user: the ID number is stored into a cookie and used by the connection CGI script so as to know which page must be returned to the user. As a consequence, the user believes he is on the service’s main page.

6 In the following, we will speak about agent when speaking about the running ASWS instance.

4

anchor to define hypertext links. It must contain a text element (the displayed text of the link) and it can conIn order to be able to send messages at runtime to other sertain an event element (what should be sent when the vice or agents, either in a reactive mode (like web services user clicks on the link). As for buttons, the interface do) or in a proactive way, the vdlp observer makes use of observer will produce a specific HTML anchor and a the sendEvent element that sends a SOAP message to the script that sends the event. service’s user. The content of the message is an external event. However, the user do not need to see it as an event: it can considers as a simple XML tree whose structure is de- Note. For usability reasons, the interface observer does fined in the output part of the DAML-S description for the not include the refresh META header when the GUI conASWS. This makes VDL agents capable of interacting with tains textboxes, since they are emptied every time the page reloads. The page reloads only when the clients POSTs the any other DAML-S compliant service or agent. page by clicking on a button or a link, thus sending an external event. The #i.html page is then replaced by a “wait3.4 HTML GUI observer ing” page, with refresh set to 1 second, that will be replaced by a new page as soon as the data have been processed As soon as the execution begins, the interface observer (which takes less than one execution step most times). looks into the document for elements describing the comThe VDL programmer must make sure that dynamic ponent’s GUI. It uses them to build an #i.html web page, pages (in which displayed data evolves pro-actively) do not where #i is the ID number given at connection time. This contain textboxes. page is re-built at each execution step. It is re-loaded periodically and automatically by the browser7 . Also note that the interface observer is “lazy”: it only re-builds #i.html 3.5 Using a database if there is any change in the GUI’s description part of the ASWS can make use of a database stored into XML web document/code of the agent. The elements used by the HTML interface observer are pages. This database is shared among all instances (and, possibly, by other services or programs). All data in the following: these pages are accessed from VDL using specific elements display to begin the GUI’s description. The ref resh at- which describe an SQL-based request. A complete example tribute can be used to define the browser’s refresh pe- is given in section 4.3. 3.3.2 Outputs

riod (which can therefore be modified at runtime). Database update. To modify the database, we make use of specific elements, addDB and delDB, which correspond to INSERT and REMOVE in SQL, whose syntax is the same as VDL’s add and del. Using specific actions prevents the programmer to make the database inconsistent by modifytextbox do define an input text box: the interface observer ing its structure: if the path sub-element does not refer to will produce an HTML command of the form . The textbox element must contain a not fit the table structure, no action is performed. Moreover, the vdlp interpreter does not modify the XML database diname attribute and should not have any content. rectly: it sends a message to a database server which avoids textpass to define an hidden input box (corresponding to concurrent calls to the database. in HTML). Within a display element, some HTML-based elements can be used (fonts, sections, paragraphs, lists, tables). On the contrary, links (a) and inputs (input) are ignored.

Database access. When accessing the database content for reading, we make use of the getDB element. It must contain at least one path element (the path to the database), one condition element (the WHERE statement) and one result element (the path to the result). The condition element is a VDL boolean expression. It can contain queryGet elements that behave like eventGet, except it looks for the selected elements instead of the external event. An example is given in section 4.3. The general structure of our requests in VDL was designed after the XQuery model8 . The reason why we did not use directly XQueries in VDL, apart from the fact that no database update is available in XQuery, is that this model does not allow our reasoning about actions algorithms [9] to analyse the requests and, thus, provide explanations. The key point to our approach is to materialise the semantics of all concepts and operations through one

In order to access at runtime to the content of textboxes, the programmer can use the getHTML element in the VDL code. The content of this element is an XPath reference to the VDL element that defines the textbox. A complete example is given in section 4.2. button to define a button. It can contain text sub-elements (the text to be displayed on the button) and event (the external event, i.e. the content of the SOAP message that will be sent when the user clicks on the button). The interface observer produces an HTML command of the form linked to a javascript command to send the SOAP message. An example is given in section 4.2. 7 This

is possible using the following header in #i.html:

8 http://www.w3.org/TR/xquery/

5

List of our movies

Welcome at DVDRent

title

category year R

Client # Password

Movie X description Title Category Author The story

Year

OK Rent Q:

Q:

Sort by category

A:

ChatBox

Only new movies

A:

HTML−based table

Q:

Hypertext links

First page

Cancel

A:

"POST" button

Main page

Movie page

Figure 3: A simple ASWS: DVD Rent service. The precondition parameter of a DAML-S process is built after the action’s guard preconditions and the effect parameter is built after the VDL basic actions (add, put and del) composing the process-action. The main difficulty at Note. Note that the getDB element is part of the this point is to link a well-defined VDL preconditions to operation group (see section 2.3.2). As a consequence, abstract concepts of the service’s ontology. We proposed in they can be used either within actions or within the interface [13, 10] an approach based on pattern-recognition to deal description in VDL, for instance to display a query result as with common-sense notions about actions in VDL. We use these tools with for linking the precondition to a concept of an HTML table9 . the service’s ontology. Our long-term aim is to be able to produce automatically the service ontology, using reasoning 3.6 Web service observer about actions [7] and action pattern recognition. XML element. This requires the whole request to be written only with elements and sub-elements, which is not the case in XQuery.

The web service observer is responsible for publishing the interaction capabilities of the agent for other services or agents to interact with it. In its current version, it makes use of web service description standards WSDL and DAML-S. It generates WSDL (grounding) and DAML-S (grounding, service profile and process) files in a similar way to what is done for the HTML interface. These 5 documents are requested by the user (other web service or agent) in order to know how to interact with the agent (the ASWS’s instance they actually interact with). They are named after the service instance. The user can access them using the ID number it was returned at connection time. Most of the DAML-S description is generated after the action description elements used by the vdlp observer (guard, event, sendEvent, etc). Each action having one or more event precondition corresponds to a DAML-S atomic process (defined within process.#i.daml). Atomic processes have only one input parameter, whose structure corresponds to the external event it processes. They should also have one or more outputs, corresponding to the sendEvent parameters. WSDL bindings and portTypes are generated using the events structure. The VDL programmer can also define sequence composite process when required using the specific damlsSeq element.

4 A complete example 4.1 General outlines In order to illustrate the elements we presented in the previous section, let us consider a DVD rent service. Its interface is separated into three pages (see figure 3): • The welcome and client authentificationauthentication page; • The main page, which show the list of DVD (possibly sorted by category, author...); • A specific page for each movie giving a description of the movie and containing a button to rent the DVD.

4.2 The HTML interface Figure 4 shows the VDL code used to describe the first page. It asserts that when the user clicks on the “OK” button, the browser sends an external event of the form: ... ...

9 The tableQuery element of the interf observer is used to transform it into an HTML table.

6

Welcome to DVDRent

Login:
Password:

OK //display/textbox[@name="login"] //display/textbox[@name="pwd"]



Figure 4: VDL description of the connection page. send132() { var xmlhttp = new Active XObject("Msxml2.XMLHTTP.4.0"); xmlHTTP.open("POST","http://www.DVDRent.com/VDLInterpreter"); final = ’HTTP/1.1 200 OK [... content-type, etc ...] ’ + document.login.value + ’’ + document.pwd.value + ’ ’; xmlHTTP.send(final); }

Figure 5: HTML code associated with the “OK” button and generated by the interface observer. The LogIn process has one input (the connection event presented previously) and no output. Its effect is to validate the connection (IsConnected) and it has no precondition. The RentMovie process process has one input (a rent event that must contain the name of the movie) and one acknowledgement output (defined by a sendEvent action). 4.3 Access to the database Its precondition is IsConnected. Suppose the DVD rent service’s database contains a users The VDL programmer should also have defined one comtable with a login and a pwd field, stored into the posite process (FullRentMovie) as a sequence of LogIn and users.xml file. The connection action in VDL, whose pur- RentMovie. Each one of these services (atomic and compose is to deal with connection events, is given on figure 6. posite) can be invoked directly by any DAML-S compliant It contains: service or agent.

where login and pwd contain the data entered into the corresponding textboxes. Figure 5 show the HTML code generated by the interface observer for the button element of this description.

• Two put actions. The first one registers the login into a variable of the ASWS. The second one “loads” the main page in the interface.

5 Conclusion and ongoing work

We presented a programming model for active semantic web services (ASWS) as active components in XML. ASWS can interacting in a proactive way with both human or agent users. Moreover, they have access at runtime to the • One guard precondition that checks the user’s pass- description of their own actions. This allows them to answer word, using an XQuery-based request that looks into formal requests about “What they are doing”, “Why” and the users table for an entry whose values are the “How”, using the methodology we proposed in [9]. Since connection event’s parameters. The action is per- the interaction capabilities of the agent is desfined in VDL, ASWS are capable not only to interact with a user or a serformed only if the result of the request is not empty. vice to perform a given task, but also to explain how and Using algorithms like we proposed in [12, 9], the ASWS is why it does so. then capable of answering questions about the connection Even though the web service observer we presented actions, like: “How can I connect?” or “What is the OK here only generates a sub-language of DAML-S, in which button used for?”... composite processes are restricted to simple sequences or concurrent compositions, it makes it useable by standardcompliant web service10 . Moreover, our model is extensible 4.4 Web service declaration • One event precondition so as to make sure the action is performed only when the ASWS receives a connection event.

10 Actually,

two services in interaction must accord on a common ontology. This issue is still under heavy study in the community and we do not claim that our model offers any solution. ASWS must also make use of a specific ontology for the data they manipulate.

In our DVD rent service, we have four atomic processes whose description is generated by the web service observer: LogIn, SeeMoviesList, SeeMovieDetails and RentMovie. 7

Connection reaction 0 http://.../users.xml/users/user_tuple //login //login //login //login //client_number //variables/login //login //interface//Main_screen

Figure 6: Connection actions and query in VDL. to more complex processes composition, using other spe[9] N. Sabouret. A model of requests about actions for active components in the semantic web. In Proc. STAIRS cific elements, or even to other service models (e.g. WSMF) 2002, pages 11–20, 2002. or agent communication languages (e.g. FIPA-ACL), using a different web service observer. We based the interaction protocols on DAML-S because it is becoming the standard [10] N. Sabouret. Representing, requesting and reasoning about actions for active components in humanfor semantic web services and we think it can be a sensible computer interaction. Technical Report 2002-09, support for communication between semantic web’s agents. LIMSI-CNRS, 2002. The ASWS platform is currently under programming, using previous work done in Java [11] that is easily extensible [11] N. Sabouret. Étude de modèles de représentation, de to new observers (HTML interface, DAML-S, database acrequêtes et de raisonnement sur le fonctionnement des cess...). composants actifs pour l’interaction homme-machine. PhD thesis, Université Paris-Sud, 2002.

References

[12] N. Sabouret and J.P. Sansonnet. Automated Answers to Questions about a Running Process. In Proc. CommonSense 2001, pages 217–227, 2001.

[1] T. Berners-Lee. Weaving the Web. Harper San Francisco, 1999.

[13] N. Sabouret and J.P. Sansonnet. Traitement de requêtes de bon sens sur les actions pour l’interaction homme-machine. In Proc. Modèles Formels de l’Interaction (MFI) 2003, pages 209–218, 2003.

[2] E. Christensen, F. Curbera, G. Meredith, and S. Weerawarana. Web services description language (wsdl). http://www.w3.org/TR/wsdl, 2001.

XML Path Language [3] DAML-S Coalition. DAML-S: Web Service Descrip- [14] W3C. http://www.w3.org/TR/xpath, 1999. tion for the Semantic Web, 2002.

(XPath).

XSL Transformations [4] D. Fensel and C. Bussler. The Web Services Modeling [15] W3C. http://www.w3.org/TR/xslt, 1999. Framework WSMF. In 1st meeting of the “Semantic Web enabled Web Services workgroup”, 2002.

(XSLT).

[5] Z. Guessoum and J.P. Briot. From Active Objects to Autonomous Agents. IEEE Concurrency, 7(3):68–76, 1999. [6] Y. Gurevich. Evolving Algebra Lipari Guide. In E. Börger, editor, Specification and Validation Methods, pages 9–36. Oxford University Press, 1995. [7] J. McCarthy and P.J. Hayes. Some philosophical problems from the standpoint of Artificial Intelligence. Machine Intelligence, 4:463–502, 1969. [8] J. Meseguer. Rewriting Logic and Maude: Concepts and Applications. In Proc. RTA 2000, pages 1–26, 2000. 8