Title: MODELOG
1MODELOG Model-Oriented Development with
Executable Logical Object Generation
- Franklin Ramalho
- Universidade Federal de Pernambuco
- PhD candidate
- Jacques Robin
- Advisor
ORCAS Group
2Outline
- 1 Introduction and Motivation
- 2 MDE and OMG Languages
- 3 OOLP
- 4 MODELOG
- 5 Case Study
- 6 Related Works
- 7 Conclusions
3Introduction
- Initial role of UML (Unified Modeling Language)
- Visual notation for high-level blueprints in
Object-Oriented Software Engineering (OOSE) - Standard, intuitive, expressive, extensible, many
CASE tools available. - New roles for UML
- Model-Driven Engineering
- Abstract visual syntax for meta-modeling
- Low-level specification language for fully
automated code generation - Formal specification language for formal
verification. - Knowledge-level representation language for
- Autonomous agents and multi-agent systems (MAS)
- Semantic web service for knowledge management and
intelligent information retrieval
4Introduction
- Extensions to the UML
- OCL (Object Constraint Language)
- MOF (Meta-Object Facility)
- XMI (XML Metadata Interchange)
- UML Profiles
- Formal Semantics for UML and OCL
- AUML (Agent UML).
5Motivation
6MODELOG
- MODELOG goal
- Address all 5 new application areas of UML by
single automated mapping - From UML2 class diagram w/ OCL2 structural
constraints and behavior specifications - To executable, Turing-complete, programming
language with formal semantics
MODELOG
7Outline
- 1 Introduction and Motivation
- 2 MDE and OMG Languages
- 3 OOLP
- 4 MODELOG
- 5 Case Study
- 6 Related Works
- 7 Conclusions
8Model-Driven Engineering
Current Standard Practice Object-Oriented
Development
UML NL Application Requirements
UML Model
Mix 2 orthogonal concerns business refinement
and translation to platform
Source Code
Virtual Machine Code
Binary Code
9Model-Driven Engineering
Todays MDE Extreme Modeling
10Model-Driven Engineering
Tomorrows MDE UML Programming
11MDE Languages
Aplicação
12Source models UML and OCL
13(No Transcript)
14Outline
- 1 Introduction and Motivation
- 2 MDE and OMG Languages
- 3 OOLP
- 4 MODELOG
- 5 Case Study
- 6 Related Works
- 7 Conclusions
15Target Model Sequential Transaction Frame Logic
(STFL)
Classical First Order Logic
16A STFL Program
Acctwithdraw(Amt) - Acctbalance-gt Bal ? Bal
Amt ? Acctchange_balance( Bal, Bal -
Amt). Accdeposit(Amt) - Acctbalance-gt Bal ?
Acctchange_balance( Bal, Bal
Amt). Acctchange_balance( Bal1, Bal2) -
btdeleteAcctbalance-gtBal1 ?
btinsertAcctbalance-gt Bal2. transfer( Acct1,
Acct2, Amt) - Acct1withdraw(Amt) ?
Acct2deposit(Amt). buy(Client, Seller, Cost) -
transfer(Client, acc5, 0,5 Cost) ?
transfer(Client, Seller Cost). acc1balance-gt50,
owner-gtphilip. acc2balance-gt600,
owner-gtdaniel. acc3balance-gt1200.
owner-gtroger. acc4balance-gt10,
owner-gtmary. acc5balance-gt5000,
owner-gtbroker. ?- buy(acc3, acc4, 500).
17STFL Denotational Semantics
Frame Logic
HiLog
First Order Predicate Logic
DefiniteLogic
Normal Logic
SequentialTransaction Logic
18STFLP Semantics Data Oracles
Od(D0) M0 Od(D1) M1 Od(D2) M2 Od(D3)
M3 Od(D4) M4 Od(D5) M5 Od(D6) M6 Od(D7)
M7 Od(D8) M8 M0 acc1balance-gt50,
acc1owner-gtphilip, acc2balance-gt600,
acc2owner-gtdaniel,
acc3balance-gt1200, acc3owner-gtroger,
acc4balance-gt10, acc4owner-gtmary,
acc5balance-gt5000, acc5owner-gtbroker M1
acc1balance-gt50, acc1owner-gtphilip,
acc2balance-gt600, acc2owner-gtdaniel,
acc3owner-gtroger, acc4balance-gt10,
acc4owner-gtmary, acc5balance-gt5000,
acc5owner-gtbroker M2 acc1balance-gt50,
acc1owner-gtphilip, acc2balance-gt600,
acc2owner-gtdaniel, acc3balance-gt1175,
acc3owner-gtroger, acc4balance-gt10,
acc4owner-gtmary, acc5balance-gt5000,
acc5owner-gtbroker
19STFLP Semantics Transition Oracles
Ot(D0, D1) btdeleteacc3balance-gt1200 Ot(D1,
D2) btinsertacc3balance-gt1175 Ot(D2, D3)
btdeleteacc5balance-gt5000 Ot(D3, D4)
btinsertacc5balance-gt5025) Ot(D4, D5)
btdeleteacc3balance-gt1175 Ot(D5, D6)
btinsertacc3balance-gt675 Ot(D6, D7)
btideleteacc4balance-gt10 Ot(D7, D8)
btinsertacc4balance-gt510 Ot(D0, D2)
acc3change_balance(1200, 1175),
acc3withdraw(25) Ot(D2, D4)
acc5change_balance(5000, 5025),
acc5deposit(25) Ot(D0, D4) transfer(roger,
broker, 0,5 500) Ot(D4, D6)
acc3change_balance(1175, 675) ,
acc3withdraw(500) Ot(D6, D8)
acc4change_balance(10, 510),
acc4deposit(500) Ot(D4, D8) transfer(roger,
mary, 500) Ot(D0, D8 buy(roger, mary, 500)
20Outline
- 1 Introduction and Motivation
- 2 MDE and OMG Languages
- 3 OOLP
- 4 MODELOG
- 5 Case Study
- 6 Related Works
- 7 Conclusions
21MODELOGs Approach
ATL
Flora
UML OCL
22Flora Metamodel
23MODELOG Modules
MODELOG
Class Diagram Transformations Module
OCL Transformations Module
24MODELOG Modules
Class Diagram Transformations Module
Class Transformations Module
Attribute Transformations Module
Operation Transformations Module
Generalization Transformations Module
Dependency Transformations Module
Realization Transformations Module
Association Transformations Module
25MODELOG Modules
OCL Transformations Module
Constraint Transformations Module
Derive Transformations Module
Invariant Transformations Module
Post-Condition Transformations Module
Body Transformations Module
OCL Expressions Transformations Module
IFExp Transformations Module
LiteralExp Transformations Module
VariableExp Transformations Module
CallExp Transformations Module
LetExp Transformations Module
26Class Diagrams Transformation
1 convexPolygon. 2 convexPolygonright gt
void. 3 atomicPolygon. 4 atomicPolygonconvexP
olygon. 5 triangle. 6 triangleatomicPolygon.
7 trianglehypotenuse gt segmentLine 8
triangleside gtgt segmentLine. 9
segmentLine. 10 segmentLinelength gt float.
27ATL Transformation
1 module ClassTransformations 2 create OUT
Flora from IN UMLOCL 3 rule Class2Flora 4
from c UMLOCL!Class 5 using allStereotypes
Sequence(UMLOCL!Stereotype) c.stereotype
6 to 7 class Flora!SubClassFAtom(
subClass lt- subClass), 8 subClass
Flora!Symbol( 9 ground lt- true, 10 name lt-
c.name ), 11 att Flora!AttributeSignatureSpeci
fication ( 12 feature lt-
umlLabel, 13 host lt- hostLabel, 14 inheritable
lt- true, 15 multiplicity lt- Flora!MultiplicityKin
dsingle, 16 type lt- typeLabel), 17
umlLabel Flora!Symbol( name lt- 'uml'), 18
hostLabel Flora!Symbol( name lt- c.name), 19
typeLabel Flora!Symbol(name lt- 'umlMeta'), 20
umlClassInstance Flora!InstanceFAtom ( 21
object lt- objectLabel, 22 floraClass lt-
classLabel), 23 objectLabel Flora!Symbol(name
lt- thisModule.getOid(c.name, 'umlClass')), 24
classLabel Flora!Symbol( name lt-
'umlClass'), 25 umlMetaInstance
Flora!InstanceFAtom ( 26 object lt-
umlMetaObject, 27 floraClass lt-
umlMetaClass), 28 umlMetaObject
Flora!Symbol(name lt- thisModule.getOid(c.name,
'umlMeta')), 29 umlMetaClass Flora!Symbol(
name lt- 'umlMeta'),..
7 class Flora!SubClassFAtom( subClass lt-
subClass), 8 subClass Flora!Symbol( 9 ground
lt- true, 10 name lt- c.name ),
28Class Diagrams Transformation
1 convexPolygon. 2 convexPolygonright gt
void. 3 atomicPolygon. 4 atomicPolygonconvexP
olygon. 5 triangle. 6 triangleatomicPolygon.
7 trianglehypotenuse gt segmentLine 8
triangleside gtgt segmentLine. 9
segmentLine. 10 segmentLinelength gt float.
29ATL Transformation
- 1 module AttributeTransformations
- 2 create OUT Flora from IN UMLOCL ...
- 13 rule Attribute2Flora
- 14 from
- 15 a UMLOCL!Attribute
- 16 using
- 17 Oid_umlAttr String thisModule.new('umlA
ttr') ... - 20
- 21 to
- 22 att Flora!AttributeSignatureSpecification
( - 23 feature lt- featureLabel,
- 24 host lt- hostLabel,
- 25 inheritable lt- true,
- 26 multiplicity lt- a.getMultiplicity()
, - 27 type lt- attTypeLabel),
- 28 featureLabel Flora!Symbol(name lt-
a.name), - hostLabel Flora!Symbol(name lt-
a.owner.name), - attTypeLabel Flora!Symbol(name lt-
a.type.name) - ...
30Class Diagrams Transformation
1 convexPolygon. 2 convexPolygonright gt
void. 3 atomicPolygon. 4 atomicPolygonconvexP
olygon. 5 triangle. 6 triangleatomicPolygon.
7 trianglehypotenuse gt segmentLine 8
triangleside gtgt segmentLine. 9
segmentLine. 10 segmentLinelength gt float.
31Invariant Transformation
/ OCL invariant specification / context class
inv inv_name OCLExp
/ Flora code / violated_inv_name(Self) -
Selfclass and naf (OCLExp)
32Derive Transformation
/ OCL specification for a derived property of a
Class/ context Classproperty
propertyType derive OCLExp
/ Flora code / Selfproperty -gt Result -
Selfclass and Result OCLExp.
33Pre and Post-conditions Transformation
/ OCL specification of the Classoperation
method pre and post-conditions / context
Classoperation(para paramType) boolean pre
preOCLExp post postOCLExp
/ Flora code / Selfoperation(Param) -
Selfclass and preOCLExp and postOCLExp.
34CallExp Transformation
/ OCL implies operation / a implies b
/ Flora code / naf(a) or b
35Outline
- 1 Introduction and Motivation
- 2 MDE and OMG Languages
- 3 OOLP
- 4 MODELOG
- 5 Case Study
- 6 Related Works
- 7 Conclusions
36Case Study
- Representative of many classical AI tasks and OO
modeling - Rich application structural and behavioral
- I have created Triangram
- Table initially composed of atomic triangles
- Goal assembly a regular hexagon according to
some rules - Formed by
- UML class diagram containing 27 classes and diver
relationships - More than 400 lines of OCL code
- Eight Object diagrams illustrating the tans on
the table initial setting - More than 1000 lines of Flora code
37Triangram
38Triangram Flora code
/ Flora code generated containing the table
setting shown in Fig. 5.17 / 1 botrobot. 2
bottable-gtt1. 3 t1tabletans -gtgt tri1, tri2,
tri3, tri4, tri5, tri6, tri7, tri8. / Flora
code generated from the triangle tri1 shown in
Fig. 5.17 / 4 tri1scaleneTriangle. 5
tri1right. 6 s11segmentLinelength -gt 3. 7
s12segmentLinelength -gt 4. 8
s13segmentLinelength -gt 5. 9 tri1side -gtgt
s11, s12, s13. 10 tri1triangleSide -gtgt ts11,
ts12, ts13. 11 ts11triangleSidetriangle-gttri1,
side-gts11, position-gtleft, adjacent-gtgtts12,
ts13. 12 ts12triangleSidetriangle-gttri1,
side-gts12, position-gtbase, adjacent-gtgtts11,
ts13. 13 ts13triangleSidetriangle-gttri1,
side-gts13, position-gtright, adjacent-gtgtts11,
ts12. 14 s11triangleSide-gtgtts11. 15
s12triangleSide-gtgtts12. 16 s13triangleSide-gtgtts
13.
39Triangram Flora Code
/ OCL invariant inv_9 / context Triangle inv
inv_9 right implies hypotenuse-gtsize() 1
/ Flora code from inv_9 mapping / 1
violated_inv9(Self) - Selftriangle and 2
naf( 3 (naf (Selfright)) or 4
(Col collectbagVar Selfhypotenuse-gtVar
and 5 size(Col, 1)) 6 ).
/ Flora code from inv_9 mapping / 1
violated_inv9(Self) - Selftriangle and 2
naf( 3 (naf (Selfright)) or 4
(Col collectbagVar Selfhypotenuse-gtVar
and 5 size(Col, 1)) 6 ).
/ Flora code from inv_9 mapping / 1
violated_inv9(Self) - Selftriangle and 2
naf( 3 OCLExp 6 ).
/ Flora code generated containing a culprit
object/ 1 tri1scaleneTriangle. 2
tri1right. 3 s11segmentLinelength -gt 3. 4
s12segmentLinelength -gt 4. 5
s13segmentLinelength -gt 5. 6 tri1side -gtgt
s11, s12, s13. 7 tr1hypotenuse -gt s11. 8
tri1hypotenuse -gt s12.
Flora-2 ?- violated_inv9(X). Yes X tri1
40Outline
- 1 Introduction and Motivation
- 2 MDE and OMG Languages
- 3 OOLP
- 4 MODELOG
- 5 Case Study
- 6 Related Works
- 7 Conclusions
41Related Works
- Not executable, very strict subset of UML/OCL 1.4
- Kyas and Fecher, 04 maps UML/OCL to PVS input
language - Beckert et al., 02 maps UML/OCL 1.4 to Dynamic
Logic - Oliver, 99 purposes animation for validation
- Berardi, 02 maps only UML class diagrams to DLs
- Shen et al., 02 maps tor ASM
- Lilius and Paltor, 99 maps only UML to PROMELA
- Henocque, 04 maps UML/OCL to Z (only OCL
invariants) - Roe et al, 03 maps UML/OCL 1.4 to Object-Z
- Executable, but without a formal semantics
- Gray and Schach, 00 maps UML/OCL 1.4 to
Prolog - Prolog does not have a formal semantics
- Only for invariants
- Fully manual
- Prolog does not support transactions nor
meta-programming
42Related Works
- Marcano and Levy, 02 and Ledang and
Souquières, 02 map UML/OCL to B (following a MDE
approach) - Contemplates OCL 1.4
- OCL metamodel pursued is not that provided by the
OMG - Transformations expressed in T
- B is no object-oriented
- B does not support transactional operations
- B does not support meta-programming
- The Theorem-prover ATELIER B proves automatically
about 70 of proof obligations
43Related Works
- Semantic Web Service
- Baclawski et al., 01 and Cranefield, 01 maps
UML to RDF abd DAML-OIL, respectively - Only structural constraints
- Generating only ontologies (Not Semantic Web
Services)
44MODELOG
MODELOG through UML-OCL to Flora mapping
45Outline
- 1 Introduction and Motivation
- 2 MDE and OMG Languages
- 3 OOLP
- 4 MODELOG
- 5 Case Study
- 6 Related Works
- 7 Conclusions
46Limitations
- Transformation definitions concerning OCL are not
complete - Transformations are not completely implemented
- Class diagram module does not cover active
classes - Flora metamodel does not cover all extra logical
predicates - Incomplete OCL specification of Flora metamodel
- EMF objects are generated instead of full textual
Flora code
47Future Work
- MODELOG as QVT or ATL transformation engine
- MODELOG as KobrA model checking engine
- MODELOG as Semantic Web Ontology and agent CASE
tool - Using metamodels for specifying and integrating
formal semantics - Proving conformance of the generated Flora code
and the forthcoming UML and OCL formal semantics - Extending MODELOG to cover other UML diagrams
- Specify Object diagram transformations