<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Exploiting Agent-Oriented Programming for Building Advanced Web 2.0 Applications</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Mattia Minotti</string-name>
          <email>mattia.minotti@studio.unibo.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrea Santi</string-name>
          <email>a.santi@unibo.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alessandro Ricci</string-name>
          <email>a.ricci@unibo.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>DEIS, University of Bologna</institution>
          ,
          <addr-line>Cesena</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Bologna</institution>
          ,
          <addr-line>Cesena</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <fpage>55</fpage>
      <lpage>61</lpage>
      <abstract>
        <p>-We believe that agent-oriented programming languages and multi-agent programming technologies provide an effective level of abstraction for tackling the design and programming of mainstream software applications, besides being techniques effective for dealing with (Distributed) Artificial Intelligence problems. In this paper we support this claim in practice by discussing the use of a platform integrating two main agent programming technologies - Jason agent programming language and CArtAgO environment programming framework - to the development of Web 2.0 applications. Following the cloud computing perspective, these kinds of applications will more and more replace desktop applications, exploiting the Web infrastructure as a common distributed operating system, raising however challenges that are not effectively tackled - we argue - by mainstream programming paradigms, such as the objectoriented one.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>
        The value of Agent-Oriented Programming (AOP) [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] –
including Multi-Agent Programming (MAP) – is often remarked
and evaluated in the context of Artificial Intelligence (AI)
and Distributed AI problems. This is evident, for instance, by
considering existing agent programming languages (see [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ],
[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] for comprehensive surveys) – whose features are typically
demonstrated by considering AI toy problems such as block
worlds and alike. Besides this view, we argue that the level
of abstraction introduced by AOP is effective for organizing
and programming software applications in general, starting
from those programs that involve aspects related to reactivity,
asynchronous interactions, concurrency, up to those involving
different degrees of autonomy and intelligence. In that context,
an important example is given by Web 2.0 applications,
which share more and more features with desktop applications,
combining their better user experience with all the benefits
provided by the Web, such as distribution, openness and
accessibility. Applications of this kind are at the core of the
cloud computing vision.
      </p>
      <p>
        In this paper we show this idea in practice by describing
a platform for developing Web 2.0 applications using agent
programming technologies, in particular Jason for
programming agents and CArtAgO for programming the environments
where agents work. We refer to the integrated use of Jason
and CArtAgO as JaCa and its application for building Web
2.0 application as JaCa-Web. Besides describing the
platform, our aim here is to discuss the key points that make
JaCa and – more generally – agent-oriented programming a
suitable paradigm for tackling main complexities of software
applications, advanced Web applications in this case, that
– we argue – are not properly addressed by mainstream
programming languages, such as object-oriented ones. In that,
this work extends a previous one [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] where we adopted a
Java-based framework called simpA [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] to this end, replaced
in this paper Jason so as to exploit the features provided by
the Belief-Desire-Intention (BDI) architecture.
      </p>
      <p>The remainder of the paper is organised as follows. First, we
provide a brief overview of JaCa (Section II) programming
model and platform. Then, we discuss the use of JaCa for
developing Web 2.0 applications (Section III), remarking the
advantages compared to existing state-of-the art approaches.
To evaluate the approach, we describe the design and
implementation of a case study (Section IV), and we conclude the
paper by discussing related and future work (Section V).</p>
    </sec>
    <sec id="sec-2">
      <title>II. AGENT-ORIENTED PROGRAMMING FOR MAINSTREAM</title>
      <p>APPLICATION DEVELOPMENT – THE JaCa APPROACH</p>
      <p>
        An application in JaCa is designed and programmed as
a set of agents which work and cooperate inside a
common environment. Programming the application means then
programming the agents on the one side, encapsulating the
logic of control of the tasks that must be executed, and
the environment on the other side, as first-class abstraction
providing the actions and functionalities exploited by the
agents to do their tasks. More specifically, in JaCa Jason [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
is adopted as programming language to implement and execute
the agents and CArtAgO [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] as the framework to program
and execute the computational environments where agents are
situated.
      </p>
      <p>
        Being a concrete implementation of an extended version
of AgentSpeak(L) [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], Jason adopts a BDI
(Belief-DesireIntention)-based computational model and architecture to
define the structure and behaviour of individual agents. In that,
agents are implemented as reactive planning systems: they run
continuously, reacting to events (e.g., perceived changes in the
environment) by executing plans given by the programmer.
      </p>
      <p>Plans are courses of actions that agents commit to execute
so as to achieve their goals. The pro-active behaviour of
agents is possible through the notion of goals (desired states
of the world) that are also part of the language in which plans
are written. Besides interacting with the environment, Jason extended to manage also (Java) objects, so as to work with data
agents can communicate by means of speech acts. exchanged by performing actions and processing percepts.</p>
      <p>
        On the environment side, CArtAgO – following the A&amp;A A full description of Jason language/platform and
meta-model [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] – adopts the notion of artifact as first- CArtAgO framework – and their integration – is out of the
class abstraction to define the structure and behaviour of such scope of this paper: the interested reader can find details in
computational environments and the notion of workspace as a literature [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ], [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] and on Jason and CArtAgO open-source
logical container of agents and artifacts. Artifacts explicitly web sites12.
represent the resources and tools that agents may
dynamically instantiate, share and use, encapsulating functionalities III. PROGRAMMING WEB 2.0 APPLICATIONS WITH JaCa
designed by the environment programmer. In order to be used In this section, we describe how the features of JaCa can be
by the agents, each artifact provides of a usage interface exploited to program complex Web 2.0 applications, providing
composed by a set of operations and observable properties. benefits over existing approaches. First, we sketch the main
Operations correspond to the actions that the artifact makes complexities related to the design and programming of modern
it available to agents to interact with such a piece of the and future web applications; then we describe how these are
environment; observable properties define the observable state addressed by JaCa-Web, which is a framework on top of
of the artifact, which is represented by a set of information JaCa to develop such a kind of applications.
items whose value (and value change) can be perceived by
agents as percepts. Besides observable properties, the execu- A. Programming Future Web Applications: Complexities
tion of operations can generate signals perceivable by agents as
percepts, too. As a principle of composability, artifacts can be Due to network speed problems overcoming and machine
assembled together by a link mechanism, which allows for an computational power increasing, the client-side of so-called
artifact to execute operations over another artifact. CArtAgO rich web applications is constantly evolving in terms of
comprovides a Java-based API to program the types of artifacts that plexity. Web 2.0 applications share more and more features
can be instantiated and used by agents at runtime, and then with desktop applications in order to combine their better
an object-oriented data-model for defining the data structures user experience with all Web benefits, such as distribution,
in actions, observable properties and events. openness and accessibility. One of the most important features
      </p>
      <p>Finally, the notion of workspace is used to define the of Web 2.0 is a new interaction model between the client
topology of complex environments, that can be organised user interface of a Web browser and the server-side of the
as multiple sub-environments, possibly distributed over the application. Such rich Web applications allow the client to
network. By default, each workspace contains a predefined send multiple concurrent requests in an asynchronous way,
set of artifact created at boot time, providing basic actions to avoiding complete page reload and keeping the user interface
manage the set of artifacts in the workspace – for instance, live and responding. Periodic activities within the client-side
to create, lookup, link together artifacts – to join multiple of the applications can be performed in the same fashion, with
workspaces, to print message on the console, and so on. clear advantages in terms of perceived performance, efficiency</p>
      <p>JaCa integrates Jason and CArtAgO so as to make the and interactivity.
use of artifact-based environments by Jason agents seamless. So the more complex web apps are considered, the more
To this purpose, first, the overall set of external actions that a the application logic put on the client side becomes richer,
Jason agent can perform is determined by the overall set of eventually including asynchronous interactions – with the user,
artifacts that are actually available in the workspaces where with remote services – and possibly also concurrency – due to
the agent is working. So, the action repertoire is dynamic and the concurrent interaction with multiple remote services. This
can be changed by agents themselves by creating, disposing situation is exemplified by cloud computing applications, such
artifacts. Then, the overall set of percepts that a Jason as Google doc3.
agent can observe is given by the observable properties and The direction of decentralizing responsibilities to the client
observable events of the artifacts available in the workspace at is evident also by considering the new HTML standard 5.0,
runtime. Actually an agent can explicitly select which artifacts which enriches the set of API and features that can be used
to observe, by means of a specific action called focus. By ob- by the web application on the client side4. Among the others,
serving an artifact, artifacts’ observable properties are directly some can have a strong impact on the way an application
mapped into beliefs in the belief-base, updated automatically is designed: it is the case of the Web Worker mechanism5,
each time the observable property changes its value. So a which makes it possible to spawn background workers running
Jason agent can specify plans reacting to changes to beliefs scripts in parallel to their main page, allowing for thread-like
that concern observable properties or can select plan according operation with message-passing as coordination mechanism.
to the value of beliefs which refer to observable properties.</p>
      <p>Artifacts’ signals instead are not mapped into the belief base, 1http://jason.sourceforge.net
but processed as non persistent percepts possibly triggering 32hhttttpp::////cdaorctsa.ggoo.osoguler.cceofmorge.net
plans—like in the case of message receipt events. Finally, the 4http://dev.w3.org/html5/spec/
Jason data-model – essentially based on Prolog terms – is 5http://www.whatwg.org/specs/web-workers/current-work/
User
prime-app-workspace</p>
      <p>primeService1
myPage
maxnum 100
nprimes 4
incPrimes</p>
      <p>PrimeSearcher</p>
      <p>PrimeSearcher
Jason</p>
      <p>CArtAgO
Java Virtual Machine</p>
      <p>Browser
checkPrime</p>
      <p>HTTP
numGen
current 8</p>
      <p>nextNum
primeService2</p>
      <p>chcehcekcPkrPi mrimee
JaCa-Web Artifacts</p>
      <p>Web tech
(JavaScript,
LiveConnect, ...)</p>
      <p>RemotePrimeService</p>
      <p>Another one is cross-document messaging6, which defines B. An Agent-Oriented Programming Approach based on JaCa
mechanisms for communicating between browsing contexts in By exploiting JaCa, we directly program the Web 2.0
HTML documents. application as a normal JaCa agent program, composed by</p>
      <p>
        Besides devising enabling mechanisms, a main issue is then a workspace with one or multiple agents working within an
how to design and program applications of this kind [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. artifact-based environment including a set of pre-defined type
      </p>
      <p>A basic and standard way to realise the client side of web of artifacts specifically designed for the Web context domain
app is to embed in the page scripts written in some scripting (see Fig. 1). Generally speaking, agents are used to encapsulate
language – such as JavaScript. Originally such scripts were the logic of control and execution of the tasks that characterise
meant just to perform check on the inputs and to create the Web 2.0 app, while artifacts are used to implement the
visual effects. The problem is that scripting languages – like environment needed for executing the tasks, including those
JavaScript – have not been designed for programming in the coordination artifacts that can ease the coordination of the
large, so using them to organize, design, implements complex agents’ work. As soon as the page is downloaded by the
programs is hard and error-prone. browser, the application is launched – creating the workspace,</p>
      <p>To address the problems related to scripting languages, the initial set of agents and artifacts.
higher-level approaches have been proposed, based on frame- Among the pre-defined types of artifact available in the
works that exploit mainstream object-oriented programming workspace, two main ones are the Page artifact and the
languages. A main example is Google Web Toolkit (GWT)7, HTTPService artifact. Page provides a twofold functionality to
which allows for developing client-side apps with Java. This agents: (i) to access and change the web page, internally
exchoice makes it possible to reuse and exploit all the strength ploiting specific low-level technology to work with the DOM
of mainstream programming-in-the-large languages that are (Document Object Model) object, allowing for dynamically
typically not provided by scripting languages—an example updating its content, structure, and visualisation style; (ii) to
is strong typing. However it does not provide significant make events related to user’s actions on the page observable to
improvement for those aspects that are still an issue for OO agents as percepts. An application may either exploit directly
programming languages, such as concurrency, asynchronous Page or define its own extension with specific operations and
events and interactions, and so on. observable properties linked to the specific content of the</p>
      <p>We argue then that these aspects can be effectively cap- page. HTTPService provides basic functionalities to interact
tured by adopting an agent-oriented level of abstraction and with a remote HTTP service, exploiting and hiding the use of
programmed by exploiting agent-oriented technologies such as sockets and low-level mechanisms. Analogously to Page, this
JaCa: in next section we discuss this point in detail. kind of artifact can be used as it is – providing actions to do
HTTP requests – or can be extended providing an higher-level
6http://dev.w3.org/html5/postmsg/ application specific usage interface hiding the HTTP level.
7http://code.google.com/webtoolkit/ To exemplify the description of these elements and of
JaCaWeb programming in the overall, in the following we consider
a toy example of Web 2.0 app, in which two agents are used
to search for prime numbers up to a maximum value which
can specified and dynamically changed by the user through the
web page. As soon as an agent finds a new prime number, a
field on the the web page reporting the total number of values
is updated.</p>
      <p>The environment (shown in Fig. 1) includes – besides
the artifact representing the page, called here myPage – an
artifact called numGen, functioning as a number generator,
shared and used by agents to get the numbers to verify,
and two artifacts, primeService1 and primeService2,
providing the (same) functionality that is verifying if a number
is prime.</p>
      <p>myPage is an instance of MyPage extending the basic Page
artifact so as to be application specific, by: (i) defining an
observable property maxnum whose value is directly linked to
the related input field on the web page; (ii) generating start
and stop signals as soon as the page button controls start
and stop are pressed; (ii) defining an operation incPrimes
that updates the output field of the page reporting the actual
number of prime numbers found.</p>
      <p>numGen is an instance of the NumGen artifact (see Fig. 3),
which provides an action getNextNum to generate a new
number – retrieved as output (i.e. action feedback) parameter.</p>
      <p>The two prime number service artifacts provide the
same usage interface, composed by a checkPrime(num:
integer) action, which generates an observable event
is_prime(num: integer) if the number is found
to be prime. One artifact does the computation locally
(LocalPrimeService); the other one, instead – which is
an instance of RemotePrimeService, extending the
predefined HTTPService artifact – provides the functionality by
interacting with a remote HTTP service.</p>
      <p>Fig. 2 shows the source code of one of the two agents.</p>
      <p>After having set up the tools needed to work, the agent waits
to perceive a start event generated by the page. Then, it
starts working, repeatedly getting a new number to check –
by executing a getNextNum – until the maximum number is
achieved. The agent knows such a maximum value by means
of the maxnum page observable property—which is mapped
onto the related agent belief. The agent checks the number
by performing the action checkPrime and then reacting
to is_prime(Num: integer) event, updating the page
by performing incPrimes. If a stop event is perceived –
which means that the user pressed the stop button on the Web
page – the agent promptly reacts and stops working, dropping
its main intention.</p>
      <p>A final note about implementation: Java applet technology
is used to run the full application stack (including Jason
and CArtAgO) in the browser, using signed applets so to
avoid limitations imposed by the sandbox model. LiveConnect
technology8 is exploited to enable a bi-direction interaction
between the applet and the web page resources (DOM, scripts).</p>
      <p>8https://jdk6.dev.java.net/plugin2/liveconnect/
}</p>
      <p>}
}
}
}</p>
      <p>}
00 !setup.
01
02 +!setup
03 &lt;- focusByName("MyPage");
04 makeArtifact("primeService1",</p>
      <p>"RemotePrimeService");
makeArtifact("numGen","NumGen").
05
06
07 +start
08 &lt;- focusByName("primeService1");
09 focusByName("numGen");
10 !!checkPrimes.
11
12 +!checkPrimes
13 &lt;- nextNum(Num);
14 !checkNum(Num).
15
16 +!checkNum(Num): maxnum(Max) &amp; Num &lt;= Max
18 &lt;- checkPrime(Num);
18 !checkPrimes.
19
20 +!checkNum(Num) &lt;- maxnum(Max) &amp; Num &gt; Max.
21
22 +is_prime(Num) &lt;- incPrimes.
23
24 +stop &lt;- .drop_intention(checkPrimes).</p>
      <p>Fig. 2. Jason source code of a prime searcher agent.
public class MyPage extends PageArtifact {
protected void setup() {
defineObsProperty("maxnum",getMaxValue());
//Operation for event propagation
linkEventToOp("start","click","startClicked");
linkEventToOp("stop","click","stopClicked");
linkEventToOp("maxnum","change","maxnumChange");
}
@OPERATION void incPrimes(){</p>
      <p>Elem el = getElementById("primes_found");
el.setValue(el.intValue()+1);
}
@INTERNAL_OPERATION private void startClicked(){</p>
      <p>signal("start");
}
@INTERNAL_OPERATION private void stopClicked(){</p>
      <p>signal("stop");
}
@INTERNAL_OPERATION private void maxnumChange(){</p>
      <p>updateObsProperty("maxnum",getMaxValue());
}
private int getMaxValue(){</p>
      <p>return getElementById("maxnum").intValue();
public class RemotePrimeService extends HTTPService {
@OPERATION void checkPrime(double n){</p>
      <p>HTTPResponse res =</p>
      <p>doHTTPRequest(serverAddr,"isPrime",n);
if (res.getElem("is_prime").equals("true")){</p>
      <p>signal("is_prime",n);
public class NumGen extends Artifact {
void init(){ defineObsProperty("current",0); }
@OPERATION void nextNum(OpFeedbackParam&lt;Integer&gt; res){
int v = getObsProperty("current").intValue();
updateObsProperty("current",++v);
res.set(v);
}
Fig. 3. Artifacts’ definition in CArtAgO: MyPage and
RemotePrimeService extending respectively PageArtifact
and HTTPService artifact types which are available by default in
JaCa-Web workspaces, and NumGen to coordinate number generation and
sharing.</p>
      <sec id="sec-2-1">
        <title>C. Key points</title>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>We have identified three key points that, in our opinion,</title>
      <p>represent main benefits of adopting agent-oriented
programming and, in particular, the JaCa-Web programming model,
for developing applications of this kind.</p>
      <p>First, agents are first-class abstractions for mapping possibly
concurrent tasks identified at the design level, so reducing
the gap from design to implementation. The approach allows
for choosing the more appropriate concurrent architecture,
allocating more tasks to the same kind of agent or defining
multiple kind of agents working concurrently. This allows
for easily programming Web 2.0 concurrent applications, that
are able to exploit parallel hardware on the client side (such
as multi-core architectures). In the example, two agents are
used to fairly divide the overall job and work concurrently,
exploiting the number generator artifact as a coordination tool
to share the sequence of numbers. Actually, changing the
solution by using a single agent or more than two agents would
not require any substantial change in the code.</p>
      <p>A second key point provided by the agent control
architecture is the capability of defining task-oriented computational
behaviours that straightforwardly integrate the management of
asynchronous events generated by the environment – such as
the input of the user or the responses retrieved from remote
services – and the management of workflows of possibly
articulated activities, which can be organized and structured
in plans and sub-plans. This makes it possible to avoid the
typical problems produced by the use of callbacks – that can
be referred as asynchronous spaghetti code – to manage events
within programs that need – at the same time – to have one
or multiple threads of control.</p>
      <p>In the prime searcher agent shown in the example, for
instance, on the one hand we use a plan handling the
checkPrimes goal to pro-actively search for prime
numbers. The plan is structured then into a subgoal checkNum to
process the number retrieved by interacting with the number
generator. Then, the plan executed to handle this subgoal
depends on the dynamic condition of the system: if the number
to process is greater than the current value of the maxnum
page observable property (i.e. of its related agent belief), then
no checks are done and the goal is achieved; otherwise, the
number is checked by exploiting a prime service available
in the environment and the a new checkPrimes goal is
issued to go on exploring the rest of the numbers. The user
can dynamically change the value of the maximum number to
explore, and this is promptly perceived by the agents which
can change then their course of actions accordingly. On the
other hand, reactive plans are used to process asynchronous
events from the environment, in particular to process incoming
results from prime services (line 22) and user input to stop the
research (line 24).</p>
      <p>Finally, the third aspect concerns the strong separation of
concerns which is obtained by exploiting the environment as
first class abstraction. Jason agents, on the one side,
encapsulates solely the logic and control of tasks execution; on the
other side, basic low-level mechanisms to interact and exploit
the Web infrastructure are wrapped inside artifacts, whose
functionalities are seamlessly exploited by agents in terms of
actions (operations) and percepts (observable properties and
events). Also, application specific artifacts – such as NumGen
– can be designed to both encapsulate shared data structures
useful for agents’ work and regulate their access by agents,
functioning as a coordination mechanism.</p>
    </sec>
    <sec id="sec-4">
      <title>IV. A CASE STUDY</title>
      <p>To stress the features of agent-oriented programming and
test-drive the capabilities of the JaCa-Web framework, we
developed a real-world Web application – with features that
go beyond the ones that are typically found in current Web
2.0 app. The application is about searching products and
comparing prices from multiple services, a “classic” problem
ton the Web.</p>
      <p>We imagine the existence of N services that offer product
lists with features and prices, codified in some standard
machine-readable format. The client-side in the Web
application needs to search all services for a product that satisfies a set
of user-defined parameters and has a price inferior to a certain
user-defined threshold. The client also needs to periodically
monitor services so as to search for new offerings of the
same product. A new offering satisfying the constraints should
be visualised only when its price is more convenient than
the currently best price. The client may finish its search and
monitoring activities when some user-defined conditions are
met—a certain amount of time is elapsed, a product with
a price less than a specified threshold is find, or the user
interrupts the search with a click on a proper button in the
page displayed by the browser. Finally, if such an interruption
took place, by pressing another button it must be possible to
let the search continue from the point where it was blocked.</p>
      <p>Typically applications of this kind are realised by
implementing all the features on the server side, without –
however – any support for long-term searching and monitoring
capabilities. In the following, we describe a solution based on
JaCa-Web, in which responsibilities related to the long-term
search and comparison are decentralised into the client side of
the application, improving then the scalability and quality of
service for the users.</p>
      <sec id="sec-4-1">
        <title>A. Application Design</title>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>The solution includes two kinds of agents (see Fig. 4): a</title>
      <p>UserAssistant agent – which is responsible of setting up the
application environment and manage interaction with the user
– and multiple ProductFinder agents, which are responsible to
periodically interact with remote product services to find the
products satisfying the user-defined parameters. To aggregate
data retrieved from services and coordinate the activities of
the UserAssistant and ProductFinder we introduce a
ProductDirectory artifact, while a MyPage page artifact and multiple
instances of ProductService artifacts are used respectively by
the UserAssistant and ProductFinder to interact with the user
and with remote product services.</p>
      <p>More in detail, the UserAssistant agent is the first agent
booted on the client side, and it setups the application environ- ...
ment by creating the ProductDirectory artifact and spawning +searchState("start")
a number of ProductFinder agents, one for each service to &lt;- f!o!csuesa(r"cshe.rvice1");
monitor. Then, by observing the MyPage artifact, the agent
monitors user’s actions and inputs. In particular, the web +!s&lt;e-arcrhe:qukeesytwPorroddsu(cKtesy(wKoerydwso)rds,ProductList);
page provides controls to start, stop the searching process and !processProducts(ProductList,
to specify and change dynamically the keywords related to PPrroodduuccttssTTooRAedmdo,ve);
the product to search, along with the conditions to possibly addProducts(ProductsToAdd);
terminate the process. Page events are mapped onto start r.ewmaoivte(P{r+okdeuycwtosr(dPsr(o_d)u}c,t5s0T0o0R,e_m)o;ve);
and stop observable events generated by MyPage, while !search.
specific observable properties – keywords and termination +searchState("stop")
conditions – are used to make it observable the input infor- &lt;-.drop_intention(search).
mation specified by the user.</p>
      <p>The UserAssistant reacts to these observable events and Fig. 5. A snippet of ProductFinder agent’s plans.
to changes to observable properties, and interacts with
ProductFinder agents to coordinate the searching process. The
interaction is mediated by the ProductDirectory artifact, remote product service by means of a private ProductService
which is used and observed by both the UserAssistant artifact, which extends a HTTPService artifact providing an
and ProductFinders. In particular, this artifact provides a operation (requestProducts) to directly perform
highusage interface with operations to: (i) dynamically update level product-oriented requests, hiding the HTTP level.
the state and modality of the searching process – in
particular startSearch and stopSearch to change the B. Implementation
value of a searchState observable property – useful The source code of the application can be consulted on
to coordinate agents’ work – and changeBasePrice, the JaCa-Web web site9, where the interested reader can
changeKeywords to change the value of the base price find also the address of a running instance that can be used
and the keywords describing the product, which are stored in a for tests. Here we just report a snippet of the ProductFinder
keyword observable property; (ii) aggregate product informa- agents’ source code (Fig. 5), with in evidence (i) the plans
tion found by ProductFinders – in particular addProducts, used by the agent to react to changes to the search state
removeProducts, clearAllProducts to respectively property perceived from the ProductDirectory artifact - adding
add and remove a product, and remove all products found so and removing a new search goal, and (ii) the plan used
far. Besides searchState and keywords, the artifact has to achieve that goal, first getting the product list by means
further observable properties, bestProduct, to store and of the requestProducts operation and then updating the
make it observable the best product found so far.</p>
      <p>Finally, each ProductFinders periodically interact with a 9http://jacaweb.sourceforge.net
ProductDirectory accordingly by adding new products and
removing products no more available. It is worth noting the
use of the keywords belief – related to the keywords
observable property of the ProductDirectory artifact – in the
context condition of the plan to automatically retrieve and
exploit updated information about the product to search.</p>
    </sec>
    <sec id="sec-6">
      <title>V. RELATED WORKS AND CONCLUSION</title>
      <p>To conclude, we believe that agent-oriented programming –
including multi-agent programming – would provide a suitable
level of abstraction for tackling the development of
complex software applications, extending traditional programming
paradigms such as the Object-Oriented to deal with aspects
such as concurrency, reactiveness, asynchronous interaction
managements, dynamism and so on. In this paper, in particular,
we discussed the advantages of applying such an approach to
the development of Web 2.0 advanced applications, exploiting
the JaCa integrated platform.</p>
    </sec>
    <sec id="sec-7">
      <title>Concerning the specific application domain, several frame</title>
      <p>
        works and bridges have been developed to exploit agent
technologies for the development of Web applications. Main
examples are the Jadex Webbridge [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], JACK WebBot [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and the
JADE Gateway Agent [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. The Webbridge Framework enables
a seamless integration of the Jadex BDI agent framework [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]
with JSP technology, combining the strength of agent-based
computing with Web interactions. In particular, the framework
extends the the Model 2 architecture – which brings the
Model-View-Controller (MVC) pattern in the context of Web
application development – to include also agents, replacing
the controller with a bridge to an agent application, where
agents react to user requests. JACK WebBot is a framework
on top of the JACK BDI agent platform which supports the
mapping of HTTP requests to JACK event handlers, and the
generation of responses in the form of HTML pages. Using
WebBot, you can implement a web application which makes
use of JACK agents to dynamically generate web pages in
response to user input. Finally, the JADE Gateway Agent is
a simple interface to connect any Java non-agent application
– including Web Applications based on Servlets and JSP – to
an agent application running on the JADE platform [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>All these approaches explore the use of agent technologies
on the server side of Web Applications, while in our work
we focus on the client side, which is what characterises Web
2.0 applications. So – roughly speaking – our agents are
running not on a Web server, but inside the Web browser,
so in a fully decentralized fashion. Indeed, these two views
can be combined together so as to frame an agent-based way
to conceive next generation Web applications, with agents
running on both the client and server side.</p>
    </sec>
    <sec id="sec-8">
      <title>Finally, the use of agents to represent concurrent and</title>
      <p>
        interoperable computational entities already sets the stage for
a possible evolution of Web 2.0 applications into Semantic
Web applications [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. From the very beginning [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], research
activity on the Semantic Web has always dealt with intelligent
agents capable of reasoning on machine-readable descriptions
of Web resources, adapting their plans to the open Internet
environment in order to reach a user-defined goal, and
negotiating, collaborating, and interacting with each other during
their activities. So, a main future work accounts for extending
the JaCa-Web platform with Semantic Web technologies: to
this purpose, existing works such as JASDL [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] and the NUIN
project [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] will be main references.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>[1] JADE gateway agent (JADE 4.0 api)</article-title>
          - http://jade.tilab.com/doc/api/jade/ wrapper/gateway/jadegateway.html.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Agent</given-names>
            <surname>Oriented Software</surname>
          </string-name>
          <article-title>Pty</article-title>
          .
          <article-title>JACK intelligent agents webbot manual</article-title>
          - http://www.aosgrp.com/documentation/jack/webbot manual web/ index.html#thejackwebbotarchitecture.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>F. L.</given-names>
            <surname>Bellifemine</surname>
          </string-name>
          , G. Caire, and
          <string-name>
            <given-names>D.</given-names>
            <surname>Greenwood</surname>
          </string-name>
          .
          <article-title>Developing Multi-Agent Systems with JADE</article-title>
          . Wiley,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>T.</given-names>
            <surname>Berners-Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Hendler</surname>
          </string-name>
          , and
          <string-name>
            <given-names>O.</given-names>
            <surname>Lassila</surname>
          </string-name>
          .
          <source>The Semantic Web. Scientific American</source>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>R.</given-names>
            <surname>Bordini</surname>
          </string-name>
          , J. Hu¨bner, and
          <string-name>
            <given-names>M.</given-names>
            <surname>Wooldridge</surname>
          </string-name>
          .
          <article-title>Programming Multi-Agent Systems in AgentSpeak Using Jason</article-title>
          . John Wiley &amp; Sons, Ltd,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>R.</surname>
          </string-name>
          <year>e</year>
          . a. Bordini, editor.
          <source>Multi-Agent Programming: Languages, Platforms and Applications</source>
          (vol.
          <volume>1</volume>
          ). Springer,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>R.</surname>
          </string-name>
          <year>e</year>
          . a. Bordini, editor.
          <source>Multi-Agent Programming: Languages, Platforms and Applications</source>
          (vol.
          <volume>2</volume>
          ). Springer Berlin / Heidelberg,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>I. Dickinson. BDI</surname>
          </string-name>
          <article-title>Agents and the Semantic Web: Developing UserFacing Autonomous Applications</article-title>
          .
          <source>PhD thesis</source>
          , University of Liverpool,
          <year>September 2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>J.</given-names>
            <surname>Hendler</surname>
          </string-name>
          .
          <article-title>Agents and the Semantic Web</article-title>
          .
          <source>IEEE Intelligent Systems</source>
          ,
          <volume>16</volume>
          (
          <issue>2</issue>
          ):
          <fpage>30</fpage>
          -
          <lpage>37</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>T.</given-names>
            <surname>Klapiscak</surname>
          </string-name>
          and
          <string-name>
            <given-names>R. H.</given-names>
            <surname>Bordini</surname>
          </string-name>
          . JASDL:
          <article-title>A practical programming approach combining agent and semantic web technologies</article-title>
          .
          <source>In Declarative Agent Languages and Technologies VI</source>
          , volume
          <volume>5397</volume>
          /2009 of LNCS, pages
          <fpage>91</fpage>
          -
          <lpage>110</lpage>
          , Berlin, Heidelberg,
          <year>2009</year>
          . Springer-Verlag.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>T.</given-names>
            <surname>Mikkonen</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Taivalsaari</surname>
          </string-name>
          .
          <article-title>Web applications: spaghetti code for the 21st century</article-title>
          .
          <source>Technical report</source>
          , Mountain View, CA, USA,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>M.</given-names>
            <surname>Minotti</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Piancastelli, and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          .
          <article-title>An agent-based programming model for developing client-side concurrent web 2.0 applications</article-title>
          . In J. Filipe and J. Cordeiro, editors,
          <source>Web Information Systems and Technologies</source>
          , volume
          <volume>45</volume>
          <source>of Lecture Notes in Business Information Processing</source>
          . Springer Berlin Heidelberg,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>A.</given-names>
            <surname>Omicini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Viroli</surname>
          </string-name>
          .
          <article-title>Artifacts in the A&amp;A meta-model for multi-agent systems</article-title>
          . Autonomous Agents and
          <string-name>
            <surname>Multi-Agent</surname>
            <given-names>Systems</given-names>
          </string-name>
          ,
          <volume>17</volume>
          (
          <issue>3</issue>
          ), Dec.
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>A.</given-names>
            <surname>Pokahr</surname>
          </string-name>
          and
          <string-name>
            <surname>L. Braubach.</surname>
          </string-name>
          <article-title>The webbridge framework for building web-based agent applications</article-title>
          . pages
          <fpage>173</fpage>
          -
          <lpage>190</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>A.</given-names>
            <surname>Pokahr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Braubach</surname>
          </string-name>
          , and
          <string-name>
            <given-names>W.</given-names>
            <surname>Lamersdorf</surname>
          </string-name>
          .
          <article-title>Jadex: A BDI reasoning engine</article-title>
          . In R. Bordini,
          <string-name>
            <given-names>M.</given-names>
            <surname>Dastani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Dix</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A. E. F.</given-names>
            <surname>Seghrouchni</surname>
          </string-name>
          , editors,
          <source>Multi-Agent Programming</source>
          . Kluwer,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>A. S.</given-names>
            <surname>Rao</surname>
          </string-name>
          . Agentspeak(l):
          <article-title>BDI agents speak out in a logical computable language</article-title>
          .
          <source>In MAAMAW '96: Proceedings of the 7th European workshop on Modelling autonomous agents in a multi-agent world</source>
          , pages
          <fpage>42</fpage>
          -
          <lpage>55</lpage>
          . Springer-Verlag New York, Inc.,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Piunti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. D.</given-names>
            <surname>Acay</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bordini</surname>
          </string-name>
          , J. Hu¨bner, and
          <string-name>
            <given-names>M.</given-names>
            <surname>Dastani</surname>
          </string-name>
          .
          <article-title>Integrating artifact-based environments with heterogeneous agentprogramming platforms</article-title>
          .
          <source>In Proceedings of 7th International Conference on Agents and Multi Agents Systems (AAMAS08)</source>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Piunti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Viroli</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Omicini</surname>
          </string-name>
          .
          <article-title>Environment programming in CArtAgO</article-title>
          . In R. H.
          <string-name>
            <surname>Bordini</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Dastani</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Dix</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>El</surname>
          </string-name>
          Fallah-Seghrouchni, editors,
          <source>Multi-Agent Programming: Languages, Platforms and Applications</source>
          , Vol.
          <volume>2</volume>
          , pages
          <fpage>259</fpage>
          -
          <lpage>288</lpage>
          . Springer,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Viroli</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Omicini. The</surname>
          </string-name>
          <string-name>
            <surname>A</surname>
          </string-name>
          &amp;
          <article-title>A programming model &amp; technology for developing agent environments in MAS</article-title>
          . In M. Dastani,
          <string-name>
            <given-names>A.</given-names>
            <surname>El Fallah Seghrouchni</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          , and M. Winikoff, editors,
          <source>Programming Multi-Agent Systems</source>
          , volume
          <volume>4908</volume>
          <source>of LNAI</source>
          , pages
          <fpage>91</fpage>
          -
          <lpage>109</lpage>
          . Springer Berlin / Heidelberg,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Virolil</surname>
          </string-name>
          , and
          <string-name>
            <surname>G. Piancastelli.</surname>
          </string-name>
          <article-title>simpA: A simple agent-oriented Java extension for developing concurrent applications</article-title>
          . In M. Dastani,
          <string-name>
            <given-names>A. E. F.</given-names>
            <surname>Seghrouchni</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Leite</surname>
          </string-name>
          , and P. Torroni, editors,
          <source>Languages, Methodologies and Development Tools for Multi-Agent Systems</source>
          , volume
          <volume>5118</volume>
          <source>of LNAI</source>
          , pages
          <fpage>176</fpage>
          -
          <lpage>191</lpage>
          , Durham, UK,
          <year>2007</year>
          . Springer-Verlag.
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Shoham</surname>
          </string-name>
          .
          <article-title>Agent-oriented programming</article-title>
          .
          <source>Artificial Intelligence</source>
          ,
          <volume>60</volume>
          (
          <issue>1</issue>
          ):
          <fpage>51</fpage>
          -
          <lpage>92</lpage>
          ,
          <year>1993</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>