Web Semantics: Science, Services and Agents on the World Wide Web 8 (2010) 310–328 Contents lists available at ScienceDirect Web Semantics: Science, Services and Agents on the World Wide Web journal homepage: www.elsevier.com/locate/websem Discovering Semantic Web services using SPARQL and intelligent agents Marco Luca Sbodio a , David Martin b, , Claude Moulin c a Hewlett-Packard Italy Innovation Center, Corso Trapani 16, 10139 Torino, Italy b Artificial Intelligence Center, SRI International, 333 Ravenswood Avenue, Menlo Park, CA 94025-3493, USA c Université de Technologie de Compiègne, 60205 Compiègne, France article info Article history: Received 1 July 2009 Received in revised form 30 March 2010 Accepted 21 May 2010 Available online 4 June 2010 Keywords: Semantic Web services Service discovery SPARQL Intelligent agents abstract This paper describes a novel approach to the description and discovery of Semantic Web services. We propose SPARQL as a formal language to describe the preconditions and postconditions of services, as well as the goals of agents. In addition, we show that SPARQL query evaluation can be used to check the truth of preconditions in a given context, construct the postconditions that will result from the execution of a service in a context, and determine whether a service execution with those results will satisfy the goal of an agent. We also show how certain optimizations of these tasks can be implemented in our framework. © 2010 Elsevier B.V. All rights reserved. 1. Introduction Service discovery – the identification of services that are capa- ble of accomplishing a given objective – is a central problem in Semantic Web services (SWS) research. Most SWS work on discov- ery, either explicitly or implicitly, aims to support the autonomous identification of suitable services by software agents, to support the satisfaction of their goals. Effective service discovery depends directly on service descriptions that are adequately expressive. SWS service descriptions, in turn, usually include the specification of preconditions and postconditions. Preconditions are conditions that must hold true before invoking a service, to ensure successful use of the service, and postconditions are conditions that will hold true after the successful use of a service. The specification of pre- conditions and postconditions, and the drawing of inferences based upon them, is a distinguishing feature of most work on Semantic Web services. In this paper, we show how the SPARQL [51] query language can be used to express the preconditions and postconditions of services, as well as the goals of agents. In addition, we show that SPARQL query evaluation can be used to check the truth of a precondition in a given context, construct the postcondition that will result from the execution of a service in a context, and determine whether a service execution with those results will satisfy the goal of an agent. In a nutshell, the truth of a service precondition indicates that the Corresponding author. Tel.: +1 650 859 4119; fax: +1 650 859 3735. E-mail addresses: marco.sbodio@hp.com (M.L. Sbodio), david.martin@sri.com, martin@ai.sri.com (D. Martin), claude.moulin@utc.fr (C. Moulin). service can successfully be used, the resulting postcondition reveals what will be true after using the service, and the satisfiability of the agent’s goal indicates that the service is a candidate for use in accomplishing that goal – thus providing a solution to the discovery problem. We also show how certain optimizations of these tasks can be implemented in our framework. SPARQL has been standardized at the World Wide Web Con- sortium, and is by far the most widely used query language for knowledge bases employing the Resource Description Framework (RDF) [38] and/or the Web Ontology Language (OWL) [46]. Addi- tional background on SPARQL is given in Section 3. To situate our approach in a larger context of practice, we dis- cuss how it may be used with OWL for Services (OWL-S) [44], but the approach is applicable to any SWS framework based on knowledge representation using RDF or OWL. OWL-S is deliber- ately under-constrained with respect to the specification and use of preconditions and postconditions. That is, it allows for a service description to “escape” into a language other than OWL for the spec- ification of preconditions and postconditions. This path was chosen because OWL is not well-suited for expressing pre- and postcondi- tions, both in terms of its expressiveness and its lack of naturalness for this purpose. For example, OWL’s lack of variables makes it dif- ficult to express conditions with a suitable degree of generality, flexibility and naturalness. Thus, in the definition of OWL-S [43], several languages are declared as candidates for use in express- ing pre- and postconditions, including, in addition to SPARQL, KIF [21], SWRL [29], and several other possibilities. (This collection of possibilities is meant by the authors of OWL-S to be illustrative, rather than exclusive.) In the examples accompanying the OWL-S documentation, and in subsequent work, SWRL has been used most 1570-8268/$ – see front matter © 2010 Elsevier B.V. All rights reserved. doi:10.1016/j.websem.2010.05.002