Трансформация UML-моделей и ее применение в технологии MDA

М.: Институт системного программирования РАН, 2005. – 13 с.Модельно-ориентированный подход к разработке ПО позволяет реш

245 96 385KB

Russian Pages [13]

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

Трансформация UML-моделей и ее применение в технологии MDA

  • Commentary
  • 989094
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

; MDA MDA

Т а

а

я UML-

. (platform-independent and platform-specific models, PIMs and ё PIM – , ё , . , ё , . , ,

PSMs) [10].

MDA М.Б. К mikle.kuz@mtu_net.ru А

а

я. , ,

.

-

,

. ,

-

-

.

. ,

,

,

ё

,

.

: -

,

1. В

.

PIM -

, middlewareWebServices, JAVA-

(CORBA, DCOM, Dot-Net, . .

. .), ,

,

(

,



ё

,

ё

MDA

-

)

. , .

,

, ,

, .

,

,

,

-

.

,

, . Model Driven Architecture (MDA) – OMG [9].

. . -

,

MDA,

MDA :

.

ё

. К ,

MDA PSM

ё

.

, :

, ,



-

, (PIM,

),

,

. ,

,

,

MDA, .

MDA,

, [1], 1

2

,

,

OMG, UML



MDA. UML

, :

,

,

, . К

-

. ,

.

PSM-

,

MDA

«

UML-

» UML

,

-

,

:

.

PSM – ( ) PIM

ё

. .



.

,



(action semantics) [2] .

(profiles) -

,

,

. ,

PIM, ,

UML, UML-

.

PSM – , -

( ,

,

UML-

).

. MDA ,

. Э ,

.

,

ё

,

ё -

,

ё ,

, .

ё

MDA:



UML, ,

а

а.

UML –

.

,



. ,

, -

,

,

-

. MDA

ё

,

. ,

-

,

PSM

.

, ,

.

, ,

MDA



: , . . PIM

PIM

, UML-

-

-

.

а

PSM

, .

а

,

,

 

а

, .



, а

,

, [7]. К

MDA.

.

а

.

а

ё

.

. Э ,

, ,

,

.

-

,

,

. . 3

4

, -

UML , 

а

я

а

а

.

:

а

.

.

,



,

ё

,

,

-

. ,

, ,

, ,

.

. .



-

,

. ,

UML-

.

ё

ё В а

я а

ая

а

[6]. ,

ё

, , -

.

, ,

, (

, ), , -

(

,

. .).

2.

UMLUML ё XML,

, -

,

UML-



.

, Facility) [12] . MOF – XSLT [11]

.

XMI [3]. XMI (XML Metadata Interchange) UML XML . UML, MOF (Meta Object , UML-

XQuery [13]. ё XMIXML,

UMLUML. UML-

,

.

MDA.

XMLXML,

, ,

; .К

XML

XMI -

,

.

,

. ,

:

,

– ё

, UML-

,

UML-

,

, UML. К

ё

.

,

Э

.

ё

UML,

-

).

[5].

UML-

.

а я MDA (

UML-

. К

,

,

UML. 5

6

, . UML , XMI,

, UML-

,

, XML-

,

UML

,

,

(Common Warehouse Metamodel) [7]. UML, ,



, CWM

. UML UML . CWM ё

,

, .



UML, ё

. , .

, ( ). UML – QVT (Query, View, Transformation) –

ё MDA.

,

. К ,

, . :

,



,

.

, , , QVT , MOF (Meta Object Facility).

, , ,

,

,

, CORBA

. , MDA.

.

4.

ё

MDA,

ё

,

, -

,

,

, CORBA [14].

,

,

.

. ,

, .

3.

[4].

 

:

.

ё

, . ,



-



, : ,



. «

»

-

. -

-



. 

.

.



.

-

;

,



. ё

PSM



.

UMLPIM



MDA

-



. ,

,

.

ё

-

.

UML

, CORBA 7

8

,

.

ё



, CORBA-

UML, UML-

,

( ,

.

ё

,

, ).



nav_expression::= iteration_pair(/, );

. ,

UML-

.

, ,

, .

. (multiplicity)

5.

. ,

. К

, .

. ,



. , (

-



).

transformation::= *; stage::= stage [] { * }; sequence::= [reversed] (linear | loop | rollback | rulebyrule);

К

; ё

,



, ,



transformation_rule::= rule { };

(

)

; N ,

(N+1) .



, ,

, , – щ

. К

.

,



, ,

(

: ,



,

ё

.

.

, .

select_section::= (|)*; select_operator::=forall from ; constraint::= where ;

– ( ),

,

,



)

,

;

,

.

. ,

– (

,

,

: ;

)

, ,

: ,

,

ё «/».

ё

 а К

,

а

10

).



. 1, 1. К

, 9

( ,

.

З а



.

,

,

,

.

,

. . , .

-

.

,

, ,

)

:

. ,

ё

,

,

( ,

ё

. К

. ,

.

.

, ,

ё

щ

.



.

,

,

.

,

, –

.

щё

ё – ,

;

ё

ё

. .

,



1.

(

)

,

.

; (

.

). .К

;

, ,

ё

,

,

. (

,

:

ё

,

,

.) , (

. ,

generate_section::= ( | | | | )*; create_operator::= make in ; ; update_operator::= = ; ; delete_operator::= delete ; ; include_operator::= include in ; ; exclude_operator::= exclude in ; ;

).

,

, ,

. .

ё

.

“linear”,

, ,



6. В ё

,

“loop” ,

, ,

. ( ,

, .

, .

) “rollback”,

, 11

12

,

ё “rulebyrule”

,

ё

,

ё

.

. . ,

,

,

, ,

.

,

.

(

,

).

,

,

“reversed”. , , “rulebyrule”,

.

.



::=//;

.

“rules”, ,

.

(“linear”) ё ,

, .

, ,

,

.

. ,

, . Э ,

, .

ё , ,

ё

,

8. М

,

,

.

. c ,

, ё

,

ё

.

,

. .

, ,

ё

,

.

ё

,

,

. Э

– .

. , ,

,

.

( ).

,

.Э ,

,

.

7. Т

ё

.

;

К

,

transformation_rule::= rule [ : ] { ; };

. , 13

14

,

, :

 

ё

;

ё

.

ё UML,

.

,



;

Model +associations name : Name 1 0..n 1 +classes0..n

. .

ё

,

, ,

,

.

ё

,

Class name : Name stereotype : Stereotype+class 1 1 0..n 1 +associations

, -

, . ) ,

ё

,

ё

,

,

+attributes

(

+operations 0..n Operation 1 name : Name type : Type

0..n

Attribute name : Name type : Type

.

Association name : Name stereotype : Stereotype Association_type +base

1

+ends

2

AssociationEnd name : Name cardinality : Cardinality 1 Association_end_type visibility : Visibility 1

0..n

Parameter name : Name type : Type

+otherEnd

+parameters

. , ,

Р . 1. У

,

-

щё

UML.

.



.

,

,

«abstract». ,

ё

. ,

.

ё . ,

,

.

9. , -

UML-

-

,

CORBA. , «source»

-

stage example_CORBA_transformation {



,

« PSM

. «target», 15

rule class_to_class { forall srcclass from source/classes make implclass in target/classes; implclass/name= srcclass /name+”_implementation”; implclass/stereotype=”implementation” make interclass in target/classes; interclass/name=srcclass/name; interclass/stereotype=”interface”; make d in target/associations; d/stereotype=”realize”; make e in implclass/associations; e/base=d; e/cardinality=1; e/association_end_type=”navigable”; include e in d/ends; make f in interclass/associations;

16

PIM »

f/base=d; f/cardinality=1; f/association_end_type=”navigable”; include f in d/ends; e/otherend=f; f/otherend=e; }

-

,

ё –

«

,



», -

,

.

, .

ё

«class_to_class» -

» ,

, «class_to_class».

«

« ; ».

rule priv_attributes { forall srcclass from source/classes forall srcattrib from a/attributes where ((srcattrib /visibility=”private”) or (srcattrib /visibility=”protected”)) forall trgtclass from target/classes forall d from rules/class_to_class where ((d/srcclass=srcclass) and (d/implclass=trgtclass)) make trgtattrib in trgtclass/attributes; trgtattrib/name=srcattrib/name; trgtattrib/visibility=srcattrib/visibility; trgtattrib/type=srcattrib/type; } rule pub_attributes { forall srcclass from source/classes forall srcattrib from a/attributes where srcattrib/visibility=”public” forall implclass from target/classes forall interclass from target/classes forall d from rules/class_to_class where ((d/srcclass=srcclass) and (d/implclass=implclass) and (d/interclass=interclass)) make trgtattrib in implclass/attributes; trgtattrib/name=srcattrib/name; trgtattrib/visibility=”private”; trgtattrib/type=srcattrib/type; make getoperation in interclass/operations; getoperation/name=”get_”+srcattrib/name; getoperation/type=srcattrib/type; make setoperation in interclass/operations; setoperation/name=”set_”+srcattrib/name; make h in setoperation/parameters; h/type=srcattrib/type; }

.

rule methods1 { forall srcclass from source/classes forall srcoper from a/operations where srcoper/visibility=”public” forall trgtclass from target/classes forall d from rules/class_to_class where ((d/srcclass=srcclass) and (d/interclass=trgtclass)) make trgtoper in trgtclass/operations; trgtoper/name=srcoper/name; trgtoper/type=srcoper/type; trgtoper/visibility=srcoper/visibility; } rule methods1a { forall a from rules/methods1 forall b from a/srcoper/parameters make c in a/trgtoper/parameters; c/name=b/name; c/type=b/type; } rule methods2 { forall srcclass from source/classes forall srcoper from a/operations where srcoper/visibility=(”private” or “protected”) forall trgtclass from target/classes forall d from rules/class_to_class where ((d/srcclass=srcclass) and (d/implclass=trgtclass)) make trgtoper in trgtclass/operations; trgtoper/name=srcoper/name; trgtoper/type=srcoper/type; trgtoper/visibility=srcoper/visibility; } rule methods2a { forall a from rules/methods2 forall b from a/srcoper/parameters make c in a/trgtoper/parameters; c/name=b/name; c/type=b/type; }

methods1 , 17

18

methods2 methods1a

methods2a

«

. »

« -

»,

, «

,

«

» «

-

-

-

-

». rule associations_single { forall srcclass from source/classes forall assoc from srcclass/associations where assoc/base/association_type=”navigation” where ((assoc/otherEnd/cardinality=”1”) or (assoc/otherEnd/cardinality=”0..1”)) where assoc/otherEnd/association_end_type=”navigable” forall d from rules/class_to_class where d/srcclass=srcclass forall e from rules/class_to_class where e/srcclass=assoc/otherEnd/class make objptr in d/implclass/attributes; objptr/type=e/interclass/name+”_ptr”; objptr/name=assoc/otherEnd/name; objptr/visibility=”private”; }

».

rule interface_mapping { forall a from rules/class_to_class where a/srcclass/stereotype=”interface” delete a/implclass; } }

, . .

, ,

PSM,

CORBA

-

. -

-

«target»

.

10.

rule association_generalization { forall srcclass from source/classes forall srcassoc from a/associations where srcassoc/base/association_type=”generalization” where srcassoc/otherEnd/association_end_type=”navigable” forall c from rules/class_to_class where c/srcclass=srcclass forall d from rules/class_to_class where d/srcclass=srcassoc/otherEnd/class make trgtassoc in target/associations; trgtassoc/association_type=”generalization”; trgtassoc/stereotype=srcassoc/base/stereotype; trgassoc/name=srcassoc/base/name; make f in c/interclass/associations; f/name=srcassoc/name; f/cardinality=srcassoc/cardinality; f/association_end_type=srcassoc/association_end_type; include f in trgtassoc/ends; make g in d/interclass/associations; g/name=srcassoc/otherEnd/name; g/cardinality=srcassoc/otherEnd/cardinality; g/association_end_type=srcassoc/otherend/association_end_type; include g in trgtassoc/ends; f/otherend=g; g/otherend=f; }

19

.

MDA PIM

– PSM

. ,

. Э

ё ,

, .

,

,

. а 1. . . а 1.

, .

Д

а а

. . ё

ri model/nav_expression, . 20

ё

, . forall ri from , )

a a nav_expression – ( ej

fj

where ri /ej =fj. 1 , 1,

a.

sj rk – . rj1…rjn, where (rj1 belongsto ri /sj) and … and ( rjn belongsto ri /sj) and ((ri /sj exclude rj1 exclude rj2 … exclude rjn)=null) ( sj , n=0, where ri /sj=null). a, : a . а 2. , . . . , ё a, where ri /sj =rk, sj

,

U .

T . , ё

,

T-

: ,

a ё T

,

ё b.

t(a)=b.

U(a)=b. t, U T

а,

(a,b), , T(a)=t(a)=b=U(a).  aA T(a)=U(a), ё U.

, .

a–

, T . , , ,

.

,

ё

. Д

а а

,

A . Т

>).

.

. .

A.

(
,