Translation of UML/OCL into BZPE format TestUML Project – INTERREG III – Meeting 12/02/04

Preview:

Citation preview

Translation of UML/OCL

into BZPE format

TestUML Project – INTERREG III – Meeting 12/02/04

Overview

Translated elements

Implementation

UML Class Diagram translation

OCL translation

Overview

Translated elements

Implementation

UML Class Diagram translation

OCL translation

Translated elements

UML : now : class, some stereotypes, attribute, operation, parameter, association, composition, generalization, role, multiplicity

later : association class, other stereotypes, visibility

OCL :now : boolean, integer, set

later : real, string, bag, sequence

Meta-model

Overview

Translated elements

Implementation

UML Class Diagram translation

OCL translation

Implementation

APIs of Poseidon are used to get informations on UML models.

Impossible for OCL expressions :

OCL is written through Poseidon interface generation of a file containing OCL

addition of OCL into IDS

parsing and type checking

Implementation(2)

modelling

UMLdiagram

use of Poseidon

APIs and JMI

model repository (MDR) based

on IDS meta-model

automatic generation

by JMI

XMI file based on the IDS

meta-model

translation of OCL and BZPE generation

BZP File

file containing

OCL constraints

Overview

Translated elements

Implementation

UML Class Diagram translation

OCL translation

UML Class Diagram translation

Reminder about BZPE syntax :

Based on 4 Prolog predicates:

specification(spec-name).

declaration(spec-name, data-kind, data-name, data-type).

operation(spec-name, operation-name).

predicat(spec-name, pred-kind, pred-id, predicate).

data-kind : static | variable | input(op-name) | ouput(op-name) | local(op-name)

data-type : atom | int | set(data-type) | pair(data-type,data-type)

pred-kind : static | invariant | initialisation | pre(op-name) | post(op-name)

UML Class Diagram translation

Each class is translated into a specification

Another kind of specification, the model, manages links between classes

Each class attribute is translated into a function inside the specification.

Each class method is translated into a BZPE operation

Example

DATEday: intmonth : intyear : intgetDay() : int

specification(Date).declaration(Date, static, all_instances, set(atom)).predicat(Date, static, 1, all_instances = {d1,..,dN}).declaration(Date, variable, instances, set(atom)).predicat(Date, invariant, 2, instances all_instances).

declaration(Date, variable, day, set(pair(atom,int))).predicat(Date, invariant, 3, day instances 0..256

Context Date::getDay():intpost: result = self.day

Context Date inv :day > 0 and day < 32

predicat(Date, invariant, 6, x. x instances day(x) > 0 & day(x) < 32).

operation(Date,getDay_void).declaration(Date, input(getDay_void), self, atom).declaration(Date, output(getDay_void), result, int).predicat(Date, pre(getDay_void), 4, self instances).predicat(Date, post(getDay_void), 5, result = day(self)).

Overview

Translated elements

Implementation

UML Class Diagram translation

OCL translation

OCL translation

Translation of set operators :

OCL translation

Translation of set iterators :

defintBzp is the intentional set definition

Recommended