# ML Wiki

## YAWL

YAWL is a graphical notation for expressing workflows, similar to Workflow Nets based on Petri Nets, but with more expressive syntax.

It is possible to express the following constructions:

• choices
• timeouts
• etc

## Basic Syntax

Syntax in YAWL looks similar to Petri Nets

• but there is syntactic sugar that makes it easier and more expressive
• and there also is some relaxation of the rules

### AND

AND-split:

AND-join

• note that the semantics of the AND-join in YAWL is the same:
• both places need to have tokens for $d$ to fire

### XOR

XOR-split

• need to put some code to the XOR-split node: so it will decide which way to follow
• (don't confuse with Deferred Choice)

XOR-join

• semantics is the same: $d$ can fire if there's a token in either place

### Loops

While-loop

• based on the condition in the XOR-split it either continues or stops
• it was not possible to express that in Workflow Nets

Repeat-loop

• until the condition in the XOR-split is not satisfied, $B$ will not be enabled

### Start and Stop

There's also a special notation for start and stop places

### Transitions

Transitions in YAWL can be connected directly, without a place within them

• but there still is an implicit invisible place between such transactions
• if there's a place between transitions, it means that one is done, but the other has not started

Transitions in YAWL are no longer atomic

• in YAWL now you cannot assume that they fire immediately: they may need some time to do the task
• so in essence, one transition in YAWL correspond to two transitions in a Petri Net and one place between them

### Exercise

• what are the valid firing sequences? what activities can be performed in parallel?
• first, let's explicitly show the invisible places and name all the places
• now we can build some kind of a Reachability Graph (here we don't consider places inside the transactions)
• but in this case, unlike in Petri Nets, firing one transition can lead to several states
• in this example firing $B$ may bring to 3 different states, depending on what arch it will take
• we see that this network in not sound:
• it has no option to complete in several cases
• it has improper termination
• the highlighted edges lead to the final state
• thus the valid firing sequences are:
• $ABCD$
• $ABCEFG$
• $ABCFEG$
• $ABCFEG$
• $ABCCEFG$
• $ABCCFEG$
• note that, for instance, $ABCCEFG$ may correspond to two different paths in the reachability graph
• based on that it's clear that $E$ and $F$ can run in parallel

### Cancellation Regions

Main Article: Cancellation Regions

### OR-Split and OR-Join

#### OR-Split

OR-split is similar to XOR-split

• but instead of taking one route, it can take many

Example

• suppose we're buying a flight ticket and offered 2 additional options: hotel and car
• the branches to active depend on what exactly you have selected
• and the OR-split should be programmed to route in the needed directions
• the system can fire many tokens, but there's one restriction: there must be at least one token

Note that

• OR-split is just syntactic sugar
• it can be expressed with AND-splits and XOR-splits

#### OR-Join

OR-Join is used to synchronize many incoming branches

It has the "bus driver" semantics

• OR-Join is activated only when all tokens are ready to be consumed
• a bus driver will wait for people to jump in when he sees that people are still coming

We should handle OR-joins

• this semantics can be computationally quite expensive
• some decision properties may suddenly become unavailable
• if complicates the model

Example

• if there are still tokens to arrive, the OR-join will wait for them
• once everybody is ready - it fires

Consider the following net:

• in this example none of the OR-joins can fire
• there hypothetically can be more tokens to arrive
• so they are waiting
• no Option to Complete

#### Examples

• case (a):
• $C$ is enabled: it's a XOR join
• and $D$ is enabled: it's not possible to get a token from another branch
• case (b):
• $C$ is working, but it can be started again: it's enabled since there's another token
• $D$ is not enabled: it will be only when $C$ finishes its work
• case (c):
• $A$ is already running
• $C$ is enabled (here it's the same situation as in the case (a))
• but $D$ is not enabled: there's in a token inside $A$, which may arrive from the branch below
• case (d):
• $C$ enabled
• but $D$ is not enabled: there's a token before $C$ that may arrive

### Sub-Nets

To increase readability it's possible to fold some activities to one

• this concept is called a sub-net
• a subnet must also be a valid net - with its own start and stop places

## Data

It is possible to store some variables in the YAWL engine

• to keep the results of execution, etc

Data can be stored at different levels (i.e. scopes)

• process level - global
• case level - related to this particular case
• i.e. data for each case is different
• task level - most local

We don't need to transfer data from activity to activity

• there's a single data storage that will keep it

TODO

TODO

## YAWL Option to Complete

YAWL's option to complete is different from the option to complete property of Workflow Nets

YAWL-OTC:

• for every reachable marking $M$ we can reach the final marking $[o]$
• so this is a combination of Option to Complete and Proper Termination
• unfortunately YAWL-OTC is not always decidable, therefore it's sometimes still better to use the definition of the Option to (improperly) Complete

## Examples

### Example 2: Travel Agency

To organize a trip

• the customer request is registered
• then an employee looks for opportunities
• the customer is contacted to find out whether he is still

interested and whether more alternatives are desired

• if the customer selects a trip, then the trip is booked.
• in parallel (optionally) one or two types of insurance are prepared
• two weeks before the start date the documents are sent to the customer
• it is possible that the customer cancels the trip at any time before the start date

It is also possible to use OR-join for choosing the insurances:

### Example 3: Homework Submission

An exercise for modeling from the resource perspective:

### Example 4: Four Dining Philosophers

The same net as in Petri Nets: