Title: OCL Prime
1OCL Prime
- A Simple UML-conformant Evolution Language
- Jörn Guy Süß
- Computation and Information Structures, TU Berlin
- CIS-AG
- EN 719
- November 21, 2009
2OCL Prime Talk
3Whats driving MDA?
4Motivation
- Enhance model based development
- Allow maintenance of large models
- MDA does not provide solution (yet)
???
5Objectives
- consistent model to model mapping
- UML Conformity (to avoid Training)
- Simplicity to allow Practice (KISS!)
ERR9437 GRGLHLZ Type Inference failed for assert
in p-gtq-gt!p!. Expression is non-strict. L23C12
Begin GRGLHLZ Define p quantor(alla).use\a.a-gt
isgreen\ With(p) Do End GRGLHLZ
6Model2Model
- UML Profiles OCL
- Trigger for Evolution
- Integrity Protection
- Cycle Validate-Evolve-Validate
- Validator
7UML Profiles OCL Forward Process
Deductive
Analysis
. . .
A
A
Design
D
. . .
D
Profile consistency
Profile consistency
Creative
Code Doc.
. . .
C
C
Software
. . .
S
S
8UML Profiles OCL Reverse Process
Deductive
Analysis
. . .
A
A
Design
D
. . .
D
Profile consistency
Profile consistency
Creative
Code Doc.
. . .
C
C
Software
. . .
S
S
9Trigger for Evolution
Deductive
Analysis
. . .
A
A
PreconditionTrue?
Design
D
. . .
D
Profile consistency
Profile consistency
Creative
Code Doc.
. . .
C
C
Software
. . .
S
S
10Cycle Validate-Evolve-Validate
Deductive
Analysis
. . .
A
A
Manipulation
Design
D
. . .
D
Profile consistency
Profile consistency
Creative
Code Doc.
. . .
C
C
Software
. . .
S
S
11Profile Validator Activity
Deductive
Analysis
. . .
A
A
Manipulation
Profile 2 constraints
Design
D
. . .
D
Profile 1 constraints
Profile consistency
Profile consistency
Creative
UML constraints
Code Doc.
. . .
C
C
Software
. . .
S
S
12Implementation Options
13Model Scripting Host
- High Flexibility
- "Pure" Component Integration
- Large Number of Components
- Low Component Reliability
- "Non-existent" user community
- "Strong reject"
14Document Transformation
- Few Well-Standardized Components
- "Purely" functional programs
- XMI is graph, not tree
- Horrific programming
- Small user community
- "Weak reject"
XSLT
XMI
XMI
15OCL extended for Manipulation
- OCL is part of standard
- Approch accepted in community
- Only small extensions required
- Some components available
- OCL is ugly/wordy language
- "Weak accept"
16OCL Prime
- Name First Derivative (time)
- 90 OCL for Selection
- 10 SQL-DML for Manipulation
- Transactional
- Adaptable to all MOF Models (UML 2.0)
17Selection
- (Multiple) assignment Expressions using "let
in" - No Time-Expressions (Pre, Post)
- No Feature-Calls (side-effect-free methods)
18Manipulation
- INSERT adds model elements by Value Assigns
values from literals or variables - UPDATE changes model elements / relations by
reference Cannot alter Identity - DELETE Drops model elements by identity Can
affect several classes of the meta-model - Values OCL Types
- Targets OCL-Path-Names
19Values
- Basic (Literal)
- Element Reference (Collection/Navigation)
- Collections Homogenous / Heterogenous (Elements
of one/several Classes)All Homogenous
Collections Reduce to Sets
20Transactionality
- Several Transactions in a file
- Transactions may be hierarchical
- Transaction must provide timeout
- Closures "While Precondition holds do" ...
- Closures run to completion
21Implementation Idea
- OCL-Interpreter
- JMI-Repository
- Attributed Graph Grammar System (AGG)
22(No Transcript)
23(No Transcript)
24(No Transcript)
25- letExpression "let" ltnamegt ( " pathTypeName
)? "" expression "in" - expression letExpression logicalExpression
- ifExpression "if" expression "then" expression
"else" expression "endif" - logicalExpression relationalExpression (
logicalOperator relationalExpression ) - relationalExpression additiveExpression (
relationalOperator additiveExpression )? - additiveExpression multiplicativeExpression (
addOperator multiplicativeExpression ) - multiplicativeExpression unaryExpression (
multiplyOperator unaryExpression ) - unaryExpression ( unaryOperator
postfixExpression ) postfixExpression - postfixExpression primaryExpression ( ("."
"-gt") featureCall ) - primaryExpression literalCollection literal
pathName "(" expression ")" ifExpression - literal ltstringgt ltnumbergt "" ltnamegt
- enumerationType "enum" "" "" ltnamegt ( ","
"" ltnamegt ) "" - literalCollection collectionKind ""
expressionListOrRange? "" - expressionListOrRange expression ( ( ","
expression ) ( ".." expression ) )? - featureCall pathName
- pathTypeName lttypeNamegt ( "" lttypeNamegt )
- pathName ( lttypeNamegt ltnamegt ) ( "" (
lttypeNamegt ltnamegt ) ) - logicalOperator "and" "or" "xor"
"implies" - collectionKind "Set" "Bag" "Sequence"
"Collection"
26Use of Graph Grammars
ltltcompgtgtCalc
PIM
ltltEJBgtgtCalc
PSM
27Use of Graph Grammars
ltltcompgtgtCalc
PIM
ltltEJBgtgtCalc
PSM
28Use of Graph Grammars Host Graph
Oid 1
Select Name C Type CompCalc
Oid 2
Oid 3
Oid 4
29Use of Graph Grammars Rule LHS / RHS
Select Name C Type CompCalc
Name X
Name X Type Remote
Select Name C Type CompCalc
Name X
Name X Type Home
30Open Issues
- Type Checking
- Compexity of AGG-Connector
- Closure Operation Useful?
31Forward Reverse Process
Deductive
Analysis
. . .
A
A
Design
D
. . .
D
Profile consistency
Profile consistency
Creative
Code Doc.
. . .
C
C
Software
. . .
S
S
32OCL Prime
- A Simple UML-Conformant Evolution Language
- Jörn Guy Süß
- Computation and Information Structures, TU Berlin
- Dissertations-Kolleg
- FhG ISST, Berlin
- November 21, 2009
33A Method in UML Defining Domain Stereotypes
UML
Node
UseCase
Class
Component
34A Method in UML Defining Constraints
UML
Node
UseCase
Class
Component
Class 1 If a Class is concrete, all the
Operations of the Class should have a realizing
Method in the full descriptor. not
self.isAbstract implies self.allOperations-gt
forAll (op self.allMethods-gtexists (m
m.specification-gtincludes(op)))
35A Method in UML Defining Transformations
UML
Node
UseCase
Class
Component
36Queries, Views and Transformations in UML
- Motivation Semi-Automatic Maintenance of large
OO-Models? Enable MDATM Transformation is
currently undefined!OMG has begun defining QVT
in MOF 2.0, but ... ? Proposed languages lack
usability - Objectives Allow consistent Model-to-Model
mappingReuse common standards - minimize
trainingKeep solution open to UML 2.0 and
MOFProvide formal language model
37OCL Prime - A QVT Language
- Name From First Derivative in Physics (Time)
- Languages used 90 OCL for Selection 10
SQL-DML for Manipulation Graph-Grammars or Set
Theory considered as Foundation - Components used OCL-Interpreter (TU
Dresden) AGG-Toolkit (TU Berlin) or
JDBC/SQL-Engine JMI-Repository (Sun NetBeans
MDR) - Advantage Adaptable to all MOF Models (including
UML 2.0)
38A Working Example inspired by Jansson95
Task Create Interfaces for all Use Cases that do
not have Extension Points and Stereotype them as
Boundary
39A Working Example inspired by Jansson95
Task Create Interfaces for all Use Cases that do
not have Extension Points and Stereotype them as
Boundary
package example context UseCase def let
ucsNonExtSet(UseCase) self.allInstances-gtsele
ct(uc uc.extensionPoint-gtsize() 0) let
stBoundaryStereotype Stereotype.allInstances-
gtselect(st st.Name "Boundary") endpackage
INSERT INTO Interface (Name) SELECT Name FROM
ucsNonExt UPDATE Interface SET stereotype
stBoundary WHERE Name In ucsNonExt.Name
OCL
SQL
40Anatomy of OCLPrime Types / Selection
- Based on OCL-Type System
- ModelType (MM Class)
- Basic (Literal) String, Real, Int, ...
- Element Reference (Collection/Navigation)
- Homogenous / Heterogenous Collections
- Selection
- (Multiple) assignment Expressions using "def" and
"let in" - No Time-Expressions (Pre, Post)
- No Feature-Calls (side-effect-free methods)
41Anatomy of OCLPrime Manipulation
- Manipulation
- INSERT Adds model elements
- UPDATE Changes model elements / relationsCannot
alter Identity - DELETE Drops model elements by identityCan
affect several classes of the meta-model - Targets OCL-Path-Names
- WHERE Provides Equi-Join
- Considerations
- SELECT for reports
- Transactions for Multi-User Repositories
- Closures "While Precondition holds repeat this"
42Transformation Pitfalls and the Validation Cycle
Deduction
Analysis
. . .
A
A
Manipulation
Design
D
. . .
D
MM consistency
MM consistency
Code Doc.
. . .
C
C
Software
. . .
S
S
43Profile and Metamodel Consistency
Deduction
Analysis
. . .
A
A
Manipulation
Profile 2 constraints
Design
D
. . .
D
Profile 1 constraints
Profile(s) MM consistency
Profile(s) MM consistency
UML constraints
Code Doc.
. . .
C
C
Software
. . .
S
S
44Application in Forward Reverse Processes
45Status Progress of Dissertation
? Language 30 UML ProfileUse Cases, Message
Types, Simple Transformations ? Method 10 UP
for Messaging, QVT ? Tool(s) 40 EVE,OCL
Prime, ADAM ? Field Test 0 -
46Current Implementation Status
- Select OCL-Interpreter (TU Dresden)
- ManipulationAttributed Graph Grammar System
(AGG) (TU Berlin)Alternative JDBC-compliant
RDBMS - Model JMI-Repository (NetBeans MDR)
47Use of Graph Grammars in Implementation
LHS, Selecthere PIM
ltltcompgtgtCalc
RHS, Manipulationhere PSM
ltltEJBgtgtCalc
48Model Scripting Host
- High Flexibility
- "Pure" Component Integration
- Large Number of Components
- Low Component Reliability
- "Non-existent" user community
- "Strong reject"
49Document Transformation
- Few Well-Standardized Components
- "Purely" functional programs
- XMI is graph, not tree
- Horrific programming
- Small user community
- "Weak reject"
XSLT
XMI
XMI
50OCL extended for Manipulation
- OCL is part of standard
- Approch accepted in community
- Only small extensions required
- Some components available
- OCL is ugly/wordy language
- "Weak accept"
51(No Transcript)
52(No Transcript)
53(No Transcript)
54- letExpression "let" ltnamegt ( " pathTypeName
)? "" expression "in" - expression letExpression logicalExpression
- ifExpression "if" expression "then" expression
"else" expression "endif" - logicalExpression relationalExpression (
logicalOperator relationalExpression ) - relationalExpression additiveExpression (
relationalOperator additiveExpression )? - additiveExpression multiplicativeExpression (
addOperator multiplicativeExpression ) - multiplicativeExpression unaryExpression (
multiplyOperator unaryExpression ) - unaryExpression ( unaryOperator
postfixExpression ) postfixExpression - postfixExpression primaryExpression ( ("."
"-gt") featureCall ) - primaryExpression literalCollection literal
pathName "(" expression ")" ifExpression - literal ltstringgt ltnumbergt "" ltnamegt
- enumerationType "enum" "" "" ltnamegt ( ","
"" ltnamegt ) "" - literalCollection collectionKind ""
expressionListOrRange? "" - expressionListOrRange expression ( ( ","
expression ) ( ".." expression ) )? - featureCall pathName
- pathTypeName lttypeNamegt ( "" lttypeNamegt )
- pathName ( lttypeNamegt ltnamegt ) ( "" (
lttypeNamegt ltnamegt ) ) - logicalOperator "and" "or" "xor"
"implies" - collectionKind "Set" "Bag" "Sequence"
"Collection"
55Why I do not use ObjectZ, Predicate Logic, etc.