INF5120 Modellering med Objekter 06.05.2004
1
1ICT – Information and Communication Technologies
INF5120”Modellering med objekter”
Forelesning 06.05.2004
Arne-Jørgen Berre
2ICT – Information and Communication Technologies
Forelesnings- & øvingsplan
Forelesningsplan18.03: Brian Elvesæter, “COMET Business & Requirements Modelling”25.03: Jan Øyvind Aagedal, “Non-functional requirements”01.04: Jan Øyvind Aagedal, “Component Modelling - OCL”15:04: Brian Elvesæter, “COMET Architecture & PSM Modelling”22.04: Arne-Jørgen Berre, “UML Fever og UML 2.0, Patterns og Refactoring”29.04: Birger Møller Pedersen,Øystein Haugen, “UML 2.0 – ATM Example”06.05: Arne J. Berre, “MDA, OMG MOF og QVT Transformations” 13.05: Arne J. Berre, “Summary –Preparation for exam on June 1st”
Øvingsplan18.03: Gruppe 9 & 21, “Use Case Model”25.03: Gruppe 17 & 22, “Business Model (part I)”01.04: Gruppe 3, “Business Model (part II)”15.04: Orakeltime for oblig 2 – send inn spørsmål på forhånd (Brian)22.04: Gruppe 4, “Architecture Model”
29.04: Orakeltime for oblig 2 (Sinan)
06.05: oblig 2 - gjennomgang (Sinan)
13.05: Tidligere eksamensoppgaver(Sinan)
INF5120 Modellering med Objekter 06.05.2004
2
3ICT – Information and Communication Technologies
OMG Model-Driven Architecture (MDA)
www.omg.org/mda
4ICT – Information and Communication Technologies
Dagens tema (MDA, MOF, XMI, Transformasjoner, QVT)
OMG MDAOMG MOFOMG XMIOMG CWMMDA Explained – transformationsOMG QVT (QVT Merge Group proposal per April 2004)
Pensum, Eksamen, Oppsummering neste gang
INF5120 Modellering med Objekter 06.05.2004
3
5ICT – Information and Communication Technologies
Dagens tema (fra MDA Explained)
7: More on Transformations8: Metamodeling9: Defining your own transformations10: Rosa’s transformation definitions11: OMG Standards and additional technologies12: The MDA promise
Revised submission for MOF 2.0 Query/View Transformations RFP – version 1.0 (by QVT-Merge Group) – chapter 1, 2, 5
6ICT – Information and Communication Technologies
Functionality in future MDA environment
INF5120 Modellering med Objekter 06.05.2004
4
7ICT – Information and Communication Technologies
Complete MDA Framework
8ICT – Information and Communication Technologies
Roles in an MDA process(participants, tools artifacts)
INF5120 Modellering med Objekter 06.05.2004
5
9ICT – Information and Communication Technologies
OMG Metamodeling Architecture
Modeled systems,Warehouse data
Object, data
M0
UML models, Warehouse/BI metadata
Model, metadata
M1
UML Metamodel,CWM Metamodel
Metamodel, meta-metadata
M2
MOF Model (UML)Meta-metamodelM3
ExamplesOMG termsMeta-level
10ICT – Information and Communication Technologies
Overview oflayers M0 – M3
INF5120 Modellering med Objekter 06.05.2004
6
11ICT – Information and Communication Technologies
MOF Metamodel
12ICT – Information and Communication Technologies
OMG Model Driven ApproachUML as the standard language for defining metamodelsXMI as the standard mechanism for interchanging metadata in XMLMOF to IDL Mapping as the standard mechanism for accessing metadata in CORBA
MOF to Java Mapping (JMI) as the standard mechanism for accessing metadata through Java
INF5120 Modellering med Objekter 06.05.2004
7
13ICT – Information and Communication Technologies
XMI
XML Metadata Interchange
An XML vocabulary forinterchanging metadata
in software systems.
14ICT – Information and Communication Technologies
XMI Overview
Specify a precise MOF to XML mappingEnables automatic generation of XML documents that can be validated with generated DTDsAllows interchange of any MOF based metamodel and corresponding models/metadata
CWM metamodelCWM based metadata
INF5120 Modellering med Objekter 06.05.2004
8
15ICT – Information and Communication Technologies
Mapping of MOF compliant metamodels to XML DTDs (XMI 1.0) and XML Schemas (XMI 2.0)
DTD provide standard representation of metamodelE.g., MOF DTD; UML DTD, CWM DTD
XML Schema provides more extensive standard representation of metamodel
E.g., MOF xsd; UML xsd, CWM XSD
16ICT – Information and Communication Technologies
Mapping of MOF compliant models/metadata to XML documents
Transmit and interchange metadata that conforms to the metamodel
E.g., IBM_Relational.xml(-> CWM DTD)
XML document that conforms to MOF DTD/Schema is a preferred representation of metamodel
E.g., UML XML, CWM XML
INF5120 Modellering med Objekter 06.05.2004
9
17ICT – Information and Communication Technologies
XMI DTDs (or schemas)and Documents
DTD
Doc
DTD
Doc
DTD
Doc
MOF
UML/CWM Java C++, IDL Relational
Database
Model/Metadata
.java,
.class.c, .h, .idl, .obj, .dll
Schema (columns)
Instances Instances Instances Data (row)
18ICT – Information and Communication Technologies
XMI Mapping
ClassObject typed attributeContainmentReferenceBasic attribute (int, String)
MOF ConceptXML element, IDXML elementXML elementXML attribute, IDREFXML attribute, CDATA
XML Concept
INF5120 Modellering med Objekter 06.05.2004
10
19ICT – Information and Communication Technologies
XMI Example: UML Model
Convertible
Carmakemodel
drive()
Personownerowns<Class name="Car">
<Class.ownedElements><Attribute name="make"/><Attribute name="model"/><Operation name="drive"/>
</Class.ownedElements></Class>
CarModel.xml
20ICT – Information and Communication Technologies
<XMI xmi.version="1.1" xmlns:uml="org.omg/uml1.3" ><XMI.header>
<XMI.documentation>An example of an auto.
</XMI.documentation><XMI.metamodel name="UML" version="1.3"
href="uml1.3.xmi" /><XMI.model name="Cars" version="1.0" />
</XMI.header><XMI.content>
<Class name=" Car"><Class.ownedElements>
<Attribute name=" make"/><Attribute name=" model"/><Operation name=" drive"/>
</Class.ownedElements></Class>
</XMI.content></XMI>
content
header(optional)
INF5120 Modellering med Objekter 06.05.2004
11
21ICT – Information and Communication Technologies
Convertible
Carmakemodel
drive()
Personownerowns<!element Car><!attlist Car
xmi.id id #impliedmake cdata #implied model cdata #impliedowner idref #implied>
<!element Person><!attlist Person
xmi.id id #implied owns idref #implied>
Car.dtdCar.dtd
XMI Example: UML Instance
22ICT – Information and Communication Technologies
<Car xmi.id="4ABC123" make="Ford" model="Mustang" owner="John Doe"/><Person xmi.id="John Doe" owns="4ABC123"/>
Car.xmlCar.xml
INF5120 Modellering med Objekter 06.05.2004
12
23ICT – Information and Communication Technologies
The CWM Metamodel
WarehouseProcess
WarehouseOperation
Transformation
XMLRecord MultiDimensionalRelational
BusinessInformation
Core
Management
Resource
Analysis
Object
Foundation
OLAP Data Mining
InformationVisualization
BusinessNomenclature
ObjectModel Behavioral Relationships Instance
DataTypes Expressions Keys
IndexType
MappingSoftware
Deployment
CWM - Common Warehouse Model
24ICT – Information and Communication Technologies
The CWM MDA
CWMSpecification
CWMMetamodel(in UML Notation)
CWM Metadata
Access
CWM IDL/CWM Java*
CWM DTDCWM
Metadata Interchange
(in XML)
CWM XML
MOF DTD/Schema
INF5120 Modellering med Objekter 06.05.2004
13
25ICT – Information and Communication Technologies
ER -- Stereotypes & TaggedValues
Class(from Core)
<<Entity>>Association
(from Relationships)
<<Relationship>>AssociationEnd(from Relationships)
<<RelationshipEnd>>KeyRelationship(from KeysIndexes)
<<ForeignKey>>
Classifier(from Core)
<<Domain>>Model(from Core)
Index(from KeysIndexes)
<<NonuniqueKey>>Attribute(from Core)
Package(from Core)
<<SubjectArea>>UniqueKey
(from KeysIndexes)
<<PrimaryKey>>
Subsystem(from Core)
<<ModelLibrary>>
/owner /feature
*{ordered} *
TaggedValueupdateTag = “update : ExpressionNode”
TaggedValueinsertTag = “insert : ExpressionNode”
TaggedValuedeleteTag = “delete : ExpressionNode”
TaggedValuevalidationTag = “validationRule : ExpressionNode”
TaggedValuedefaultTag = “default : ExpressionNode”
Stereotypes change class
names
TaggedValuesadd attributes
But can’t add associations
or other semantic details!
26ICT – Information and Communication Technologies
CWM Transformations
Central means for managing data warehouse metadata in CWMMotivate activities of the Management layer
Warehouse ProcessesWarehouse Operations
SupportsTechnology layeringLogical evolutionDrill-down operations Repetitive administration tasks
INF5120 Modellering med Objekter 06.05.2004
14
27ICT – Information and Communication Technologies
Transforming versus Mapping
BusinessModel
BusinessModel
DatabaseSchema
DatabaseSchema
Data Data
Conceptual
Logical
Physical
Transform
Transform
Transform
Map
Map
Map
Map
Logical Evolution
Technology Layering
Use TransformationMap
Use TransformationActivity
28ICT – Information and Communication Technologies
Using CWM Transformations
ER Logical Model
Record Model Relational Model
TransformationMap TransformationMap
TransformationActivity
INF5120 Modellering med Objekter 06.05.2004
15
29ICT – Information and Communication Technologies
Transformation MapsTransformationMap
/ classifierMap : ModelElement(f rom Transforma ti on)
Classi fierMap
function : ProcedureExpressionfunctionDescription : String/ source : Classifier/ target : Classifier/ transformationMap : Namespace/ featureMap : FeatureMap/ cfMap : ClassifierFeatureMap
(from Transformation)
0..1
*
/namespace0..1
/ownedElement*
Classifier(from Core)
* 1..** source 1..*
* 1..** target 1..*
FeatureMap
function : ProcedureExpressionfunctionDescription : String/ source : Feature/ target : Feature/ classifierMap : ClassifierMap
(from Transformation)
0..1
*
0..1
*
Feature(from Core)
* 1..** target 1..*
* 1..** source 1..*
ClassifierFeatureMap
function : ProcedureExpressionfunctionDescription : StringclassifierToFeature : Boolean/ classifier : Classifier/ feature : Feature/ classifierMap : ClassifierMap
(from Transformation)
0..1
*
0..1
*
cfMap
*
1..*
cfMap
*
1..*
*
1..*
cfMap*
1..*
30ICT – Information and Communication Technologies
source
target
source target
Map Logical Model To Record
source target
source target
source target
source target
Logical model
Product : Entity
UPC : Attribute
Name : Attribute
Size : Attribute
Brand : Attribute
Category : Attribute
Product : RecordDef
ProductFile : RecordFile
c:\products.dat : DataManager
UPC : Field
Name : Field
Size : Field
Brand : Field
Category : Field
Record model
Transformation Maps link logical and physical models
MapLogicalToRecord : TransformationMap
: ClassifierMap
: FeatureMap
: FeatureMap
: FeatureMap
: FeatureMap
: FeatureMap
INF5120 Modellering med Objekter 06.05.2004
16
31ICT – Information and Communication Technologies
: TransformationActivity
: TransformationStep
: TransformationTask
: Transformation
: Transformation
: Transformation
: Transformation
: Transformation
: DataObjectSet
: DataObjectSet
: DataObjectSet
: DataObjectSet
: DataObjectSet
: TransformationUse
: TransformationUse
: DataObjectSet
: DataObjectSet
: DataObjectSet
: DataObjectSet
: DataObjectSet
MoveValue : Operation
FKValue : Operation
Map Record To Relational
ProductDB : Schema
(local) : Catalog
Size : Column
UPC : Column
Name : Column
Product : Table
CategoryID : Column
Company : Table
ID : Column
Category : Table
ProductPK : PrimaryKey
CompanyPK : PrimaryKey
CategoryPK : PrimaryKey
CategoryFK : ForeignKey
CompanyFK : ForeignKey
CompanyID : Column
Name : Column
Name : Column
ID : Column
Product : RecordDef
ProductFile : RecordFile
c:\products.dat : DataManager
UPC : Field
Name : Field
Size : Field
Brand : Field
Category : Field
Record Model Transformation Activity Relational Model
32ICT – Information and Communication Technologies
Map ER Model To Relational
ER model
P roduc t : E ntity
UP C : A ttribute
Nam e : A ttribute
S iz e : A ttribute
B rand : A ttribute
Category : A t tribute
ProductDB : Schema
(local) : Catalog
Size : Column
UPC : Column
Name : Column
Product : Table
CategoryID : Column
Company : Table
ID : Column
Category : Table
ProductPK : PrimaryKey
CompanyPK : PrimaryKey
CategoryPK : PrimaryKey
CategoryFK : ForeignKey
CompanyFK : ForeignKey
CompanyID : Column
Name : Column
Name : Column
ID : Column
Relational model
MapLogicalToRecord : TransformationMap
: ClassifierMap
: FeatureMap
: FeatureMap
: FeatureMap
: FeatureMap
: FeatureMap
Transformation map
INF5120 Modellering med Objekter 06.05.2004
17
33ICT – Information and Communication Technologies
UPC Name Size Comp’yCateg’y111222111223112223112222
File: c:\products.dat
On disk
Met
adat
a st
ore
Using CWM Transformations
ER Logical Model
Record Model Relational Model
TransformationMap TransformationMap
TransformationActivity
Move Data
CWM-enabled Data Movement Utility
Metadata
DataData
Data
34ICT – Information and Communication Technologies
OMG QVT standardisation- general for MOF (Extending and replacing the specific CWM Transformations)
From: QVT-Merge Group
Revised submission for MOF 2.0 Query/Views/Transformations RFP
Proposal for transformation architecture and both visual and textual syntax
April 2004
Ref: document at INF5120 Web site
INF5120 Modellering med Objekter 06.05.2004
18
35ICT – Information and Communication Technologies
Transformations and MDA
36ICT – Information and Communication Technologies
An expanded PIM to PSM Transformation
INF5120 Modellering med Objekter 06.05.2004
19
37ICT – Information and Communication Technologies
A high level transformation
38ICT – Information and Communication Technologies
Concrete syntax
INF5120 Modellering med Objekter 06.05.2004
20
39ICT – Information and Communication Technologies
A high level transformation being refinedby a directed mapping
40ICT – Information and Communication Technologies
Transformations, Relations and Mappings
Transformationspecification (test cases)
Transformationimplementation
INF5120 Modellering med Objekter 06.05.2004
21
41ICT – Information and Communication Technologies
General relation in textual form
42ICT – Information and Communication Technologies
Relation in graphical form
INF5120 Modellering med Objekter 06.05.2004
22
43ICT – Information and Communication Technologies
Relation example
Expressions and constraints using OCL syntax
44ICT – Information and Communication Technologies
Mapping example
INF5120 Modellering med Objekter 06.05.2004
23
45ICT – Information and Communication Technologies
Proposed Methodology
46ICT – Information and Communication Technologies
Transforming a UML Attribute into an XML element
INF5120 Modellering med Objekter 06.05.2004
24
47ICT – Information and Communication Technologies
Transformation diagram with relation
48ICT – Information and Communication Technologies
Instance of relation
INF5120 Modellering med Objekter 06.05.2004
25
49ICT – Information and Communication Technologies
Textual version
50ICT – Information and Communication Technologies
Mapping which refines relation
}}
INF5120 Modellering med Objekter 06.05.2004
26
51ICT – Information and Communication Technologies
Key concepts of Transformations
52ICT – Information and Communication Technologies
Visual notation – transformation/pattern
INF5120 Modellering med Objekter 06.05.2004
27
53ICT – Information and Communication Technologies
Visual notation – relation and mapping between patterns
54ICT – Information and Communication Technologies
Visual notation – transformation composition
INF5120 Modellering med Objekter 06.05.2004
28
55ICT – Information and Communication Technologies
Visual notation – pattern match
56ICT – Information and Communication Technologies
Relational Mapping Example
From MDA Explained – chapter 10
From QVT Example
INF5120 Modellering med Objekter 06.05.2004
29
57ICT – Information and Communication Technologies
Simple UML Metamodel
58ICT – Information and Communication Technologies
Simplified UML Metamodel
INF5120 Modellering med Objekter 06.05.2004
30
59ICT – Information and Communication Technologies
Simple RDBMS Metamodel
60ICT – Information and Communication Technologies
Simplied SQL Metamodel
INF5120 Modellering med Objekter 06.05.2004
31
61ICT – Information and Communication Technologies
Transformation – Class to table (MDA Explained)
62ICT – Information and Communication Technologies
Transformation – Association class to table
INF5120 Modellering med Objekter 06.05.2004
32
63ICT – Information and Communication Technologies
Class to Table transformation (QVT)
64ICT – Information and Communication Technologies
Class to Table transformation
INF5120 Modellering med Objekter 06.05.2004
33
65ICT – Information and Communication Technologies
Association to foreign key transformation
66ICT – Information and Communication Technologies
QVT - Tools
(OptimalJ has (non-standard) support for transformations,with transformation language and patterns
(Architect edition)
INF5120 Modellering med Objekter 06.05.2004
34
67ICT – Information and Communication Technologies
OpenMDX – Open source MDA
68ICT – Information and Communication Technologies
OpenMDX, levels of platform-independence
INF5120 Modellering med Objekter 06.05.2004
35
69ICT – Information and Communication Technologies
70ICT – Information and Communication Technologies
UMLAUT/MTL (http://modelware.inria.fr)
QVT ImplementationLanguage: MTL
Integrates with differentrepositories
Netbeans MDR MOFEclipse EMFModFact repository
class MyTransformation{
run (){
attributeIterator : Standard::Iterator;anAttribute : source_model::Core::Attribute;
attributeIterator := !source_model::Core::Attribute!.allInstances().getNewIterator();attributeIterator.start();while attributeIterator.isOn() {
anAttribute := attributeIterator.item().oclAsType (!source_model::Core::Attribute!);……
INF5120 Modellering med Objekter 06.05.2004
36
71ICT – Information and Communication Technologies
ModFact (http://modfact.lip6.fr)
MOF RepositoryCORBA and JMI Interfaces
QVT EngineSimpleTRL language
72ICT – Information and Communication Technologies
UML Model Transformation Tool (UMT)
Open source tool for code generation from UML modelsReads UML models via XMI from a UML tool
Rational Rose, Together, ArgoUML, Poseidon, ObjecteeringUses Java and XSLT to generate code
EJB, Servlets, WSDL, XML schema, IDL, SQLEasy to plug in new generators (scripts) or adapt existing onesGraphical environment to install generators and run themSupports structural models (class models) and process models (activity diagrams)http://sourceforge.net/projects/umt-qvtFrom SINTEF
INF5120 Modellering med Objekter 06.05.2004
37
73ICT – Information and Communication Technologies
Kodegenereringsmotor for Javabasert på attributtorientert programmering for Javabruker spesielle JavaDoc tags for å legge til semantikk til kildefilerbegynte som EJB-kodegenereringsmotor – sees nå som en generell kodegenerator (med fokus på J2EE)Støtter mange av de ledende applikasjonstjenerne
JBoss, BEA WebLogic, IBM WebSphere, Oracle IAS, Orion, Borland, MacroMedia JRun, Jonas
Integrert med AntXDoclet tasks defineres i ant, f.eks. EjbDoclet eller WebDoclet
www.xdoclet.org
74ICT – Information and Communication Technologies
Scenario: From UML to J2EE
«BusinessServiceSpec»Repository Services
«Service»AssetManagement
+o1()-name : string(idl)
«Entity»Asset
1 *
«Entity»Type
*
*
design
XMI
Export
Code gen
UMT code generation tool
EJB 2.x code and Servlets with Xdoclet tags, ant build files
EJB CMP, Value objects, Home,
Remote, deployment descriptors ...
Deploy &
run
INF5120 Modellering med Objekter 06.05.2004
38
75ICT – Information and Communication Technologies
Scenario: UML-modell
AssetProperty<<entity>>
name : stringtype : stringdescription : string
Asset<<entity>>
name : stringdescription : stringkeywords : stringowner : string
0..1
0..*
+parent0..1
+children0..*
0..*
+properties
0..*
AssetType<<entity>>
name : stringdescription : string
0..*0..*
+assets
0..*
+type
0..*
AssetManagement<<service>>
testOperation()
0..*+assets
0..*
<<manages>>
0..*0..*
+assetTypes0..*0..*
<<manages>>
<<manages>>
76ICT – Information and Communication Technologies
Scenario: UMT – code generation
INF5120 Modellering med Objekter 06.05.2004
39
77ICT – Information and Communication Technologies
Scenario : Generert kode<<entity>>
Asset<<entity>>AssetType
<<entity>>AssetProperty
UML classes
EJB SessionBeans
<<service>>AssetManagement
AssetManagementEJBAbstract.javaAssetManagementEJBImpl.java
Java EJB EntityBeansAssetEJB|AssetTypeEJB|AssetPropertyEJB|..|.java
Xdoclet generation
UMT generation
AssetManagementHome.javaAssetManagementRemote.java
AssetManagementUtil.java
Asset<x>CMP.javaAsset<x>Value.javaAsset<x>LightValue.javaAsset<x>Local.javaAsset<x>LocalHome.javaAsset<x>PK.java
For each Entity x
Deployment descriptors
ejb-jar.xmlapplication.xmljboss.xmlJbosscmp-jdbc.xml
build.xml RepositoryServlet.java
Servlet test client
UML classes
Web deployment descriptors
web.xmljboss-web.xml
78ICT – Information and Communication Technologies
Pensum INF5120 – Vår 2004
MDA Explained + Hele boka (163 sider)
The Rational Unified Process an introduction, kapittel 1, 2, 8, 9, 10, 11, 17 (98 sider)
COMET Handbook 2.4, side 11-83, (72 sider)
Forelesnings handouts
“Åpen bok” eksamen - ref. Oblig oppgaver
INF5120 Modellering med Objekter 06.05.2004
40
79ICT – Information and Communication Technologies
MDA Explained (Alle kapitler)1: The MDA Development Process2: The MDA Framework3: MDA Today
4: Rosa’s Application of MDA5: Rosa;s PIM to three PSMs6: Rosa’s PSMs to Code7: More on Transformations8: Metamodeling9: Defining your own transformations10: Rosa’s transformation definitions11: OMG Standards and additional technologies12: The MDA promise
A: Glossary B: The Code for Rosa’s system
80ICT – Information and Communication Technologies
The Rational Unified Process1: SW Development Best Practices (16)2: The Rational Unified Process (16)3:Static structure: Process description 4: Dynamic structure: Iterative Development5: An Architecture-centric Process6: A Use-cased Driven Process7: The PM Discipline8: The Business Modeling Discipline (15)9: The Requirements Discipline (14)10: The Analysis and Design Discipline (11)11: The Implementation Discipline (9)12: The Test Discipline13: The Configuration and change Discipline14: The Environment Discipline15: The Deployment Discipline16: Typical Iteration plans17: Implementing RUP (12)A: Roles, B: Artifacts, C: AcronymsPensum: 32 + 49 + 12 = 93 sider RUP
INF5120 Modellering med Objekter 06.05.2004
41
81ICT – Information and Communication Technologies
COMET – Methodology Handbook
(Berre/Aagedal/Elvesæter/…) – new version 2.4 April 2004
1: Introduction to COMET2: COMET Overview3: Business Modeling4: Requirements Modeling5: Architecture Modeling6: Platform-Specific Modeling (72 sider)
7. App A-H Appendices (Ikke pensum)
82ICT – Information and Communication Technologies
UML 1.4/1. 5 and UML 2.0
UML Background and Reference materialhttp://www.omg.org/uml/ (UML)http://www.omg.org/mda/ (MDA)http://www.omg.org/cwm/ (MOF, XMI, CWM)UML 2.0 referanse (ref. forelesning)
Supporting litterature:UML book 1: UML Distilled - Third edition w/UML 2.0UML book 2: Applying UML and patternsUML book 3: UML and Unified Process
antas kjent
INF5120 Modellering med Objekter 06.05.2004
42
83ICT – Information and Communication Technologies
Eksamen
Case-basert oppgave (ref. tidligere eksamen)Alle skriftlige hjelpemidler er tillatt
09-12 –, tirsdag 1 . juni
Eksempler diskuteres neste uke, torsdag 13/5