Title: Integration,%20Thu%2028.6.2001
1Integration, Thu 28.6.2001
G. Falquet, L. Nerima
2Outline
- The AT3 statecharts
- Complements OCL and constraints, packages
- Interfaces between the UML design spaces
- Meta UML
- Extending the UML stereotypes
- UML and databases
- UML and XML
- Public domain tools and ressources
- UML user survey
- Conclusion
3AT3 statechart version 1 the states
4AT3 statechart version 1
5Manage phone calls
- To manage phone calls, the telephone exchange is
equipped with a system which allows the drivers
to give their position by indicating the area in
which they are idle with a vehicle. When a
customer asks for a taxi, the operator assigns
him or her a vehicle located in the area. If no
taxi is in the area, it is necessary to find the
closest vehicle.
Idle
Out of service
Manage calls
Vehicle
Operator
Booked
States
Use case
Objects
6Maintain Vehicle
- An increase in consumption will indicate that the
engine need to be checked. - The mechanics team takes in charge of the
maintenance
Model
MotorOK
Tanking
Maintain vehicle
Vehicle
NeedsChecking
Mechanics
Maintenance
7Vehicle life cycle
Operating
MotorOK
Idle
Out of service
NeedsChecking
Booked
Maintenance
8Object Constraint Language
- Text language to construct expressions for
- guards
- conditions
- pre/post conditions
- assertions
- actions
- Based on navigation expressions, boolean
expressions, queries - Predefined operations on primitive types and sets
of objects - Constraints can be attached to any element
(class, association, attribute, etc.)
9Navigation expressions
- object(s) . attribute
- object(s) . role
- object(s) . operation(arguments)
- object(s) . qualified_association selector
- set -gt set_property
- set -gt select (condition)
- set -gt size
10Examples
(flight.pilot.training_hours gt
flight.plane.min_training
Pilot
AircraftModel
Assignment
pilot
Flight
plane
flight
Booking
flight
passengers
Person
(flight.passengers -gt select(age lt 3)) -gt size lt 5
11Diagram dependencies
includes, extends
Use Cases
State Machine
Classes
perform
instance of
synchronising
Objects
method spec.
Activity
Sequences
Collaborations
Components
placement on nodes
dependencies
instances
Deployment
Objets physiques
12Package
- A package is a general purpose mechanism for
organizing elements into groups - Aim organize a UML model
- A package contains structural things, behavioral
things and other packages - Package nesting results in a tree structure
(analogy file system with folders) - Packaging Control of visibility Control of
the complexity of large numbers of abstractions
13Package graphic representation
- Icon Tabbed folder
- Includes
- package name
- Contents (sometimes)
- Examples
SensorsVision version 2.24
14Package importing
- Example
- Client imports Policies
15Package generalization
- To specify a family of packages
WindowGUI
GUIWindow Form GUIEventHandler VBForm
MacGui
16Meta UML
- Class diagram of all UML elements
- Class, Association, State, State Machine,
Attribute, etc. - Formal (structural) description of the model
- A model to build UML editors and other tools
- A model to represent UML models in a database
17(No Transcript)
18(No Transcript)
19(No Transcript)
20(No Transcript)
21Stereotypes
- An extension mechanism
- Specialise existing UML elements (adding
constraints)
Class
State
ltlt control gtgt Class
ltlt persistent gtgt Class
ltlt critical gtgt State
ltlt document part gtgt Class
22UML and Databases
- Idea store objects in relational databases
- Transformation rules
- Class ? relation
- Attribute ? attribute
- Association ? attribute or relation (depending on
multiplicity) - Operations ? database triggers / procedures /
programming language procedures
23UML and XML
- XML
- XML Schemas
- From XML to UML
- From UML to XML
- Modelling XML applications
- Exchanging UML models
24XML document
- Objective of XML describe the content
(semantics), not the presentation. - Documents
- Made of Elements
- Sub elements (children elements)
- Attributes with Values
- "Schemaless" documents (semi-structured)
- Documents obeying to a schema
25Document Example
- ltexercise difficulty"6"gt
- lttitlegtFinding paths in a graphlt/titlegt
- ltquestiongt
- ltparagtGiven the graph lt/paragt
- lt/questiongt
- ltanswergt There are ... lt/answergt
- lt/exercisegt
26XML Documents are Hierarchical
difficulty 6
exercise
title
answer
question
Finding paths in a graph
There are ...
para
para
para
Given a connected graph with ...
..
Find the ...
27XML Schemas
- To fix a syntax for XML documents
- DTD document type definition (old)
- XML Schemas (new)
- define a class of XML documents
- a document is an instance of a schema
- more flexible than database or class schemas
alternatives, options, free ordering, etc.
28po.xml
- lt?xml version"1.0"?gt
- ltpurchaseOrder orderDate"1999-10-20"gt
- ltshipTo country"US"gt
- ltnamegtAlice Smithlt/namegt
- ltstreetgt123 Maple Streetlt/streetgt
- ltcitygtMill Valleylt/citygt
- ltstategtCAlt/stategt
- ltzipgt90952lt/zipgt
- lt/shipTogt
- ltbillTo country"US"gt
- ltnamegtRobert Smithlt/namegt
- ltstreetgt8 Oak Avenuelt/streetgt
- ltcitygtOld Townlt/citygt
- ltstategtPAlt/stategt
- ltzipgt95819lt/zipgt
- lt/billTogt
-
29po.xml (cont.)
- ltcommentgtHurry, my lawn is going wild!lt/commentgt
- ltitemsgt
- ltitem partNum"872-AA"gt
- ltproductNamegtLawnmowerlt/productNamegt
- ltquantitygt1lt/quantitygt
- ltUSPricegt148.95lt/USPricegt
- ltcommentgtConfirm this is
electriclt/commentgt - lt/itemgt
- ltitem partNum"926-AA"gt
- ltproductNamegtBaby Monitorlt/productName
gt - ltquantitygt1lt/quantitygt
- ltUSPricegt39.98lt/USPricegt
- ltshipDategt1999-05-21lt/shipDategt
- lt/itemgt
- lt/itemsgt
- lt/purchaseOrdergt
30Schema po.xsd
- ltxsdschema xmlnsxsd"http//www.w3.org/2001/XMLS
chema"gt - ltxsdelement name"purchaseOrder"
type"PurchaseOrderType"/gt - ltxsdelement name"comment" type"xsdstring"/gt
- ltxsdcomplexType name"PurchaseOrderType"gt
- ltxsdsequencegt
- ltxsdelement name"shipTo" type"USAddress"/gt
- ltxsdelement name"billTo" type"USAddress"/gt
- ltxsdelement ref"comment" minOccurs"0"/gt
- ltxsdelement name"items" type"Items"/gt
- lt/xsdsequencegt
- ltxsdattribute name"orderDate"
type"xsddate"/gt - lt/xsdcomplexTypegt
31po.xsd (cont.)
- ltxsdcomplexType name"USAddress" gt
- ltxsdsequencegt
- ltxsdelement name"name" type"xsdstring"/gt
- ltxsdelement name"street" type"xsdstring"/gt
- ltxsdelement name"city" type"xsdstring"/gt
- ltxsdelement name"state" type"xsdstring"/gt
- ltxsdelement name"zip" type"xsddecimal"/gt
- lt/xsdsequencegt
- ltxsdattribute name"country"
type"xsdNMTOKEN" fixed"US"/gt - lt/xsdcomplexTypegt
32- ltxsdcomplexType name"Items"gt
- ltxsdsequencegt
- ltxsdelement name"item" minOccurs"0"
maxOccurs"unbounded"gt - ltxsdcomplexTypegt
- ltxsdsequencegt
- ltxsdelement name"productName"
type"xsdstring"/gt - ltxsdelement name"quantity"gt
- ltxsdsimpleTypegt
- ltxsdrestriction base"xsdpositiveInteger
"gt - ltxsdmaxExclusive value"100"/gt
- lt/xsdrestrictiongt
- lt/xsdsimpleTypegt
- lt/xsdelementgt
- ltxsdelement name"USPrice"
type"xsddecimal"/gt - ltxsdelement ref"comment"
minOccurs"0"/gt - ltxsdelement name"shipDate"
type"xsddate" minOccurs"0"/gt - lt/xsdsequencegt
- ltxsdattribute name"partNum" type"SKU"
use"required"/gt - lt/xsdcomplexTypegt
33From XML Schemas to UML
- Situation an XML schema has been adopted
- Objective
- to build applications that process this type of
XML data - Use UML to model the application
- Need to represent XML data (elements) as UML
objects - Mapping XML schemas to UML class model
34Mapping technique Booch et al.
- Add class stereotypes
- elementtype, sequence, choice, enumeration,
scalar, ... - Add attribute / unidirectional association
stereotypes - implied, required, ...
- Element or datatype --gt class with stereotype
- XML attribute --gt attribute / unidirectional
association
35UML for Document Modelling
- Difficult to design good XML schemas
- --gt
- Use UML to model the domain
- Produce a class diagram
- Then create a suitable XML schema
Person firstName lastName
Project title
Manager
Participant
Department name ...
36An XML Schema
- ltxsdelement name"project"gt
- ltxsdcomplexTypegt
- ltxsdsequencegt
- ltxsdelement name"title"
type"xsdstring"/gt - ltxsdelement name"manager"
type"PersonType"/gt - ltxsdelement name"participant"
type"PersonType - minOccurs"1" maxOccurs"unbounded"/gt
- lt/xsdsequencegt
- lt/xsdcomplexTypegt
- lt/xsdelementgt
- ltxsdcomplexType name"PersonType"gt
- ltxsdsequencegt
- ltxsdelement name"firstName"
type"xsdstring"/gt - ltxsdelement name"lastName"
type"xsdstring"/gt - ltxsdelement name"department"
type"xsdstring"/gt - lt/xsdsequencegt
- lt/xsdcomplexTypegt
37Objects --gt XML Document
- ltprojectgt
- lttitlegtRestructuring the Worldlt/titlegt
- ltmanagergt
- ltfirstNamegtJoelt/first-namegt
- ltlastNamegtCoollt/last-namegt
- ltdepartmentgtToyslt/departmentgt
- lt/managergt
- ltparticipantgt ... lt/participantgt
- ltparticipantgt ... lt/participantgt
- ltparticipantgt ... lt/participantgt
- lt/projectgt
38Issues
- Many possible mappings from UML to XML
- Class --gt complex or simple type
- Define elements or types
- Associations --gt
- Inclusions (ltprojectgt ltmgrgt lt/mgrgt
lt/projectgt) - References (ltproject mgr"p3456"gt ...)
- etc.
- "Solution" fix a reverse mapping
39XML for Information Interchange
- System modelled with UML
- Create an XML schema to represent all data
- Export data in XML format
- Import XML data into another system
- Web browser
- Presentation generator (PDF, ...)
- Graphics generator
40A Book
- Modeling XML Applications with UML Practical
e-Business Applications - David Carlson
- Addison-Wesley Object Technology Series
41Exchanging UML models
- There exist an XML schema for expressing UML
models (XMI) - --gt UML specifications are open and exchangeable
- UML tools (diagram editors, code generators,
pretty printers, ) should be able to read/write
UML specs in XML
42OMG survey on using the UML
- Date 2000
- Questions
- What constructs in the language are most used ?
- What constructs in the language are most used ?
- What parts of the language need clarification ?
- What parts of the language should be removed ?
43OMG survey on using the UML
- Most used Least used Need
clarification - Class diagrams gt 8
- sequence diagram 7-8
- use cases 7-8
- state charts 5-6 gt 8
- stereotypes and tagged values 1-2
- Package 1-2
- implementation diagrams 3-4 3-4
- collaboration diagrams 3-4 7-8 3-4
- activity diagram 0 gt 8 1-2
- model management- except package 0
1-2 1-2 - Component 0 1-2 3-4
- pattern 0 1-2
44OMG survey on using the UML (cont)
- Most used Least used Need
clarification - class, type, interface,classifier role,
component 0 1-2 1-2 - whole-part relationships 0 3-4
45What parts of the language should be removed?
- UML standard profiles 3-4
- Notes in semantics section 1-2
- Standard elements without abstract semantics 1-2
46Application in industry
- Level of usage ( 1 5 )
- Class and package 5 most used
- use case 3 depend on the culture. Less
interesting for some fields. - sequence 3 quite often used, well understood
- collaboration 2 object diagram used, but
collaboration modeling marginal - statecharts 2 strong usage in real time
applications, rarely used in the sevice
industries - activity 1 introduced late in the environments,
local cultural habit in some sectors of the
sevice industries - component/deployment 1 only few people use it, on
a few parts of their applications
47Conclusion
- We presented almost all the features of the UML !
(omitting details) - Modeling is important
- Model in several dimensions to have a
comprehensive and complete view of your system - Next exercice on a small but real application
(in your domain of course) - Start with the diagrams you feel confortable with
- Practice structural AND dynamic modeling
- we hope you learned some valuable information
on the UML ?