Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
September 2009
Outline
1. Introduction
1.1 Executable Models 1.2 Foundational Executable UML 1.3 Action Languages
a computationally complete and compact subset of UML provides a simplied subset of UML Action Semantics package simplies the context to which the actions may be applied enforces a data ow abstract representation fUML Reference Implementation ModelDriven.org 2009, version 0.2.0
Action Language for Business Logic (ABL) +CAL OCL4X OMG issued a Request for Proposal: Concrete Syntax for a UML Action Language (2008)
I. Lazar, B. Prv, S. Motogna and I.-G. Czibula C.-L. Lazar, Using a fUML Action Language to construct UML models
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#)
List (array)
list[index] list.add(object) list.remove(object) list.size
POS +makeNewSale() +addSaleItem( code : String, quantity : Integer ) : Boolean SaleItem +quantity : Integer * +item 0..1 +currentSale Sale +addItem( product : Product, quantity : Integer ) * +product +product 1 Product +code : String +price : Integer
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
1 2 3
activity makeNewSale MAIN_BLOCK [lines 1-3] ASSIGN_STMT [line 2] <<readSelf>> result result <<createObject>> self Sale value object <<addStructuralFeatureValue>> currentSale
Figure: POS::makeNewSale
activity with 2 parameters parameter value provided by parameter node variable simulated with fork node the actions for a statement are contained inside a structured node control ows between statement nodes enforce sequential execution
1 2 3 4 5 6 addItem(product:Product, quantity:Integer) { def newItem : SaleItem := new SaleItem; newItem.product := product; newItem.quantity := quantity; self.item.add(newItem); }
product : Product product quantity : Integer ASSIGN_STMT [line 4] value <<addStructuralFeatureValue>> object quantity quantity ADD_STMT [line 5] result result <<readSelf>> <<valueSpecification>> self * object insertAt <<addStructuralFeatureValue>> value item activity addItem ( product : Product, quantity : Integer ) MAIN_BLOCK [lines 1-6] DEF_STMT [line 2] result : SaleItem <<createObject>> SaleItem newItem ASSIGN_STMT [line 3] value <<addStructuralFeatureValue>> object product
Figure: Sale:addItem
Using a fUML Action Language to construct UML models
activity addSaleItem ( code : String, quantity : Integer ) : Boolean MAIN_BLOCK [lines 1-9] DEF_STMT [line 2] code findProduct return : Product
product result first ListSize <<testIdentity>> second list = <<valueSpecification>> 0 result : Boolean result THEN_BLOCK [lines 3-5] RETURN_STMT [line 4] <<valueSpecification>> result false
body
quantity
2 3 4 5 6 7 8 9
addItem <<readSelf>> result self target object <<readStructuralFeature>> currentSale result RETURN_STMT [line 7] result
<<valueSpecification>> true
return : Boolean
Figure: POS::addSaleItem
Using a fUML Action Language to construct UML models
<<valueSpecification>> 0
self.currentSale is the target object body product quantity and are the arguments THEN_BLOCK [lines 3-5]
RETURN_STMT [line 4]
quantity : Integer
Figure:
activity addSaleItem ( code : String, quantity : Integer ) : Boolean MAIN_BLOCK [lines 1-9] DEF_STMT [line 2] code findProduct return : Product
product
result first ListSize <<testIdentity>> second list Figure: POS::addSaleItem [line 2] = <<valueSpecification>> result result : Boolean I. Lazar, B. Prv, S. Motogna and I.-G. Czibula C.-L. Lazar, Using a fUML Action0 Language to construct UML models
3
code code : String
code if
DEF_STMT [line 2]
test
result first ListSize <<testIdentity>> second list = <<valueSpecification>> 0 result : Boolean result THEN_BLOCK [lines 3-5]
body
activity addSaleItem ( code : String, quantity : Integer ) : Boolean MAIN_BLOCK [lines 1-9] if (product = null) { DEF_STMT [line 2] return false; return : Product code findProduct } else { code self.currentSale.addItem( product code : String IF_STMT [lines 3-8] product, quantity); result test first 7 return true; ListSize <<testIdentity>> second list 8 } =
3 4 5 6
<<valueSpecification>> 0
quantity
the control tokens are sent by the structured nodes containing the actions to a merge node
the control token reaches the nal node
addItem <<readSelf>> result self target object <<readStructuralFeature>> currentSale result RETURN_STMT [line 7] result
<<valueSpecification>> true
return : Boolean
activity findProduct( code : String ) : Product MAIN_BLOCK [lines 1-8] FOR_EACH_STMT [lines 2-6] result <<readSelf>> self object <<readStructuralFeature>> result product
<<iterative>> FOR_EACH [lines 2-6] BLOCK [lines 2-6] prod code : String test first IF_STMT [lines 3-5] second result object <<readStructuralFeature>> code
code
return : Product
Figure: POS:ndProduct
I. Lazar, B. Prv, S. Motogna and I.-G. Czibula C.-L. Lazar, Using a fUML Action Language to construct UML models
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