Aligning OCL and UML

download Aligning OCL and UML

If you can't read please download the document

Transcript of Aligning OCL and UML

Aligning OCL and UML

Edward Willink Eclipse OCL Project Lead,Eclipse QVTd Project Lead,Thales OMG OCL RTF Representative,Thales OMG QVT RTF Representative

OCL 2011 @ TOOLS 2011

29th June 2011

Overview

OCL and UML and EMOFProblems

Complete OCLProblems and Solutions

ValuesProblems and Solutions

Summary

UMLMeta-ModelEMOF / EcoreMeta-ModelUMLModelEMOF / EcoreModelUML EditExport

conforms to

conforms to

UMLModelUMLModel

OCL for EMOFModelOCL EditExport

OCL for UMLModelOCLMeta-Modelconforms to

conforms to

OpaqueExpressionExpressionInOcl

generalises

UML and OCL integration

ExpressionInOcl

???

Complete OCL 2.3 Property Definition

context MyClass
def: upperCaseName : String = name.toUpper()

No Property

XMI Serialization

One of three primary OCL compliance points

In ASPropertyCallExp.referredProperty : Property

No problem for UML/EMOF modelsProperty exists

Major problem for Complete OCLProperty does not exist

New Complete OCL Property Definition

Property defined (can be referenced)Constraint now owned by Property not Classifier

New Multiple Models Problem

P::X::y defined by a primary UML model

P::X::z defined by a Complete OCL document

How many P's? How Many X's?

What is the value of P::X.ownedAttribute?

Multiple Models Solution

Simple Model UsageHow many P's? How Many X's?One

What is the value of P::X.ownedAttribute?Set{P::X::y, P::X::z}

Reflective Model Usage, URI AccessHow many P's? How Many X's?Two

What is the value of P::X.ownedAttribute?depends on P::X - Set{P::X::y} or Set{P::X::z}

Meta-Model Problems to solve

Library ModelingReflection

Iteration

UML alignmentobsolete/inconsistent classes in use

templates

EMOF (and Ecore and ...) utilityarbitrary meta-meta-models

Complete OCL realizabilitydefinition of real Property/Operation

multiple models, URIs

Meta-Model Solution

Selected UML contributions for UML-alignment

Selected OCL contributions for tailored OCL

Vendor contributions support practical tooling

Merge gives single uniform packageOCL::Class, OCL::OclExpression etc

Overview

OCL and UML and EMOFProblems

Complete OCLProblems and Solutions

ValuesProblems and Solutions

Summary

LocalSnapShots

LocalSnapShot: all names and their valuesuseful for defining semanticsN snapshots for OclMessage history

2 snapshots necessary for @pre, not @pre

inefficient for practical implementations

UML Primitives

UML Primitives have no representationensures implementation freedom

UML Primitives have no behaviourcannot be used

UML Primitives have no conformancecannot be interchanged

UML Primitive Usage

Representation provided by host Class

Behaviour/Role defined by host Class

OCL Primitive Usage

StringValue hosts the String primitiveprovides a representation

OCL Standard Library defines behaviouroperations of StringValuenot String, not a companion class

OCL specification defines conformance

[IntegerValue/RealValue/BooleanValue ... missing]

OCL Primitives in Java

Ignore *Value classesOCL::String implemented by java.lang.String

OCL::Integer implemented by java.lang.Integer

OCL::Set implemented by java.util.Setoops! number ranges ... java.math.BigInteger

oops! in OCL: 4 = 4.0 so Set{4} = Set{4.0}

Complete OCL adds operationsoops! java.lang.String is final

OCL Values in Java

xxxValue provides an indirection

IntegerValue/SetValue provide OCL semanticsexploit Java for implementation not behaviour

IntegerValue may be polymorphicint or long or BigInteger representation

IntegerValue-for-int similar to java.lang.Integer

OCL Object Values in Java

ObjectValue can be polymorphican indirection to a real Object representation

Foundation for a Java binding for OCL

Summary

Reviewed Complete OCL and URI issuesintroduced Pivot meta-modelderived from UML

reifying missing OCL concepts

Reviewed the Values Packageprovides OCL/Implementation semantic separation

basis for a Java binding for OCL

UML (and OCL)

UMLMOFOCLComplete MOF Essential MOF ( Ecore) Powerful, Flexible, Big

Small, Effective, Efficient

Analysis

Design

Implementation

Complete MOF Complete OCL Essential OCL

Significant Problem Summary

OCL for EMOF lacks essential elementsOpaqueExpression, Constraint

Types with features

Complete OCL incompleteProperty/Operation definition not useable

Property/Operation definition not persistable

OCL not UML alignedAssociationEnd/Property

AssociationClass

Solution Summary

OCL for EMOF lacks essential elementssupport EMOF only indirectly

Complete OCL incompletecomplete it

OCL not UML aligneddefine OCL with respect to UML

Values

Integer ??

Type ??

OrderedSet ??

*Type* ??

Made available under EPL 1.0

UMLMeta-ModelEMOFMeta-ModelUMLModelEMOFModelEditExportGenerate

conforms to

conforms to

EMOFObjects

ExecuteProgramconforms to

UMLMeta-ModelEMOFMeta-ModelUMLModelEMOFModelUML EditExport

conforms to

conforms to

OpaqueExpressionExpressionInOcl

UMLModelUMLModelOCL for EMOFModelOCL EditExport

OCL for UMLModelExpressionInOcl

???OCLMeta-Modelconforms to

conforms to

generalises

UMLMeta-ModelEMOFMeta-ModelUMLModelEMOFModel

conforms to

conforms to

UML + OCLModelCompileOCL PivotModel

conforms to

Complete OCLGrammarOCL LibraryGrammarComplete OCLDocument

OCL Library Document

CompileLoadCompileLoad

OCL PivotModelOCL PivotModelOCL PivotModelOCL PivotModelOCL PivotMeta Model

UML + OCLMeta-ModelEMOF + OCLMeta-ModelUMLModelEMOF + OCLModelModelEditExport

conforms to

conforms to

UML + OCLModelMeta-ModelEditExport

EvaluateEvaluate

Evaluate

ZZZ + OCLMeta-Model

OCL PivotMeta-ModelYYY + OCLModel

conforms to

OCL PivotModels

conforms to

XXXValues, Objects

conforms to

OCL ValueObjects

conforms to

CompileLoad

Load

AdaptOCL Library DocumentComplete OCLDocumentCompile

XXXValue, ObjectOCL ValueAdapt

Evaluate

XXX + OCLMeta-Model

conforms to

?OCL PivotMeta-ModelXXX + OCLModel

conforms to

OCL PivotModel

conforms to

conforms to

OCL ValueObjects

conforms to

M1

M1

M2

M3

Basic UML MMAdvanced UML Constructs MMPackageMergeEssential OCL MMOCL Pivot MM

Complete OCL MMVendor-specific MMSimplifyConvertto Basic