<!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>A Tool for the Automatic Generation of MOISE Organisations From BPMN</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Massimo Cossentino</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Salvatore Lopes</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Luca Sabatucci</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>ICAR-CNR</institution>
          ,
          <addr-line>153, Via La Malfa, 90146 Palermo</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <fpage>69</fpage>
      <lpage>82</lpage>
      <abstract>
        <p>Multi-agent systems proved successful in enacting business processes because of their inner properties (distribution of tasks, collaboration and coordination among agents). MAS adoption in enacting processes becomes even more interesting if they exhibit adaptation capabilities. The proposed approach consists in the automatic generation of a MOISE organisation from the BPMN specification of a business process. This organisation is conceived to support adaptation because of the possibility to adapt its configuration at runtime according to emerging needs. Here, we focus on the tool for processing BPMN specification and generating MOISE organization code.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Multi-Agent Systems</kwd>
        <kwd>Business Process</kwd>
        <kwd>BPMN</kwd>
        <kwd>Adaptation</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Traditionally, business processes are designed as static, rigid procedures, but in real production
environment there are many events and/or exceptions that can not be foreseen at design time
and can lead to the failure of the whole process. For instance, some web service could be not
reachable, the network could be extremely busy with heavy delay in response etc. . . However,
increasing the agility and the flexibility of business process is not trivial being in contrast to the
current trend of over-specifying workflow details with the objective to detail every possible
execution branches.</p>
      <p>
        Multi-Agent Systems own many interesting features as autonomy, distribution of tasks, and
collaboration/coordination, that proved successfully in a range of application fields. Historically,
MASs have good records in implementing workflows because all those features perfectly match
with enterprises’ needs [
        <xref ref-type="bibr" rid="ref1 ref2 ref3">1, 2, 3</xref>
        ]. Moreover, the Belief Desire Intention (BDI) paradigm[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] allows
developers to design applications with practical reasoning, facilitating the definition of business
logic.
      </p>
      <p>
        Most of the agent-based approaches to workflow design are based on services and semantic
web description (i.e. DAML-S [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]) for defining the external behaviours of proactive agents, and
social and communication abilities of agents to coordinate the flow of tasks. It remains open
the issue of coordinating heterogeneous, autonomous agents, whose internal designs is not
partially or full known a-priori.
      </p>
      <p>
        An important improvement in MAS design and implementation comes out with the JaCaMo
platform [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. It represents an interesting solution because it handle various aspects of agent
programming. JaCaMo integrates in an unique platform three multi-agent programming
dimensions (agent, environment, and organization levels) and provides Jason [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] for developing BDI
agents [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], CArtAgO for defining artifacts [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], and MOISE [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] for specifying agent organizations.
      </p>
      <p>
        In this paper we propose a tool able to automatically generate organizations of agents to
implement a given workflow expressed in Business Process Modeling Notation (BPMN) [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. A
structured organization adds robustness to the MAS system without losing the nice properties
of agents like reasoning, communication and coordination abilities. The aim is to produce a
MAS implementation of the business process able to adapt itself to various internal/external
unexpected conditions (unavailability of services, failure in reaching the expected end-condition,
network problem and so on).
      </p>
      <p>
        The BPMN is a high-level language that allows developer to model all the phases of a planned
business process. It focuses on analysis activity and there is not any bounding between tasks and
services at design time. A recent result has been that a business process, opportunely designed,
may be automatically translated into goals [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. This translation has the advantage that goals
allow for breaking the rigid constraints of a BPMN: whereas sequence flows specify the precise
order in which services are invoked, goals can relax the order of task execution, widening the
space for adaptation [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. This goes into the direction of defining several possibilities to attain
the desired result.
      </p>
      <p>
        Having a BPMN as a set of goals, it is possible to conceive a multi agent system able of
addressing them [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. The idea is that, given a set of goals, and a set of available services,
it is possible to automatically generate one or more social organizations corresponding to
the workflow enactment. Clearly, the number of organizations depends on the availability of
services. A redundant service repository allows for diferent plans to pursue the same set of
goals. However, when several organizations can be produced (each one targeted to the same
desired result), it is possible to enable run-time adaptation strategies for continuing goal pursuit
in case of failure.
      </p>
      <p>The tool we propose uses a three steps procedure:</p>
      <sec id="sec-1-1">
        <title>1. goal extraction from a BPMN definition [11],</title>
        <p>2. exploiting a planner for composing available services (stored in a yellow pages service)
and obtaining diferent wokflow solutions to the same set of goals, and
3. employment of each diferent solution for generating multi-faceted agent organizations
voted to achieve the business goal.</p>
        <p>The paper is structured as follows: Section 2 presents the theoretical background, providing a
brief description of BPMN, MOISE and JaCaMo. Section 3 describes the automatic generation of
MOISE organizations; in particular, Section 3.1 presents a running example; Section 3.2 briefly
reports the approach by discussing the mapping between BPMN elements and MOISE metamodel
elements; Section 3.3 enters into the details, by explaining the algorithm of conversion. Finally,
some conclusion is drawn in Section 4.
issue list
[ready]
issue list
[in vote]</p>
        <p>issue votes
issue
list</p>
        <p>Determine
Issues
issue list
[initial]</p>
        <p>Discussion</p>
        <p>Voting
annoiusnscueement
annouvnocteement</p>
        <p>Col ect
Votes
vote
not agree(issue votes)</p>
        <p>Vote
Results
vote
results
issue votes
[final]</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Theoretical Background</title>
      <p>In this section we provide a brief description of the main background concepts used along
the paper; namely the BPMN notation for the design of business processes and the MOISE
framework for multi-agent systems organisations definition.</p>
      <sec id="sec-2-1">
        <title>2.1. Process Modeling with BPMN</title>
        <p>
          The Business Process Model and Notation (BPMN) [
          <xref ref-type="bibr" rid="ref10 ref14">10, 14</xref>
          ] is de-facto standard for business
analysts to model a process. It contains a very articulated meta-model and an expressive
notation for representing business processes of diverse nature. The graphical notation allows
several modelling perspectives [
          <xref ref-type="bibr" rid="ref10 ref14">10, 14</xref>
          ]; this paper focuses on collaboration diagrams (similar to
activity diagrams), in which a process is described as a collection of participants. Processes are
composed of five categories of objects: activities, events, messages, data objects, and many kind
of gateways. Every participant (each one in a diferent Swimlane) has her own flow of activities.
Coordination occurs when processes exchange messages via message flows.
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Organisations Definitions with MOISE</title>
        <p>
          MOISE defines a collection of elements for modelling an organization. A MOISE organization is
a specialized group that is devoted to pursue some goal. An organization is not only a collection
of roles. Indeed, defining an organization implies the definition of structural, functional and
normative perspectives [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
        </p>
        <p>The Structural Specification describes who (role) operates in the organization, the
organization’s hierarchy (groups and subgroups), which role belongs to each group together with its
cardinality, and the kind of relationship between roles (authority, communication, acquaintance)</p>
        <p>The Functional Specification specifies the scheme of activities associated to each group. A
scheme represents the goal decomposition tree. Each scheme is characterized by a goal to attain,
and one or more plan. A plan represents the modality (sequence, parallel, choice) to address the
inner sub-goals. All the goals are contained into a mission.</p>
        <p>The Normative Specification defines obligations and permissions that link roles to missions.</p>
        <p>
          A brief description of the MOISE elements based on definitions proposed by Hubner in [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
is reported here:
        </p>
        <p>Structural Specification:
Role a role represents a placeholder for an agent that takes in charge to perform some activity.</p>
        <p>The number of agents that can play a role is constrained by a minimum and maximum
number.</p>
        <p>Group a group is composed by roles. A group is well formed when all its roles are played by
agents.</p>
        <p>Link A link specifies the type of relationship between agents playing two roles. It is possible
to describe compatibilities between roles.</p>
        <sec id="sec-2-2-1">
          <title>Functional Specification:</title>
          <p>Goal semantic description of a result to obtain; MOISE goals may belong to two diferent types:
achieve and maintain.</p>
          <p>Scheme a Scheme is the decomposition of the organization’s goals as an articulated gol-tree.</p>
          <p>It also includes the specification of Missions.</p>
          <p>Plan is an operator, used within a Scheme, in order to specify the goal decomposition type
(sequence, choice, parallel).</p>
        </sec>
        <sec id="sec-2-2-2">
          <title>Mission A mission is a set of (sub-)goals.</title>
        </sec>
        <sec id="sec-2-2-3">
          <title>Normative Specification:</title>
          <p>Norm there are two types of norms: obligation and permission. They establish the link
between the role and the mission. When an agent plays a role, it should or would commit
to missions’ goals.</p>
          <p>
            The MOISE organisation (provided as a XML file) is not operational in itself. A set of
CArtAgO Artifacts allows all necessary constructs and data structures to make a MAS operative,
i.e. allowing agents to adopt ad play a role, to participate to a group, and to commit a mission [
            <xref ref-type="bibr" rid="ref6">6</xref>
            ].
For instance, the GroupBoard stores information about the MOISE elements the organization is
made of. Once an agent adopt a role, it is subject to the constraints the organization imposes.
Depending on the norm, an agent can commit or to be obliged to perform a mission.
          </p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. A Tool for the Automatic Generation of MOISE Organisations from BPMN</title>
      <p>This section discusses the tool for the automatic generation of agent organization, by using a
running example to present details of the approach.</p>
      <sec id="sec-3-1">
        <title>3.1. Running Example: The Simplified Email Voting Process</title>
        <p>
          In the remaining sections of this paper, we refer to the example workflow reported in Fig. 1.
That is a simplification of a well known BPMN example [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]. In this process, members of a
BPMN
        </p>
        <p>State
extractor</p>
        <p>BPMN2
GOAL</p>
        <p>ID GOAL
trigger_cond
final_state</p>
        <p>Wi
Ontology
extractor</p>
        <p>Ontology</p>
        <p>PMR</p>
        <p>ID SOLUTION
WI
items
flows</p>
        <p>ABSTRACT
ID CAPABILITY
params
pre
post
effects
&lt;agent,service&gt;</p>
        <p>GROUNDING</p>
        <p>CAPABILITY
abstract
param_mapping
YELLOW
PAGES</p>
        <p>SOL2</p>
        <p>MOISE
MOISE-SPEC
committee discuss an issue list, and express a vote: if the majority is not reached, a new iteration
of discussion/voting is performed.</p>
        <p>The process description reports some events (emails) connecting the reported activities with
the external voting members, represented as a swimlane shading the behaviour of the voting
members that is of low interest for the current example. Data flow in the process is represented
by Data Objects (like the Issue_list) that can evolve their refinement during the process, and
that is represented by a state (initial, in_vote,. . . ).</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. The Proposed Approach</title>
        <p>This section describes the proposed approach for generating MOISE organizations starting from
the BPMN description of a workflow.</p>
        <p>The main tools and artifacts of the architecture are depicted in Fig. 2. They contribute to the
generation of the organization according to the following sub-steps:
Goal Extraction The first step consists in the extraction of goals from the BPMN process that
is depicted using some BPMN compliant tool (and exported using the XMI format). This becomes
the input of the BPMN2GOAL module1. The tool generates a list of goals by inspecting BPMN
elements and their relationships. Indeed, single elements (activities, gateways,. . . ) contribute
to the advancement in the world state in a way that is dependent on both endogenous factors
(the result provided by the work done inside the element) and exogenous ones (the influence
that other process elements have on it by creating its input, and constraining its output for
compatibility with the remaining part of the process). In other words, a kind of balance of forces
is to be solved in order to represent the mutual influence of each BPMN element on the other,</p>
        <sec id="sec-3-2-1">
          <title>1Available online at: http://aose.pa.icar.cnr.it:8080/BPMN2Goal/</title>
          <p>GOAL: &lt;name of the goal (from BPMN activity&gt;</p>
          <p>WHEN: &lt;conditions for goal triggering, from preconditions of the activity and
postconditions of predecessor BPMN elements&gt;</p>
          <p>THEN: &lt;intended state of the world, from activity postcondition and preconditions of
successor BPMN elements&gt;
and the single element contribution to what becomes the collective outcome of the process
execution.</p>
          <p>
            Details about the goals extraction procedure may be found on [
            <xref ref-type="bibr" rid="ref11">11</xref>
            ]. Briefly, the structure of a
goal is reported in Fig. 3. Usually the goal name is taken from the activity it refers to (GOAL
line), while the WHEN clause defines the trigger condition of the goal; this depends on the
elements before the activity under analysis. Let us consider the process fragment reported in
Fig. 4, an OR gateway merges the control flows of activities Act_A, Act_B that are placed before
Act_C: the input of Act_C may be provided by only one of the other two activities feeding
the OR gateway or even by both of them. This has to be reported in the WHEN condition by
connecting the two output conditions of Act_A, and Act_B with an OR logical operator. We
may also suppose Act_C requires some other condition to hold in order to be executed and that
is to be expressed in the WHEN specification as well. This may happen when the condition in
the original process was generated by other activities/tasks placed before Act_C. Finally, the
THEN clause defines the postcondition after the execution of Act_C. This could also depend on
the expected input of the following activities as well, in order to ensure the correct execution of
the workflow.
          </p>
          <p>State of the World Extraction The current state of the world is of paramount importance for
the execution of a MAS solution. This is generated by the State Extractor module by processing
the input workflow. The method considers the event that is usually sent to the workflow in
order to trigger its execution together with any Data Input (an input Data Object for the whole
process) as specified in the XMI file.</p>
          <p>Ontology Extraction Goal specifications naturally define a vocabulary of terms that may
be usefully employed to specify a part of the world where the agents live (predicates in the
WHEN/THEN conditions of goals), and the actions that can be done in it (BPMN activities).
This generates a primordial ontology that is generated by the Ontology Extractor module. A
more accurate processing of some optional details of the BPMN notation greatly contributes
to this issue. As an example we could consider Data Objects (that could represent ontology
concepts), their states (that could generate predicates), Data type (items) that could contribute
to the generation of a IS-A tree. Despite the interesting implications, these features are not
relevant to the current work.</p>
          <p>
            Solutions Calculations The possibility to execute the workflow with the available agents
in the MAS depends on the capabilities such agents register in the system’s Yellow Pages. We
suppose each agent, entering the system, registers its own capabilities in such register by using
a tuple &lt;agent, service&gt;. For each service, an Abstract Capability is automatically generated by
considering the service interface specifications like pre and post conditions. Of course, services
with the same specifications are considered as belonging to the same abstract capability thus
creating a redundancy in the capability instantiation that can profitably support some adaptation
degree (see [
            <xref ref-type="bibr" rid="ref13">13</xref>
            ]). Indeed, the instantiation of the capability also depends on some parameters
that are part of the solution and they contribute to the definition of the Grounding Capability. A
Grounding Capability is the concretization of an Abstract one, and many Grounding capabilities
may correspond to one Abstract Capability, according to the available agent-service tuples in
the Yellow Pages.
          </p>
          <p>
            Solutions are computed by the Proactive Means-end Reasoning (PMR) algorithm [
            <xref ref-type="bibr" rid="ref15">15</xref>
            ]: each
solution is a workflow including capabilities, decision nodes, and so on.
          </p>
          <p>The PMR algorithm, in each solution, defines a world transition system (WTS), like the one
shown in Fig. ?? from the input workflow of Fig. 1. The initial state corresponds to the initial
event of the workflow (the reception of the issue list in this example). The next state corresponds
to the availability of an issue list arranged for the discussion. The PMR identifies the capability
prepare as the one that could transform the state of the issue list from [received] to [initial].
This capability is the abstraction of a service registered in the Yellow Pages by one or more
agents. Actually this likely means the prepare capability proposes the received issue list to the
committee chair for editing. Once the chair completes her editing, the list moves to the [initial]
state and it is ready for discussion in the committee. Again the PMR algorithm identifies one
capability (discussion) for managing the debate and producing the expected output (the issue
list in the [ready] refinement state).</p>
          <p>Now, if the voting achieves a majority consensus, the final state is reached, otherwise another
branch is activated with the possibility to iterate modifications and votes.</p>
          <p>This WTS ma be used to deduce the workflow underpinned by the solution. That step is
easily done by looking at the capabilities listed in the WTS and reporting them as activities just
like it is shown in Fig. 6. Control flows are similarly found in order to complete the design.</p>
          <p>It is worth to note that this workflow is equivalent to the input BPMN one in terms of the
results it produces but the type and number of services may not (and usually do not) exactly map
one-to-one to the initial process activities. This solution is specifically conceived to be executed
by the agents in the MAS and it has been designed to only use services that are possessed by
those agents.
[initial(issue_list)]
prepare()
discussion()
[ready(issue_list)]</p>
          <p>voting()_disagree
[fnal(issue_list),sent(vote_announcement)]
voting()_agree</p>
          <p>discussion() voting()_disagree
[ready(issue_list),sent(vote_announcement)]</p>
          <p>voting()_agree</p>
          <p>Of course the proposed example is very simple and solutions could be easily found even by
hand but the approach works for large and complex input BPMN processes that would be very
hard to solve using a long list of not exactly one-to-one matching services.</p>
          <p>Moreover, the PMR algorithm, if the Yellow Pages repository is huge enough, may produce
several diferent solutions by diferently composing all the existing capabilities. This generates
an even larger number of concrete solutions (the realization of a solution in terms of concrete
capabilities).</p>
          <p>MOISE Organization Definition The last step in the adopted process consists in the actual
definition of the MOISE organization. The main input for that is: 1) the set of goals, 2) the set of
solutions generated by the PMR algorithm and 3) the content of the yellow pages. These are
processed according to the algorithm detailed in the next subsection.
structural-specification
group-specification
subgroups</p>
          <p>APPLY_RULE__ROLE_DEF
formation-constraints</p>
          <p>APPLY_RULE__GROUP_SPEC</p>
          <p>APPLY_RULE__ROLE_COMPATIBILITY
functional-specification
normative-specification</p>
          <p>APPLY_RULE__SCHEME_DEF</p>
          <p>APPLY_RULE__NORM_DEF</p>
        </sec>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. An Algorithm for MOISE Organisation Definition</title>
        <p>The automatic definition of the MOISE organization relies upon the XML template represented
in Figure 7, in which XML elements and rules interleave. The algorithm has been written in
Scala, a language derived by Java but closely integrated with XML. This way a XML rule is
defined as a function that receives some parameter and returns the XML element to be used to
complete the schema.</p>
        <p>For instance, the “role definition rule” is coded as the following Scala function:
def apply_rule__role_def(yp:List[ServiceDescr]): Elem = {
&lt;role-definitions&gt;
{yp.map(service =&gt;
&lt;role id={service.id + "_role"}&gt;</p>
        <p>&lt;extends role="worker"/&gt;
&lt;/role&gt;
)}
&lt;/role-definitions&gt;
}
The function receives a list of Capabilities (extracted from the system Yellow Pages) and returns
a ‘role-definitions’ tag where children are generated from the list of services (yp parameter).
Each service in yp generates (map method) a new ‘role’ xml element extending the ‘worker’
parent role.</p>
        <p>The following function contains the rule for generating the group specification corresponding
to a Solution as generated by the PMR algorithm.
def apply_rule__group_specification(sol: Solution): Elem = {
&lt;group-specification id={get_group_id} min="0"&gt;
{apply_rule__group_roles(sol) ++ apply_rule__group_links(sol)}
&lt;/group-specification&gt;
}
def apply_rule__group_roles(s: Solution): Elem = {
&lt;roles&gt;
&lt;role id="manager" min="1" max="1"/&gt;
{solution.wftasks.map(capability =&gt;
&lt;role id={capability.id + "_role"} min="1" max="1"/&gt;</p>
        <p>)}
&lt;/roles&gt;
}
def apply_rule__group_links(s: Solution): Elem = {
&lt;links&gt;
&lt;link from="manager" to="worker" type="authority"
extends-subgroups="false" bi-dir="false"
scope="intra-group"/&gt;
&lt;link from="worker" to="manager" type="acquaintance"
extends-subgroups="false" bi-dir="false"
scope="intra-group"/&gt;
&lt;/links&gt;
}
Briefly, the rule produces a ‘group-specification’ by applying two sub-rules: the first one is for
generating roles of the group; it is done by looking at the specific tasks of the input solution.
The PMR solution is an assembly of Capabilities which execution ensures full goal satisfaction.
Each of the involved Capabilities produces a new role into the group. Clearly, more agents of
the society could own the same Capability, being able of play that role. The second sub-rule is
to define structural links among these roles.</p>
        <p>An interesting rule is that for generating the scheme, in the functional specification,
corresponding to a Solution.
def apply_rule__scheme(s: Solution): Elem = {
val sol_tree = new SolutionPattern(s)
val opt_tree: Option[WorkflowPattern] = sol_tree.get_tree
if (opt_tree.isDefined) {
val tree : WorkflowPattern = opt_tree.get
val capabilities = get_solution_capabilities(s)
val scheme_id = get_scheme_id
&lt;scheme id={scheme_id}&gt;
{
apply_rule__plan(tree)++
apply_rule__management_mission(scheme_id)++
capabilities.map(c=&gt;apply_rule__mission(c))
}
&lt;/scheme&gt;
} else {
&lt;scheme id={get_scheme_id}&gt;
&lt;/scheme&gt;
}</p>
        <p>
          }
The function uses the SolutionPattern class, responsible of identifying basic workflow patterns[
          <xref ref-type="bibr" rid="ref16">16</xref>
          ]
in the Solution. Figure 8 shows an example of translation applied to Figure 6. The translation
workfow
Seq_1
1
        </p>
        <p>2
algorithm exploits the control-flow perspective of the solution in order to identify some basic
constructs: Sequence patterns, Choice patterns, Loop patterns.</p>
        <p>Sequence Pattern. Description: a ‘sequence’ models consecutive steps in a workflow. Activities
A,B,C represent a sequence if the execution of B is enabled after the completion of A, and, the
execution of C is enabled after the completion of B.</p>
        <p>Identification. The translation algorithm supposes the sequence is the default approach for
implementing a workflow.</p>
        <p>Exclusive Choice Pattern. Description: a point in the workflow where the control may pass to
one among several branches, depending on the evaluation of a condition.</p>
        <p>Identification. The translation algorithm supposes a split exclusive gateway starts an Exclusive
Choice pattern. Branches are identified as possible sequences that terminates either with the
same join exclusive gateway (Simple Merge pattern) or an end event.</p>
        <p>Structured Cycle Pattern. Description: a point in the workflow where one or more activities
can be executed repeatedly.</p>
        <p>Identification. The translation algorithm supposes a join exclusive gateway possibly begins a
loop, whereas it contains a ’before check’ sequence of activities until a split exclusive gateway
that provides at least one exit condition, and a loop condition that begins one or more ’after
check’ sequences that rolling back to the first split gateway.</p>
        <p>Once the SolutionTree has been built (as in Figure 8), the apply_rule_scheme function easily
converts the tree structure into a MOISE ‘scheme’ via goals and plans. This requires the function
below:
def apply_rule__plan(pattern: WorkflowPattern) : Elem = {
pattern match {
case SequencePattern(children) =&gt;
case ActivityPattern(task) =&gt;
val id = task.grounding.capability.id</p>
        <p>&lt;goal id={id}&gt;&lt;/goal&gt;</p>
        <p>It is a recursive rule, that browse the tree structure and incrementally builds the ‘goal/plan’
decomposition. A SequencePattern is translated into a sequence ‘plan’, a ChoicePattern is
translated into a choice ‘plan’, whereas the Structured Cycle Pattern is a bit more articulated
composition of sequences and choices. The exit condition for the recursion is the Activity (i.e.
the leaves of the tree): each activity is translated into a simple ‘goal’ element.</p>
        <p>Just to provide and example, the output of the previous rule application is reported below:</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions and Future Works</title>
      <p>The proposed approach consists in the automatic generation of a MOISE organisation from the
BPMN specification of a business process with the support of a specific tool. The organisation is
conceived to provide system adaptation because it includes several alternative plans (schemes)
for pursuing goals. The approach is complemented by a tool for processing BPMN (XMI) code
and generating the MOISE organization specification code. The approach is based on a few
fundamental steps: 1) the automatic extraction of goals by processing the BPMN activities
and their dependencies, 2) the identification of the initial state for agents execution (and
solutions computation), 3) the extraction of the ontological vocabulary from goal definitions,
4) the calculation of one or more solutions for the achievement of process objectives by using
agents’ capabilities, 5) the generation of a MOISE organization composed of several alternative
schemes, one for each computed solution. Alternative schemes in the agent organization can
be selected according to performance criteria or to overcome a failure thus achieving some
system adaptation. The generation of the organization is supported by a tool that uses well
known workflow patterns to process the input BPMN XMI code and to generate the MOISE
specification.</p>
      <p>The availability of diferent organization’s schemes allows to select the scheme (goal
decomposition tree and set of missions) that provide the best performance, according to the quality
attributes registered in the yellow pages. The approach also allows to replace the scheme that
is in execution with another one, in case of agent/service failures thus obtaining a runtime
adaptation feature.</p>
      <p>So far, the tool supports the whole BPMN 2.0 specification for defining the process, but the
Sub-Process element, that is going to be used to create hierarchical groups. The language for
specifying Capabilities is a proprietary format. Very soon, we will move towards open-access
action specification languages (PPDL for instance). Currently, the tool has some limitations:
1) parallel gateways are understood by the BPMN2Goal parser but not supported in phase
of Goal2MOISE generation; 2) timer/clock events are partially supported because they are
translated into first-logic predicates that require the agent society uses a specific internal
synchronization mechanism.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>P. A.</given-names>
            <surname>Buhler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Vidal</surname>
          </string-name>
          ,
          <article-title>Towards adaptive workflow enactment using multiagent systems</article-title>
          ,
          <source>Information technology and management 6</source>
          (
          <year>2005</year>
          )
          <fpage>61</fpage>
          -
          <lpage>87</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>M. P.</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. N.</given-names>
            <surname>Huhns</surname>
          </string-name>
          ,
          <article-title>Multiagent systems for workflow</article-title>
          ,
          <source>Intelligent Systems in Accounting, Finance &amp; Management</source>
          <volume>8</volume>
          (
          <year>1999</year>
          )
          <fpage>105</fpage>
          -
          <lpage>117</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Ceri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Grefen</surname>
          </string-name>
          , G. Sanchez,
          <article-title>Wide-a distributed architecture for workflow management</article-title>
          ,
          <source>in: Research Issues in Data Engineering</source>
          ,
          <year>1997</year>
          . Proceedings. Seventh International Workshop on, IEEE,
          <year>1997</year>
          , pp.
          <fpage>76</fpage>
          -
          <lpage>79</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A. S.</given-names>
            <surname>Rao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. P.</given-names>
            <surname>Georgef</surname>
          </string-name>
          , et al.,
          <article-title>Bdi agents: from theory to practice</article-title>
          .,
          <source>in: ICMAS</source>
          , volume
          <volume>95</volume>
          ,
          <year>1995</year>
          , pp.
          <fpage>312</fpage>
          -
          <lpage>319</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>D.-S.</given-names>
            <surname>Coalition</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ankolekar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Burstein</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. R.</given-names>
            <surname>Hobbs</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Lassila</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Martin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>McDermott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. A.</given-names>
            <surname>McIlraith</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Narayanan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Paolucci</surname>
          </string-name>
          , et al.,
          <article-title>Daml-s: Web service description for the semantic web</article-title>
          ,
          <source>in: The Semantic Web-ISWC</source>
          , Springer,
          <year>2002</year>
          , pp.
          <fpage>348</fpage>
          -
          <lpage>363</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>O.</given-names>
            <surname>Boissier</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. H.</given-names>
            <surname>Bordini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. F.</given-names>
            <surname>Hübner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Santi</surname>
          </string-name>
          <article-title>, Multi-agent oriented programming with jacamo</article-title>
          ,
          <source>Science of Computer Programming</source>
          <volume>78</volume>
          (
          <year>2013</year>
          )
          <fpage>747</fpage>
          -
          <lpage>761</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>R. H.</given-names>
            <surname>Bordini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. F.</given-names>
            <surname>Hübner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wooldridge</surname>
          </string-name>
          ,
          <article-title>Programming multi-agent systems in AgentSpeak using Jason</article-title>
          , volume
          <volume>8</volume>
          , John Wiley &amp; Sons,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Viroli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Omicini</surname>
          </string-name>
          ,
          <article-title>Programming mas with artifacts</article-title>
          ,
          <source>in: International Workshop on Programming Multi-Agent Systems</source>
          , Springer,
          <year>2005</year>
          , pp.
          <fpage>206</fpage>
          -
          <lpage>221</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>M.</given-names>
            <surname>Hannoun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Boissier</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. S.</given-names>
            <surname>Sichman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Sayettat</surname>
          </string-name>
          ,
          <string-name>
            <surname>Moise:</surname>
          </string-name>
          <article-title>An organizational model for multi-agent systems</article-title>
          ,
          <source>in: Advances in Artificial Intelligence</source>
          , Springer,
          <year>2000</year>
          , pp.
          <fpage>156</fpage>
          -
          <lpage>165</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>M.</given-names>
            <surname>Chinosi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Trombetta</surname>
          </string-name>
          ,
          <string-name>
            <surname>Bpmn:</surname>
          </string-name>
          <article-title>An introduction to the standard</article-title>
          ,
          <source>Computer Standards &amp; Interfaces</source>
          <volume>34</volume>
          (
          <year>2012</year>
          )
          <fpage>124</fpage>
          -
          <lpage>134</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>L.</given-names>
            <surname>Sabatucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Cossentino</surname>
          </string-name>
          ,
          <article-title>Supporting dynamic workflows with automatic extraction of goals from bpmn</article-title>
          ,
          <source>ACM Transactions on Autonomous and Adaptive Systems (TAAS) 14</source>
          (
          <year>2019</year>
          )
          <fpage>1</fpage>
          -
          <lpage>38</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>L.</given-names>
            <surname>Sabatucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Cossentino</surname>
          </string-name>
          ,
          <article-title>Self-adaptive smart spaces by proactive means-end reasoning</article-title>
          ,
          <source>Journal of Reliable Intelligent Environments</source>
          <volume>3</volume>
          (
          <year>2017</year>
          )
          <fpage>159</fpage>
          -
          <lpage>175</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>M.</given-names>
            <surname>Cossentino</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Lopes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Sabatucci</surname>
          </string-name>
          ,
          <article-title>Goal-driven adaptation of moise organizations for workflow enactment</article-title>
          ,
          <source>in: Proc. of the 8th International Workshop on Engineering Multi-Agent Systems (EMAS</source>
          <year>2020</year>
          ),
          <source>National Research Council of Italy</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>Object</given-names>
            <surname>Management</surname>
          </string-name>
          <article-title>Group (OMG), Business Process Model and Notation (BPMN 2.0) by Example</article-title>
          , Available online at https://www.omg.org/cgi-bin/doc?dtc/10-06-02.pdf,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>L.</given-names>
            <surname>Sabatucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Cossentino</surname>
          </string-name>
          ,
          <article-title>From means-end analysis to proactive means-end reasoning</article-title>
          ,
          <source>in: Proceedings of the 10th International Symposium on Software Engineering for Adaptive and Self-Managing Systems (SEAMS)</source>
          , IEEE Press,
          <year>2015</year>
          , pp.
          <fpage>2</fpage>
          -
          <lpage>12</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>W. M. van Der Aalst</surname>
            ,
            <given-names>A. H.</given-names>
          </string-name>
          <string-name>
            <surname>Ter Hofstede</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          <string-name>
            <surname>Kiepuszewski</surname>
            ,
            <given-names>A. P.</given-names>
          </string-name>
          <string-name>
            <surname>Barros</surname>
          </string-name>
          , Workflow patterns,
          <source>Distributed and parallel databases 14</source>
          (
          <year>2003</year>
          )
          <fpage>5</fpage>
          -
          <lpage>51</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>