Using a fUML Action Language to construct UML models
-
Upload
lcodrutlucian -
Category
Documents
-
view
227 -
download
0
Transcript of Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
1/18
Using a fUML Action Language to constructUML models
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula
Department of Computer Science,Babes-Bolyai University,Cluj-Napoca, Romania
September 2009
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
2/18
Outline
1. Introduction
1.1 Executable Models1.2 Foundational Executable UML
1.3 Action Languages
2. fUML-based Action Language
3. Further Work
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
3/18
1. Introduction
1.1. Executable Models
verification techniques may be applied early in the
development cycle
execution infrastructures Domain specific
e.g. AADL (embedded domain, hardware and software) Domain and Platform independent
e.g. UML (large, many variation points)
ComDeValCo (Framework for Software ComponentDefinition, Validation, and Composition) based on UML Action Language needed to model the functionality of
components
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
4/18
1. Introduction
1.2. Foundational Executable UML
fUML Specification Object Management Group (OMG) Standard
2008, Rev. 1.0, Beta 1 http://www.omg.org/spec/FUML/
a computationally complete and compact subset of UML
provides a simplified subset of UML Action Semantics
package
simplifies the context to which the actions may be applied
enforces a data flow abstract representation
fUML Reference Implementation
ModelDriven.org
2009, version 0.2.0
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
5/18
1. Introduction
1.3. Action Languages Object Action Language (OAL)
Mentor Graphics BridgePoint product Action Specification Language (ASL)
Kennedy Carters iUML product Shlaer-Mellor Action Language (SMALL)
Project Technology, Inc.
Platform Independent Action Language (PAL) Pathfinder Solutions PathMATE product
ITU-T Recommendation Z.109 a UML profile that maps to SDL (Specification and
Description Language) semantics
Action Language for Business Logic (ABL) +CAL OCL4X OMG issued a Request for Proposal:
Concrete Syntax for a UML Action Language (2008)
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
6/18
2. fUML-based Action Language
the abstract syntax is compliant with fUML
enforces structured programming
concrete syntax similar to Java and OCL
used to model the behavior of class operations
code generation for object-oriented programming
languages (Java, C++, C#)
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
7/18
Types
UML primitive types Boolean
Integer
UnlimitedNatural
String
fUML Model Library operations (primitive function
behaviors) (e.g. +, -, And, Or, ListGet, ListSize).
List (array) list[index]
list.add(object)
list.remove(object) list.size
user defined types: Classes or Enumerations
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
8/18
POS
+makeNewSale()+addSaleItem( code : String, quantity : Integer ) : Boolean
Sale
+addItem( product : Product, quantity : Integer )
SaleItem
+quantity : IntegerProduct
+code : String+price : Integer
+currentSale0..1
+product
1
+item*
+product*
Figure: POS Example Model
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
9/18
the activity is the
implementation (method)
of the operation
activity with no parameters
activity execution starts with the intial node runs main structured
node runs assign statement
ends with the final node
self keyword
(ReadSelfAction)
constructor with no
arguments
(CreateObjectAction)
1 makeNewSale() {2 self.currentSale := new Sale;
3 }
makeNewSaleactivity
MAIN_BLOCK [lines 1-3]
ASSIGN_STMT [line 2]
currentSale
object value
Sale
result
self
result
Figure: POS::makeNewSale
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
10/18
activity with 2 parameters
parameter value provided
by parameter node
variable simulated with forknode
the actions for a statement
are contained inside a
structured node control flows between
statement nodes enforce
sequential execution1 addItem(product:Product,
quantity:Integer) {2 def newItem : SaleItem :=
new SaleItem;
3 newItem.product := product;
4 newItem.quantity := quantity;
5 self.item.add(newItem);
6 }
( product : Product, quantity : Integer )activity addItem
product : Product
quantity : Integer
MAIN_BLOCK [lines 1-6]
ADD_STMT [line 5]
item
object
value
insertAt
*
result
self
result
ASSIGN_STMT [line 4]
quantity
objectvalue
ASSIGN_STMT [line 3]
product
objectvalue
DEF_STMT [line 2]
SaleItem
result : SaleItem
newItem
quantity
product
Figure: Sale:addItem
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
11/18
If statement represented witha conditional node 2 clauses: then and else
each clause references itstest and body actions then clause - its test is
the condition else clause - its test is
always true
1 addSaleItem(code:String,
quantity:Integer
) : Boolean {2 def product:Product :=
self->findProduct(code);
3 if (product = null) {
4 return false;5 } else {6 self.currentSale.addItem(
product, quantity);
7 return true;
8 }9 }
( code : String, quantity : Integer ) : BooleanaddSaleItemactivity
code : String
quantity : Integer
return : Boolean
MAIN_BLOCK [lines 1-9]
test
0result
ListSize
list
result
=
first
second
result : Boolean
body THEN_BLOCK [lines 3-5]
RETURN_STMT [line 4]
false
result
else ELSE_BLOCK [lines 5-8]
CALL_OP_STMT [line 6]
currentSale
object
result
self
result addItem
target
productquantity
RETURN_STMT [line 7]
true
result
IF_STMT [lines 3-8]
DEF_STMT [line 2]
findProductcode
return : Product
product
quantity
code
Figure: POS::addSaleItem
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
12/18
Call operation addItem self.currentSale is the target object quantity and product are the arguments
6 self.currentSale.addItem(product, quantity);
quantity : Integer
else ELSE_BLOCK [lines 5-8]
CALL_OP_STMT [line 6]
currentSale
object
result
self
result addItem
target
productquantity
quantity
Figure: POS::addSaleItem [line 6]
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
C ll i i
-
7/22/2019 Using a fUML Action Language to construct UML models
13/18
Call activity findProduct self keyword tells that the activity is private and belongs to
the same class public global activities may be invoked
noself
keyword2 def product:Product :=
self->findProduct(code);
( code : String, quantity : Integer ) : BooleanaddSaleItemactivity
code : String
MAIN_BLOCK [lines 1-9]
IF_STMT [lines 3-8]
DEF_STMT [line 2]
findProductcode
return : Product
productcode
Figure: POS::addSaleItem [line 2]
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
14/18
null equality test null is represented as having no token empty list is represented by having no token fUML Model Library operation: ListSize
equality test is done using the TestIdentityAction for primitive types - compares values for objects - compares references
3 if (product = null) {
code : String
test
0result
ListSize
list
result
=
first
second
result : Boolean
IF_STMT [lines 3-8]
product
Figure: POS::addSaleItem [line 3]
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
3 if (product = null) {
i i ll
li
-
7/22/2019 Using a fUML Action Language to construct UML models
15/18
Multiple returnstatements the return tokens are
sent by the actions to amerge node the data token
reaches the return
parameter node the control tokens are
sent by the structurednodes containing theactions to a merge node
the control tokenreaches the final node
3 if (product = null) {4 return false;
5 } else {6 self.currentSale.addItem(
product, quantity);
7 return true;
8 }
quantity : Integer
return : Boolean
l i i i
l
li
l
i
i
l l
body THEN_BLOCK [lines 3-5]
RETURN_STMT [line 4]
false
result
else ELSE_BLOCK [lines 5-8]
CALL_OP_STMT [line 6]
currentSale
object
result
self
result addItem
target
productquantity
RETURN_STMT [line 7]
true
result
li
li
quantity
Figure: POS::addSaleItem [3-8]
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
16/18
For-each statementrepresented with anexpansion region iterates over a list of
elements body actions executed
for each element insequential order
1 findProduct(code:String) : Product {2 foreach (prod in self.product) {3 if (code = prod.code) {4 return prod;
5 }
6 }7 return null;
8 }
( code : String ) : ProductfindProductactivity
return : Product
code : String
MAIN_BLOCK [lines 1-8]
FOR_EACH_STMT [lines 2-6]
FOR_EACH [lines 2-6]
BLOCK [lines 2-6]
test
code
result object
=
first second
result : Boolean
bodyBLOCK [line 3-5]
RETURN_STMT [line 4]
return : Product
IF_STMT [lines 3-5]
prod
product
object
result
self
result
RETURN_STMT [line 7]
null
result : Product
code
Figure: POS:findProduct
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
3 F h W k
-
7/22/2019 Using a fUML Action Language to construct UML models
17/18
3. Further Work
create a fully functional editor based on this action
language
simulate the execution for more complex models apply transformations to the models
generate code in different programming languages
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models
-
7/22/2019 Using a fUML Action Language to construct UML models
18/18
Thank you for your attention
?
C.-L. Lazar, I. Lazar, B. Prv, S. Motogna and I.-G. Czibula Using a fUML Action Language to construct UML models