Modeling the OCL Standard Library

Slides:



Advertisements
Similar presentations
Formal Methods of Systems Specification Logical Specification of Hard- and Software Dr. Armin Wolf Fraunhofer Institut für Rechnerarchitektur.
Advertisements

Profiles Construction Eclipse ECESIS Project Construction of Complex UML Profiles UPM ETSI Telecomunicación Ciudad Universitaria s/n Madrid 28040,
OCL2 April A presentation of OCL 2 Object Constraint Language Christian Hein, Fraunhofer FOKUS April 2006.
Generic programming in Java
Modeling with the ECCF SS ● UML Profile for ECCF ● UML Redefinition Semantics ● Compliance ● Consistency ● Conformance ● Validation ● Transformation ●
Automated creation of verification models for C-programs Yury Yusupov Saint-Petersburg State Polytechnic University The Second Spring Young Researchers.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Detail Design Extending UML and Object Design. Object Design.
UML CASE Tool. ABSTRACT Domain analysis enables identifying families of applications and capturing their terminology in order to assist and guide system.
Chapter 10 Class and Method Design
SchemeCOP Introduction to Scheme. SchemeCOP Scheme Meta-language for coding interpreters –“ clean ” semantics Scheme = LISP + ALGOL –simple.
Chapter 10 Classes Continued
Slide 1 Chapter 10 Class and Method Design. Slide 2 REVISITING THE BASIC CHARACTERISTICS OF OBJECT-ORIENTATION.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
PPL Syntax & Formal Semantics Lecture Notes: Chapter 2.
An Approach and Tool for Synchronous Refactoring of UML Diagrams and Models Using Model-to-Model Transformations Hafsteinn Þór Einarsson Helmut Neukirchen.
Xactium xDSLs Run Models Not Code Tony Clark
Faculty of Informatics and Information Technologies Slovak University of Technology Peter Kajsa and Ľubomír Majtás Design.
A presentation of OCL 2 Object Constraint Language Fraunhofer FOKUS.
What is MOF? The Meta Object Facility (MOF) specification provides a set of CORBA interfaces that can be used to define and manipulate a set of interoperable.
A Meta-Level Specification and Profile for AspectJ in UML Joerg Evermann School of Information Management Victoria University of Wellington.
Sheet 1 DocEng’03, Grenoble, November 2003 Model Driven Architecture based XML Processing Ivan Kurtev, Klaas van den Berg University of Twente, the Netherlands.
Institute for Software Integrated Systems Vanderbilt University Object Constraint Language Himanshu Neema Krishnakumar Balasubramanian Jeff Parsons November.
Lecture 4 Generic programming Advanced Java Programming 1 dr hab. Szymon Grabowski dr inż. Wojciech Bieniecki
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Inheritance Inheritance is the process of extending the functionality of a class by defining a new class that inherit,all the features of extending class.
Classes, Interfaces and Packages
UML Profile BY RAEF MOUSHEIMISH. Background Model is a description of system or part of a system using well- defined language. Model is a description.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Interpreting the Object Constraint Presented by: Ed Kausmeyer.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
PPL Syntax & Formal Semantics Lecture Notes: Chapter 2.
Sheet 1MDAFA2004 Linköping, June 2004 A Language for Model Transformations in the MOF Architecture Ivan Kurtev, Klaas van den Berg University of Twente,
Lecture 5:Interfaces and Abstract Classes Michael Hsu CSULA.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
Made available under EPL 1.0 Aligning OCL and UML Edward Willink Eclipse OCL Project Lead, Eclipse QVTd Project Lead, Thales OMG OCL RTF Representative,
OCL Specification Status
UNIT-IV Designing Classes – Access Layer ‐ Object Storage ‐ Object Interoperability.
Abstract Syntax cs7100 (Prasad) L7AST.
Polymorphism in Methods
Modern Programming Tools And Techniques-I
SWEN421 – Lecture 3 Building High Integrity Software with SPARK Ada
/* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET
SysML v2 Formalism: Requirements & Benefits
CS 326 Programming Languages, Concepts and Implementation
Introduction to Scheme
Software Engineering Fall 2005
OCL 2.5 Plans Edward Willink OCL MODELS 2014
Object Oriented Programming
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
Chapter 2, Modeling with UML, Part 4 UML 2 Metamodel
CdmCL, a Specific Textual Constraint Language for Common Data Model
Name: Rubaisha Rajpoot
Object-Oriented Knowledge Representation
Generic programming in Java
Java – Inheritance.
Abstract Syntax cs7100 (Prasad) L7AST.
QVT Operational 1.0 Mini-deck
Algebraic Specification Software Specification Lecture 34
Object Constraint Language (OCL)
Abstract Data Types Abstraction is to distill a system to its most fundamental parts. Applying the abstraction paradigm to the design of data structures.
C++ Object Oriented 1.
Generics, Lambdas and Reflection
Software Architecture & Design
Presentation transcript:

Modeling the OCL Standard Library 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

Modeling the OCL Standard Library Overview OMG OCL Specification Background Library Concrete Syntax DSL and Xtext tooling Abstract Syntax Problems and Solutions Library Content Library Enhancement Summary 29-June-2011 Modeling the OCL Standard Library

Library Concrete Syntax : Problems Intuitive (unchecked) exposition 29-June-2011 Modeling the OCL Standard Library

Library Concrete Syntax : Solution Formal Syntax, Domain Specific Language 29-June-2011 Modeling the OCL Standard Library

Library Concrete Syntax : Validation 29-June-2011 Modeling the OCL Standard Library

Library Concrete Syntax : Iterations 1 8.3.7 11.9.1 Where is the one/two argument specification? 29-June-2011 Modeling the OCL Standard Library

Library Concrete Syntax : Iterations 2 Body declared using a Lambda Type Lambda context-type ( parameter-types ) : return-type hybrid of Tuple and Operation signatures Distinct declarations per iterator arity Iterators ; Accumulator | Body iterate is a regular iteration 29-June-2011 Modeling the OCL Standard Library

Semantic Problems: Overloading OCL is aligned with UML Overloading is a semantic variation point in UML Overloading semantics is not specified by OCL Overloading is undefined in OCL and UML Original suggestion invariant overloading like Java Object.equals(Object) static analysis to determine operation signature dynamic dispatch on actual type of object 29-June-2011 Modeling the OCL Standard Library

Semantic Solutions: Overloading Usage UML 2.4 - a couple of minor covariant overloads OCL 2.3 - fundamental OclAny::=(OclAny), Collection::=(Collection) ... Real::max(Real), Integer::max(Integer) ... self-variant overloading OclAny::=(OclSelf) : Boolean, Collection::=(OclSelf) Real::max(OclSelf) : OclSelf, Integer::max(OclSelf) single dynamic dispatch common type of source and argument 29-June-2011 Modeling the OCL Standard Library

Semantic Solutions: OclSelf self - the current context object OclSelf - the type of self statically determinate determined at compile time a pseudo-type or type template parameter never instantiated 'exists' solely in Library Concrete Syntax declarations resolved to a true type in the Abstract Syntax cf. "T" in OCL 2.3 29-June-2011 Modeling the OCL Standard Library

Abstract Syntax Problems: oclAsSet The Abstract Syntax cannot be generated for let a:String = xxx in xxx->notEmpty() without static knowledge of whether xxx is null If xxx is non-null Abstract Syntax represents let a:String = xxx in Set{xxx}->notEmpty() If xxx is null Abstract Syntax represents let a:String = xxx in Set{}->notEmpty() If xxx is invalid Abstract Syntax (perhaps) represents let a:String = xxx in invalid->notEmpty() 29-June-2011 Modeling the OCL Standard Library

Abstract Syntax Solutions: oclAsSet 1 Introduce OclAny::oclAsSet() operation compile-time: object-> is shortform for object.oclAsSet()-> let a:String = xxx in xxx.oclAsSet()->notEmpty() run-time: OclAny::oclAsSet() returns Set{xxx} OclVoid::oclAsSet() returns Set{} OclInvalid::oclAsSet() returns invalid library declaration: OclAny::oclAsSet() : Set<OclAny> loses static type information 29-June-2011 Modeling the OCL Standard Library

Abstract Syntax Solutions: oclAsSet 2 library declaration: OclAny::oclAsSet() : Set<OclSelf> preserves static type information 1->forAll(i : Integer | i = 0) 1 UnlimitedNatural .oclAsSet() Set<UnlimitedNatural> ->forAll(i : Integer | i = 0) over UnlimitedNatural 29-June-2011 Modeling the OCL Standard Library

Library Problems: oclAsType OCL 1.6 OclAny::oclAsType(OclType) : T OclType is an open Enumeration of all types OCL 2.0 OclAny::oclAsType(OclType) : T OclType is a power-set of all types OCL 2.2 OclAny::oclAsType(Classifier) : T T is intuitive Classifier at different meta-level Attempts to define a non-reflective meta-type Does OCL support Reflection? not prohibited by OCL 2.0 Request for Proposals 29-June-2011 Modeling the OCL Standard Library

Library Problems: oclType OCL 2.0 Element::getMetaClass() MOF facility not merged to UML OCL 2.2 OclAny::oclType() : Classifier No Classifier in EMOF Classifier at different meta-level Does OCL support Reflection? (OCL 2.0) precondition for Sequence::first() self.oclType().elementType.oclIsKindOf(CollectionType ) Yes 29-June-2011 Modeling the OCL Standard Library

Library Solutions: oclAsType, oclType OclAny::oclAsType<T>(Class<T>) : T T is declared OclAny::oclType() : Class<OclSelf> OclSelf preserves static type information self.oclType().ownedAttribute Arbitrary depth self.oclType().oclType().ownedAttribute Class<OclSelf> is a TypeExp 29-June-2011 Modeling the OCL Standard Library

Not-new OCL Facilities Overloading / dynamic dispatch Reflection : oclType(), Class<T> was T, used in WFRs Type-valued Expressions : Class<T> used in oclAsType() Templates/Generics used in Collection, Collection::product, Tuples OclSelf was T Lambda Types / Expressions iteration bodies 29-June-2011 Modeling the OCL Standard Library

Modeling the OCL Standard Library Summary Modelled all the OCL Standard Library collect() is fudged recognised concepts already in use OclSelf, templates, lambdas, reflection, overloading Introduced consistency shared Bag/Sequence/UniqueCollection Comparable/Summable Provided a DSL declarations and constraints and documentation auto-generating specification 29-June-2011 Modeling the OCL Standard Library

Library Problems: collect Return type is irregular both Set<T> and Set<Set<T>> return Bag<T> cannot be modelled using simple templates OCL 2.0 Collection does not conform to OclAny only homogeneous collections enumerate declaration for all depths OCL 2.2 Collection conforms to OclAny heterogeneous collections are Collection<OclAny> 29-June-2011 Modeling the OCL Standard Library

Library Solutions: collect Open problem type system for heterogeneous collections extensible to unit element collections model collect / collectNested usefully Reconsider flattening collect originally for flat collections respecified to hide pragmatic nesting untenable for heterogeneous collections 29-June-2011 Modeling the OCL Standard Library

Modeling the OCL Standard Library Background : Problems OCL 1.x part of UML 1.x OCL 2.0 split off from UML 2.0 UML 2.0 FTF drafted OCL 2.0 QVT 1.0 reused OCL 2.0 QVT FTF 'finalized' OCL 2.0 OCL 2.2, 2.3 make minor improvments Many problems typos, inconsistency UML-alignment incomplete semantics 29-June-2011 Modeling the OCL Standard Library

Background : Solutions Auto-generate specification model-defined specification no inconsistency consumable by tools auto-generated change documentation This talk - removing intuition for the library Companion talk - the underlying models 29-June-2011 Modeling the OCL Standard Library

Library Problems: allInstances Declared at different meta-level BooleanType::allInstances() : Set(Boolean) VoidType::allInstances() : Set(OclVoid) InvalidType::allInstances() : Set(OclInvalid) invalid (in OCL 2.3) Enumeration::allInstances() -- set of literals inconsistent return values Classifier::allInstances() : Set(T) -- instances of self intuitive return type 29-June-2011 Modeling the OCL Standard Library

Library Solutions: allInstances static Classifier::allInstances() : Set<OclSelf> static models the alternate meta-level Set<OclSelf> models the return type static Enumeration::allInstances() : ... MyEnumeration.ownedLiteral 29-June-2011 Modeling the OCL Standard Library

Library Concrete Syntax : Implementation Some operations could be defined by a body some e.g. indexOf only have postconditions body requires an OCL code generator utility requires a good OCL code generator Optionally bind feature to an implementation perhaps org.omg.ocl.collection.product from OMG 29-June-2011 Modeling the OCL Standard Library

Abstract Syntax Problems : Iteration An iteration can be invoked from the CS An iteration can be invoked from the AS IteratorExp.name references iterator by name An iteration is not modelled in the AS cf OperationCallExp::referredOperation references an Operation element 29-June-2011 Modeling the OCL Standard Library

Abstract Syntax Solutions : Iteration New: Iteration extends Operation New: LoopExp::referredIteration 29-June-2011 Modeling the OCL Standard Library

Library Content: OCL 2.2 Collections Four unrelated concrete Collection Kinds. asBag/asOrderedSet/asSequence/asSet to convert incomplete/inconsistent OrderedSet definition 29-June-2011 Modeling the OCL Standard Library

Library Content: Büttner Collections Two pairs of unrelated concrete Collection Kinds. Fewer conversions needed OrderedSet is not a Set Set{1,2} wrt OrderedSet{1,2} <> OrderedSet{2,1} 29-June-2011 Modeling the OCL Standard Library

Library Content: New Collections Set/OrderedSet commonality via abstract UniqueCollection even fewer conversions/declarations Set<T>::union(UniqueCollection<T>) : Set<T> 29-June-2011 Modeling the OCL Standard Library

Library Solutions: oclAsType OclAny::oclAsType<T>(Class<T>) : T T is declared Types conform to their Class 29-June-2011 Modeling the OCL Standard Library