Skip to main content
Jump to: navigation, search


Revision as of 16:00, 12 June 2011 by (Talk | contribs) (2007)

Articles and Presentations

2011 / Indigo

The utility of the Object Constraint Language for modeling within Eclipse has increased dramatically in the last few years, so that Eclipse OCL is now useful for everyday modelers rather than just advanced Java programmers.

This tutorial will demonstrate to existing EMF users how OCL in isolation can enhance their models and how the Eclipse support is re-used within advanced model transformation tools.

The tutorial will first introduce OMG's OCL language and its capabilities, then show how OCL can be embedded within Ecore to support validation and evaluation of dynamic EMF models without using genmodel at all. This part of the tutorial will introduce the OCLinEcore text editor that supports the combined development of OCL and Ecore, the CompleteOCL editor that supports complementary development of OCL and the the Interactive OCL Console that supports interactive evaluation.

Models developed during the Ecore integration part of the tutorial will be elaborated during the rest of the tutorial to demonstrate how model representations can be transformed using model to model transformations and then presented in human-friendly fashion by model to text transformations.

The model to model transformation section of the tutorial will provide a brief overview of OMG's QVT Operational Mappings language and Eclipse's M2M/QVTo tooling, while developing the running example with particular emphasis on the use of OCL to perform complex navigations and queries.

The model to text transformation section of the tutorial will provide similar brief overviews of OMG's M2T language and Eclipse's M2T/Acceleo tooling. The running example will be elaborated to showing more extensive use of OCL.

OCL supports the formulation of very compact queries that it is useful to practice. The tutorial will demonstrate this style of working by providing regular opportunities to configure and use some OCL facility with additional challenges for those participants who find the basic examples too easy.

OCL is widely used by UML and other languages to constrain metamodels and perform evaluations on models. Unfortunately no OCL 2.x specification has ever been aligned with any UML 2.x specification. This lack of alignment makes some OCL compliance points such as XMI interchange unachievable. This paper describes how introduction of an OCL Pivot Meta-Model and clear exposition of the Values package may provide a solution to the alignment and a variety of other specification issues.

OCL is widely used by UML and other languages to constrain metamodels and perform evaluations on models. The OCL specification is the result of diligent but time-constrained human endeavor and so contains many inconsistencies, most of which are relatively easy to ignore as obvious typographical mistakes. However the need to ignore minor discrepancies undermines rigorous treatment of more significant issues. The minor issues can be substantially eliminated by autogenerating the specification. This paper provides early community visibility of proposed solutions to a variety of issues that arose while developing a model for the OCL Standard Library that forms the core of the OCL specification.

2010 / Helios

The utility of the Object Constraint Language for modeling within Eclipse has increased dramatically in the last few years, so that MDT/OCL is now useful for everyday modelers rather than just advanced Java programmers. This long talk is focused on both non-OCL users and advanced OCL users so that any kind of audience may learn how OCL can enhance your (meta-)model definitions and how OCL forms the foundation of advanced modeling technologies such as Acceleo and QVT.

In the first part of the talk, focused on modelers who have yet to discover OCL, you will get a short introduction to the OMG's OCL language and its main capabilities. Then you will learn how OCL can be embedded within Ecore to define constraints for validation, operation bodies for evaluation and derived features for initialization of EMF models (both dynamic instances and those from generated Java classes using "genmodel"). A presentation of the OCL Interactive Console will be used to help the user to alternatively write and validate their OCL constraints.

Finally, focusing on the advanced OCL audience, you will learn about ongoing work to exploit Xtext to provide an enhanced OCL development environment and of OCL to define its own editors and language semantics. Extensive use of OCL within OCL mandates a dramatic performance improvement requiring a flexible Java code generator for an efficient first evaluation of an OCL expression and an impact analysis to avoid redundant re-evaluation following a model change.

The current tooling used for the Eclipse OCL project uses an LALR parser generator. Enhancing the tooling to support editing motivated a migration to exploit the inherently model-driven characteristics of Xtext. This paper summarizes the experiences of that migration, identifies the many benefits and discusses a few changes in implementation approach that were required. Objective performance and size comparisons between the old LALR and new Xtext approach are provided.



With the availability of infrastructural support for OCL (Object Constraint Language) provided by MDT OCL, the next step consists in simplifying the authoring of OCL speci�cations with feature-rich tools, as part of the more general task of model author- ing. The capabilities of the OCL Tools project are described (currently they comprise an OCL ! Java compiler and a text editor for OCL). A discussion of areas for im- provement and related work follows (refactoring of OCL expressions, detecting code smells, analyzing and optimizing OCL expressions). These ideas for future work fall under the umbrella of model compilers, essential elements of Model-Driven Software Engineering.

The Eclipse infrastructure for modeling is based on EMF, with support for OCL 2.0 provided by the Model Development Tools (MDT) project. The combined expressive power of Ecore + OCL allows capturing a sizable amount of development requirements in a declarative manner: (a) data modeling aspects can be expressed as an Ecore-based schema further constrained by OCL invariants; (b) a number of functional requirements can be specified as operation pre- and postconditions, together with side-effects-free queries. The OCL compiler reported in this paper extends the code generation process of EMF by performing a translation from OCL types and expressions into Java types and statements, increasing productivity and quality measures of a Model-Driven Software Development (MDSD) process. The generated code can be directly used as the Model component in an MVC architecture (for example, as part of a graphical editor generated with Eclipse GMF).

The Model Development Tools Object Constraint Language (MDT OCL) project provides the building blocks for Model-Driven tools to weave OCL declarative specifications into software artifacts. We showcase some of these possibilities, taking as starting point a plug-in to visualize OCL abstract syntax trees (ASTs) in the form of annotated trees. This example motivates some practical tips about patterns for OCL visitors, including using Java 5 generics and achieving conciseness by letting MDT OCL take care of the "walking" order. To really reap the benefits of OCL-enriched specifications, tools in our modeling chain have to be able to transform such expressions into the target software platform (e.g. compile into Java, translate into SQL). Work in this area is summarized, to ease jump-starting your own OCL processing project.

This article illustrates how the MDT OCL parser/interpreter technology adds to the value of EMF/JET code generation as a foundation for model-driven development (MDD). We will see, with fully functional examples, how a model can be generated from an Ecore specification without requiring any post-generation custom code, including complete implementations of:

    • invariant constraints
    • derived attributes and references
    • operations

Back to the top