ocl tooling for omg specifications - eclipse · 13-dec-2011 ocl tooling for omg specifications made...

30
Made available under EPL 1.0 OCL Tooling for OMG specifications Edward Willink Thales representative for OMG OCL RTF Eclipse OCL Project Lead Thales representative for OMG QVT RTF Eclipse QVT Declarative Project Lead OMG Quarterly meeting Santa Clara 13th December 2011

Upload: vudang

Post on 11-Sep-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Made available under EPL 1.0

OCL Tooling for OMG specifications

Edward Willink

Thales representative for OMG OCL RTFEclipse OCL Project Lead

Thales representative for OMG QVT RTFEclipse QVT Declarative Project Lead

OMG Quarterly meetingSanta Clara

13th December 2011

13-Dec-2011 OCL Tooling for OMG specifications 2Made available under EPL 1.0

Overview

BackgroundOMG OCL, Eclipse OCL, E.D.Willink

OMG/Eclipse OCL Status/ProgressOld and New Eclipse OCL

Eclipse OCL ToolsUML.xmi syntactic/semantic errors

smells Summary

13-Dec-2011 OCL Tooling for OMG specifications 3Made available under EPL 1.0

OCL Specification BackgroundOCL 2.0 split off from UML 2.0

UML 2.0 not available for OCL alignmentUML FTF lacked resources to finalize

OCL 2.0 'finalized' by QVT 1.0 teamno significant resolution of alignmentmany incomplete areas

OCL 2.2 minor changesOCL 2.3 minor improvementsauto-generation for major improvements

13-Dec-2011 OCL Tooling for OMG specifications 4Made available under EPL 1.0

Eclipse OCL BackgroundOMG OCL 1.x within IBMOMG OCL 2.x within EclipseOrginally Java API

OCL AST MM adjusted to extend Ecore MMEd Merks: "Never extend Ecore"

OCL MM made generic (Christian Damus)OCL<.... Ecore .... >, OCL<.... UML ....>long parameter lists - 10 typeswrong (base class) getXxx returns

Extensibility for QVTd (EDW) and QVTo (ASBH)

13-Dec-2011 OCL Tooling for OMG specifications 5Made available under EPL 1.0

My Background

Embedded/DSP software synthesisUMLX - graphical model transformation

extension of QVT relationsbased on OCLmake Eclipse OCL extensible

became Eclipse OCL (and QVTd) committer then leaderbecame Thales OCL (and QVT) RTF representative

modelize OCLmodelize QVT

modelize UMLX

13-Dec-2011 OCL Tooling for OMG specifications 6Made available under EPL 1.0

UML Specification/Implementation

[Diagrams: not this presentation, good new work]Abstract Syntax Graph comprehensiveWFR 50% of 50% of 50% present correct accurateEclipse for UML 2.2 has significant manual input

Eclipse for UML 2.4 is a bit more automated

Direct OCL to Java for fuller automation

Specification

Implementation

13-Dec-2011 OCL Tooling for OMG specifications 7Made available under EPL 1.0

OCL Specification/Implementation

OCL specification is incompleteEBNF grammarsUML modelsOCL rulessemi-OCL mappings - perhaps QVTr

13-Dec-2011 OCL Tooling for OMG specifications 8Made available under EPL 1.0

The Old Eclipse OCL (RSA)

Most of tool is manually codeddistinct Ecore, UML code, ~OCL 2.3

Significant difficulties enhancing codemany bugs categorized as too difficult

Significant difficulties exploiting OMG models

13-Dec-2011 OCL Tooling for OMG specifications 9Made available under EPL 1.0

The New Eclipse OCL using Xtext

Xtext covers large parts of an implementationXtext uses an EBNF with meta-model annotations

IfExpCS returns IfExpCS:'if' condition=ExpCS'then' thenExpression=ExpCS'else' elseExpression=ExpCS'endif';

Modest gaps between specification and tooling

13-Dec-2011 OCL Tooling for OMG specifications 10Made available under EPL 1.0

OCL Specification work

Define consumable EBNF grammarsDefine consumable CST/ASG mappingDefine complete (UML+OCL) Pivot ASG modelDefine accurate (UML+OCL) WFRsDefine extensible OCL Standard LibraryAutogenerate specification from models

13-Dec-2011 OCL Tooling for OMG specifications 11Made available under EPL 1.0

Eclipse OCL Tooling Work

OCL to Java automation of WFRsOCL-friendly Transformation Virtual Machine

Automation of Pivot ASG creation/mappingAutomation of CST to Pivot ASG mappingsRe-useable for QVT

13-Dec-2011 OCL Tooling for OMG specifications 12Made available under EPL 1.0

The New Eclipse OCL OCL 2.4 prototype/candidateShared specification/implementation models

UML element/type modelOCL expression/value modelOCL library model

Auto-generated specificationRe-useable model driven tooling

OCL, QVTany EBNF/QVT/OCL defined language

OCL Transformation Virtual Machine

13-Dec-2011 OCL Tooling for OMG specifications 13Made available under EPL 1.0

Old Eclipse OCL Tools: OCL ~2.3

Java API: parser, validatorJava API: evaluatorModel API: interpreted OCL executionUI: heuristic Essential OCL expression editorUI: interactive OCL console

13-Dec-2011 OCL Tooling for OMG specifications 14Made available under EPL 1.0

New Eclipse OCL Tools : OCL 2.4...Java API: parser, validatorJava API: evaluator

Java API: library model and feature dispatchModel API: OCL 2 Java code generatorModel API: Compiled OCL executionUI: Xtext Essential OCL expression editorUI: Xtext Complete OCL document editorUI: Xtext Composite OCL in Ecore model editorUI: Xtext OCL Standard Library editor

UI: interactive OCL console

13-Dec-2011 OCL Tooling for OMG specifications 15Made available under EPL 1.0

OCLinEcore Editor today

Load UML, Ecore, OCLinEcoreEdit Pivot as textSave as Ecore, OCLinEcore('tomorrow': Save as UML)('tomorrow': direct Pivot<>UML

model.oclinecore

model.pivot

model.ecore

model.uml

OCLinEcoreEditor

Text

XMI with embedded OCL text

TextText

XMI with embedded OCL text

Ecore

OCLOCL

OCL

OCL

13-Dec-2011 OCL Tooling for OMG specifications 16Made available under EPL 1.0

OCLinEcore Example

13-Dec-2011 OCL Tooling for OMG specifications 17Made available under EPL 1.0

Complete OCL today

Custom Complete OCL splitterEdit Pivot as textSave as Complete OCL text

UML.ocl

UML.pivot

UML.ecore

CompleteOCL Editor

Text

XMI with embedded OCL text

TextText

XMI with embedded OCL text

UML.xmi

EcoreOCL

13-Dec-2011 OCL Tooling for OMG specifications 18Made available under EPL 1.0

Complete OCL Example

13-Dec-2011 OCL Tooling for OMG specifications 19Made available under EPL 1.0

Complete OCL Editor 'tomorrow'

Load separate/merged UML/OCLEdit as OCL textSave as separate/merged UML/OCL

UML.ocl

UML.pivotComplete

OCL Editor

Text

XMI with embedded OCL text

TextText

UML.xmi

UMLOCL

UML

OCL OCLOCL

OCL

13-Dec-2011 OCL Tooling for OMG specifications 20Made available under EPL 1.0

OCL in UML editor 'tomorrow'

Load separate/merged UML/OCLEdit as UML and OCL textSave as separate/merged UML/OCL

UML.ocl

UML.pivotOCLinUML

Editor

Text

XMI with embedded OCL text

TextText

UML.xmi

UML

OCLOCL

OCL

OCL

UMLOCL

13-Dec-2011 OCL Tooling for OMG specifications 21Made available under EPL 1.0

UML <2.5 Syntax ErrorsProblem Wrong Text Correct Text Diagnosis

Bad built-in literal #true true Error: [Never valid]

OCL 1.6 enum literal #out ParameterDirectionKind::out Error: [Very obsolete]

Local def inv xxx: def: defBody invBody

def: defBodyinv xxx: invBody

Error:

Missing parenthesis Error: 'endpackage' expected

Extraparenthesis

Error: red squiggle under extra

Reserved names forAll(in | in) forAll(_in | _in)forAll(_'in' | _'in')

OCL 2.0, 2.2OCL >=2.3

Hyphenation a->b

a->b

Missing endif if a then b else c if a then b else c endif

Missing else endif if a then b a implies b

Complex endif

13-Dec-2011 OCL Tooling for OMG specifications 22Made available under EPL 1.0

UML <2.5 Syntax SmellsProblem Wrong Text Correct Text Diagnosis

Missing body inv x: inv x: TBD

Multi-invariant inv multi_invariant: complex1 and complex2

inv multi_invariant1: complex1inv multi_invariant2: complex2

Ok: confuses errors in complex

74 easy to fix syntax errors

13-Dec-2011 OCL Tooling for OMG specifications 23Made available under EPL 1.0

UML <2.5 Semantic ErrorsProblem Wrong Text Correct Text Diagnosis

Name Qualification Class structuredClassifiers::Class Error: unresolved typeTypos isOclKindOf

isComopositeassociations

oclIsKindOfisCompositeassociation

Error: unresolved operation

Result body: result = yyy

body: yyy

Error:

Bad any a->any() a->any(true)

Bad - on non-Set a - b a->asSet() - b->asSet()

Bad String Concat 'pfx'->union(separator())

'pfx' + separator()'pfx'.concat(separator())

OCL >= 2.2OCL 2.0

Bad Types AggregationNavigableEnd

AggregationKind????

Bad Code

13-Dec-2011 OCL Tooling for OMG specifications 24Made available under EPL 1.0

UML <2.5 OCL 2.3 Semantic ErrorsProblem Wrong Text Correct Text Diagnosis

Collections Set(Class) Set(structuredClassifiers::Class)

Error: unresolved type

Inferred Opposites p.informationFlow p.InformationFlow Make explicit

Result body: result = yyy

body: yyy

Error:

Missing parentheses oclType oclType()

Extraparentheses

specification() specification

Navigation operator a.select(...)b->c

a->select(...)b.c

Complex parenthesesBad navigation self.argument.multipli

city.is(1,1)self.input.is(1,1)

13-Dec-2011 OCL Tooling for OMG specifications 25Made available under EPL 1.0

OCL Navigation OperatorsCollections reify UML MultiplicitiesCollections are not UML class instances

anObject. ... object navigationaCollection-> ... collection navigation

ShorthandsaCollection.... aCollection->collect(...)anObject->... anObject.oclAsSet()-> ...

Object Collection. Navigation ?-> ? Navigation

13-Dec-2011 OCL Tooling for OMG specifications 26Made available under EPL 1.0

UML <2.5 Complete OCLProblem Wrong Text Correct Text Diagnosis

Imports structuredClassifiers::Class Error: unresolved type

Primitive Types types::Integer Integer

Underspecified types

Set{}->includes(a) Set{a} OCL 2.3 defines an upper/lower bound

Closure ... union ... recursive call aClass->closure(superClass) OCL 2.3 in RAS 8

13-Dec-2011 OCL Tooling for OMG specifications 27Made available under EPL 1.0

UML <2.5 Semantic SmellsProblem Suspect Text Correct Text Diagnosis

Redundant iterator

a->forAll(b | b.c) a->forAll(c)

Double implication

(a implies b) and((not a) implies (not b))

a = b If Boolean

Redundant self self.input input Useful in iteration bodies

Over 250 semantic error regions

13-Dec-2011 OCL Tooling for OMG specifications 28Made available under EPL 1.0

UML <2.5 Well Formedness ErrorsProblem Wrong Text Correct Text Diagnosis

Set{} as null Set{} null OCL 1.x practice

Expect many hundredsExpect minor easy fixes

e.g. give each invariant a distinguishable name

13-Dec-2011 OCL Tooling for OMG specifications 29Made available under EPL 1.0

Smells

Upper case navigation nameslow confidence in Association tooling

oclIsTypeOf (exact type comparison)oclIsKindOf (equivalent type comparison)

oclAsType (type cast)may be redundantmay need an oclIsKindOf predicateperhaps the meta-model is at fault

13-Dec-2011 OCL Tooling for OMG specifications 30Made available under EPL 1.0

Summary

OCL and UML specifications inadequatemost problems soluble with tooled modelstooling becoming useful

Code generation from OCL for WFR toolingtoday's activity for Eclipse OCL

UML OCL can be tooledRSA (old Eclipse OCL) viablenew tooling should be complementary