Title: XML Data and Process Modelling
1XML Data and Process Modelling
- Fall 2005
- Thomas Hildebrandt
- Programming, Logic and Semantics Group, ITU
2Road Map
- Why XML ?
- XML data model, XML Namespaces, XMLSchema
- XML Business Process ModelsWF and Com.
patterns, the case of BPEL
3Why XML?
- Models used for communication and
interoperability by humans and programs - inter-business and inter-application
- XML the de facto standard for tailor-made
specifications of (semi) structured data
collections shared and exchanged between humans
and programs - support for internationalisation (unicode) and
platform independence (text based)
4XML very briefly
- XML eXtensible Markup Language
- a merge of Hypertext languages and Markup
Languages (SGML) - text markup tagsltgreeting stylebiggthello
worldlt/greetinggt - a specific XML language constrains the use of tags
5Recipe Example
- semi-structured mix of tags and unstructured
text
6Ordered trees
The underlying data model of XML is that of
ordered, node labelled trees
7Node types
- text nodes
- element nodes
- attribute nodes
- comment nodes
- processing instruction nodes
- root nodes
8XML recipe collection as tree
9Textual representation
- properly nested, case sensitive tags
- attributes in-lined in start element
- predefined entities written as Unicode character
references (e.g. lt as lt) - comments as lt!-- .... --gt
- usually begins with an XML declarationlt?xml
version1.0 encodingUTF-8?gt
10Applications of XML
- data-oriented (e.g. replacing relational DB)
- document-oriented (e.g. XHTML)
- protocols and programming languages (e.g.
XMLSchema, XSLT, WSDL, SOAP, BPEL4WS ) - hybrids (e.g. the RecipeML language)
11XML Namespaces
- The XML namespaces mechanism allows one to
combine XML languages - ltexample xmlnsfoohttp//www.itu.dk/people/hilde
/myfoospace xmlnshttp//www.itu.dk/people/hild
e/mydefspacegtltfoofooelementgtlt/foofooelementgtlt
/examplegt
12Formal Language Specification
- needed for computers/programs to understand the
language - Consists of the Syntaxthe set of valid
sentences and the Semanticsthe meaning of the
valid sentences - Often only syntax is specified formally...
13Syntax
- Natural languages and programming languages are
usually specified by a grammar (e.g. in
Backus-Naur Form) - Examples the 40-year old program Eliza, PASCAL,
Algol 60 programming language - Data collections are usually described by
so-called schemas (e.g. databases and XML)
14Schema languages
- A Schema/grammar can be described in a
Schema/grammar language - A schema processer/parser isused to validate
(and normalize)a document
15Why Schemas/grammars?
- Humans write documents that programs can parse
and give meaningful error messages to invalid
docs - Why use standard schema language Standard
parsers, program generation, ... - Schema language should be expressive, efficient
and comprehensive
16XMLSchema
- Plenty of XML Schema languages, but DTDs and
XMLSchema by far the most common - XMLSchema is the most expressive of the two (and
is itself an XML language) - both uses regular expressions as subgrammar
17Regular expressions
- Build from symbols, ?, sequencing, and
- Very effective (linear time, constant space)
- Very comprehensive
- Limited expressiveness Correspond to finite
automata, that is, finite memory and thus can not
express that a begin tag should be matched by an
end tag
18XMLSchema overview
- Namespace declarations
- Simple type definitions
- Complex type definitions
- Element declarations
- Attribute declarations
19Student Records
ltschema xmlns"http//www.w3.org/2001/XMLSchema"
xmlnss"http//www.brics.dk/ixwt/students
" targetNamespace"http//www.brics.dk/ix
wt/students"gt ltelement name"student"
type"sStudentType"/gt ltattribute name"id"
type"string"/gt ltattribute name"score"
type"sScore"/gt ltsimpleType name"Score"gt
ltrestriction base"integer"gt ltminInclusive
value"0"/gt ltmaxInclusive value"100"/gt
lt/restrictiongt lt/simpleTypegt ltcomplextType
name"StudentType"gt ltattribute ref"sid"
use"required"/gt ltattribute ref"sscore"
use"required"/gt lt/complextTypegt lt/schemagt
Definitions and declarations populate the target
namespace
20Simple type examples
- The student record example contains both
primitive types and derived types ltattribute
name"id" type"string"/gtltattribute name"score"
type"sScore"/gtltsimpleType name"Score"gt
ltrestriction base"integer"gt ltminInclusive
value"0"/gt ltmaxInclusive value"100"/gt
lt/restrictiongtlt/simpleTypegt
21Derived types
- Patterns (regular expressions)ltsimpleType
name"percentage"gt ltrestriction base"string"gt
ltpattern value"(0-91-90-9100)"/gt
lt/restrictiongtlt/simpleTypegt - EnumerationltsimpleType name"passnonpass"gt
ltrestriction base"string"gt ltenumeration
value"passed"/gt ltenumeration value"not
passed"/gt lt/restrictiongtlt/simpleTypegt - UnionltsimpleType name"mark"gtltuniongtltsimpleTypegt
ltrestriction base"passnonpass"/gtlt/simpleTypegtltsi
mpleTypegtltrestriction base"percentage"/gtlt/simpleT
ypegtlt/uniongtlt/simpleTypegt
22XMLSchema declarations
lt?xml version"1.0"?gt ltstudent xmlns"http//www.b
rics.dk/ixwt/students"
xmlnsxsi"http//www.w3.org/2001/XMLSchema-instan
ce" xsischemaLocation"http//www.brics.
dk/ixwt/students
http//www.itu.dk/courses/IXMR/student.xsd"gt
id"hilde071072" score"97" lt/studentgt
- associates a Schema to an XML document
- may appear at sub-elements
23Complex Types
- Complex types allow to specify elements and
attributes as content of elementsExample with
only attributesltelement name"student"
type"sStudentType"/gtltcomplexType
name"StudentType"gt ltattribute ref"sid"
use"required"/gt ltattribute ref"sscore"
use"required"/gtlt/complexTypegt - elements as content may be specified by a regular
expression? Element reference ltelement
ref"t..." cardinality /gt? Concatenation
ltsequencegt ... lt/sequencegt? Union ltchoicegt ...
lt/choicegtand cardinalities minOccurs, maxOccurs
"0","1","..", "unbounded"(default
cardinalities are 1)
24ltelement name"order" type"norder_type"/gt lteleme
nt name"email" type"nemail_type"/gt ltattribute
name"id" type"unsignedInt"/gt ltcomplexType
name"order_type" mixed"true"gt ltchoicegt
ltelement name"address"gt ltsequencegt
ltelement name"street" type"string"/gt
ltelement name"number" type"positiveInteger"/gt
ltelement name"floor" type"string"/gt
lt/sequencegt lt/elementgt ltsequencegt
ltelement ref"nemail"
minOccurs"0" maxOccurs"unbounded"
default"no email provided"/gt ltelement
name"phone" type"nphone_type"/gt
lt/sequencegt lt/choicegt ltattribute ref"nid"
use"required"/gt ltattribute name"priority"
default"normal"gt ltsimpleTypegt ltrestriction
base"string"gt ltenumeration value"normal"/gt
ltenumeration value"high"/gt lt/restrictiongt
lt/simpleTypegt lt/attributegt lt/complexTypegt
25XML Summary
- de facto standard for tailor-made semi-structured
data collections shared on the internet - use namespaces to combine XML languages
- use XMLSchema to specify syntax
formally,expressive - tends to be
incomprehensible
26Business Process Modeling(design and execution)
- Web services compositionacross organizational
boundaries - Technology push
- Need to improve efficiency
- BPEL4WS v1.1 Schemahttp//xml.coverpages.org/BPE
L4WSv11-Schema-xsd.html
27BPEL overview
- Process PartnerLinks variables flowchart of
activities - Primitive activities invoke, receive, reply,
wait, assign, throw, terminate, empty - Structured activities sequence, flow, while,
switch, pick, scope
28WF Patterns in BPEL
- Sequencing, Parallel Split Synchronisation
- Exclusive Choice and Simple Merge
ltsequencegt ltflowgt lt!-- activityA1 --gt
lt!-- activityA2 --gt lt/flowgt lt!-- activity
B --gt lt/sequencegt
ltsequencegt ltswitchgt ltcase conditionC1gt
lt!-- activityA1 --gt lt/casegt ltcase
conditionC2gt lt!-- activityA2 --gt
lt/casegt lt/switchgt lt!-- activity C
--gt lt/sequencegt (Example of condition
getVariableData(status)rejected )
29- Multi-Choice and Synchronizing Merge(using the
WSFL features)
30- Cycles (using while loops)
- More detailed example (multible instances)
ltwhile conditionCgt ltsequencegt lt!--
activityA --gt lt!-- update condition data
--gt lt/sequencegt lt/whilegt
ltvariable namei typexsdinteger/gt ...
ltassigngtltcopygtltfrom expression0/gtltto
variablei/gtlt/copygt lt/assigngt ltwhile
conditionbpwsgetVariableData(i) !5gt
ltsequencegt ltinvoke .../gt ltassigngt
ltcopygtltfrom expressionbpwsgetVariableData(i)
1/gt ltto variablei/gt
lt/copygt lt/assigngt lt/sequencegt lt/whilegt
31- Multiple Instances with Synchronisation
32- Deferred Choice (using pick)
- Cancel Activity Using fault and compensation
handlers - Cancel Case ltterminate/gt action
ltpick namemessageortimeoutgt ltonMessage
partnerLink.. ...gt lt!-- activityA --gt
lt/onMessagegt ltonAlarm forPT10Dgt lt!--
activityB --gt lt/onAlarmgt lt/pickgt
33Patterns not directly supported in BPEL
- WP8 Multi-merge
- WP17 Interleaved Parallel Routing
- WP18 Milestone
34Communication Patterns
- Synchronous CommunicationRequest/reply and
One-way (empty reply) - Asynchronous CommunicationMessage passing no
outputContainer - No direct support for publish/subscribe nor
broadcast
35BPEL conclusions
- Anchored in the web services world
- Mix of flow/graph and control structures
- Expressive, perhaps too expressive
- Formalisation could provide precise semantics
- Not the only proposal (BPML, XPDL, WSCL,..
36Course Evaluation
- Please spend the time... we do listen to your
comments!!