You can also access this tutorial in German and French.

In this video we talk about defining your own data types in YAWL. These are defined using XML Schema Definition (XSD). We also demonstrate how to access parts of complex types using XQUERY. The zip file below contains an initial and a final YAWL specification and an XSD file.

 

Welcome back to another YAWL tutorial! Today, we will talk about data and data types. Data is one of the most complex topics in Business Process Management Systems. When it comes to data types, different systems take different approaches: some Business Process Management Systems just work without any types. So you can input anything into the fields. Other Business Process Management Systems allow you to define a small set of very simple types that are proprietary and made especially for the purpose of Business Process Management. YAWL has a different approach here. YAWL uses XML, XML schema definition and Xpath and Xquery. One advantage is that you can find lots of information on the Internet about XML and all the surrounding technologies. Another advantage is that there are many APIs and software libraries that can for example translate XML elements into java objects and then java objects into relational database tables. We start from an XML schema definition and then demonstrate how that XML schema definition takes effect in the forms that are generated by the YAWL system. So let's dig into it! Today's tutorial is about types. So in XML, types are called a schema and XML schema definition - XSD abbreviated - is something that we will start with. So if you look at the file here - you can find this in the supplementary material - you can see that there is a number of complex and simple types defined. If you want to know more about the details, as already said, there are many tutorials on this on the Internet for example by the w3c schools and many others. So here you can see a complex type called customer list type and this is essentially a list of customer type elements. Customer type is a type that consists of a customer id which is a positive integer, a customer category, a customer name, and an email. The first three types are standard XML schema types as you can see from the prefix xs. And the last one is a type that we define here. The email address type is defined here and this is a restriction on the XSD standard type token, which is a subset of string and you can see here a regular expression. So if you want to know what this regular expression means, you can look up on the Internet looking for regular expressions in XML schema definition and just to note one thing: for example the at-sign of the email address appears here. The other type that we have is a category type abc. So this will create a drop down list. And then we also have an email address list type. Now let's take this type definition and copy it to a new YAWL specification.

So we select all that, copy that, go to the yard editor, and start a new YAWL specification. And we go to data definitions here and we paste that in here and if it says ok, then the syntax is correct. So now, we start editing our workflow. So we insert two tasks: first one is called "Edit customer list" and the second one is called "Check email addresses".

Now we define our net variable. Go to data variables and call this "Customer_list". And this is of type customer list type and we can give this an initial value. So if we click here on the three dots and we press this double circle here, the system generates an XML element that is correct for this type. You see, there is one customer with a customer id, customer category, a name, and an email address that corresponds to our regular expression. And I will replace that by two customers with email addresses and everything correct. So now we have a list of two customers here and this is the variable that is initialized at the beginning. If we go to the customer list task, we just drag this variable in here. So we can edit it later on. Nothing needs to be changed.

And now what I want to do is, I just want to show you how to access parts of the complex types and we will do a more complicated example with an Xquery. The Xquery is here.

So what we want to do is, we want to look inside the customer list, take the content of that customer list/*, and then return for each element in the customer list, an email element, where the content of the email element is the email address, the text of it, this is the email address itself, of the customer list element.

So copy that and now we go to the "Check email address" and we create a new variable here: email addresses and this is of the email address list type. And we make that an input variable. And now we have to define the mapping because the editor cannot find it automatically and we insert this Xquery here. So we go to the control center and look at the admin queues and we can see that "Edit customer list" is unoffered. So we assign it to the same user. And we can see the customer list is displayed here. And we can add other customers or we can edit the fields of each customer so we complete that. And then check email addresses. And you can see that the email addresses are displayed and they are in read-only mode. The Xquery was a little complex, wasn't it? But don't worry, it doesn't get any more technical than that in YAWL. If you want to develop software and you have to connect to other systems, this is done by software developers and in YAWL there are codelets for this purpose. Codelets will be the topic of another tutorial in the future. Thank you for watching!

Supplement_5.zip (4.96 KB)