OCL Documentation

Total Page:16

File Type:pdf, Size:1020Kb

OCL Documentation OCL Documentation OCL Documentation Christian Damus, Adolfo Sánchez-Barbudo Herrera, Axel Uhl, Edward Willink and contributors Copyright 2002 - 2018 Eclipse OCL 6.6.0 1 1. Overview and Getting Started ....................................................................................... 1 1.1. What is OCL? .................................................................................................... 1 1.2. How Does It Work? ............................................................................................ 1 1.2.1. Editing ................................................................................................... 1 1.2.2. Execution ................................................................................................ 1 1.2.3. Debugging .............................................................................................. 2 1.2.4. Testing ................................................................................................... 2 1.3. Eclipse OCL is Extensible .................................................................................... 2 1.4. Who Uses OCL and Eclipse OCL? ........................................................................ 2 1.5. Who is Behind Eclipse OCL? ............................................................................... 3 1.6. Getting Started ................................................................................................... 3 2. Users Guide ................................................................................................................ 5 2.1. The two Eclipse OCLs ......................................................................................... 5 2.1.1. The Classic Eclipse OCL metamodels .......................................................... 5 2.1.2. The Unified or Pivot Eclipse OCL metamodel ............................................... 5 2.1.3. The transition .......................................................................................... 6 2.1.4. Migration ................................................................................................ 7 2.1.5. APIs ...................................................................................................... 8 2.2. The Essential OCL Language ................................................................................ 9 2.2.1. Syntax .................................................................................................... 9 2.3. The OCLinEcore Language ................................................................................. 19 2.3.1. Syntax .................................................................................................. 19 2.3.2. Limitations ............................................................................................ 31 2.4. The Complete OCL Language ............................................................................. 31 2.4.1. Syntax .................................................................................................. 31 2.5. The OCL Standard Library Language ................................................................... 37 2.5.1. Syntax .................................................................................................. 37 2.6. Editors ............................................................................................................ 41 2.6.1. Syntax coloring ...................................................................................... 41 2.6.2. Validation ............................................................................................. 42 2.6.3. Hover Text ............................................................................................ 42 2.6.4. Content Assist ........................................................................................ 42 2.6.5. Code Templates ...................................................................................... 42 2.6.6. Open Declaration .................................................................................... 42 2.7. OCL Nature and Builder Auto-Validation .............................................................. 43 2.7.1. Configuring the OCL Nature and Builder .................................................... 43 2.7.2. Ecore and UML Auto-Validation ............................................................... 43 2.7.3. Building on pre-Photon / 2018 releases ....................................................... 44 2.8. Console ........................................................................................................... 44 2.8.1. Context Object Selection .......................................................................... 45 2.8.2. Editing .................................................................................................. 45 2.8.3. Editor Keys ........................................................................................... 45 2.8.4. Results .................................................................................................. 45 2.8.5. Tool Bar ............................................................................................... 45 2.9. Validity View (new in Luna) ............................................................................... 46 2.9.1. View Tool Bar ....................................................................................... 47 2.9.2. Model Elements Pane .............................................................................. 48 2.9.3. Metamodel Constraints Pane ..................................................................... 49 2.9.4. Constraint Locators ................................................................................. 50 2.10. Debugger (new in Luna) ................................................................................... 51 2.10.1. Launching ............................................................................................ 51 2.10.2. Stepping .............................................................................................. 53 2.10.3. Variables View ..................................................................................... 54 2.10.4. Breakpoints View .................................................................................. 54 2.10.5. Outline View ........................................................................................ 54 2.11. OCL Integration .............................................................................................. 54 2.11.1. OCL execution in Ecore / EMF Delegates .................................................. 54 2.11.2. Custom Validation Messages ................................................................... 54 Eclipse OCL 6.6.0 ii OCL Documentation 2.11.3. CompleteOCL Validation ....................................................................... 55 2.11.4. OCLinEcore for Xtext Validation ............................................................. 56 2.11.5. Complete OCL for Xtext Validation ......................................................... 56 2.12. OCL in UML (using Papyrus) ........................................................................... 56 2.12.1. UML Integration ................................................................................... 56 2.12.2. Class Diagram ...................................................................................... 57 2.12.3. State Machine Diagram .......................................................................... 61 2.13. OCL Constraint Examples for UML (using Papyrus) .............................................. 62 2.13.1. Model Constraints ................................................................................. 63 2.13.2. Profile Constraints ................................................................................. 66 2.14. User Interface ................................................................................................. 70 2.14.1. Project Property Pages ........................................................................... 70 2.14.2. Workspace Preference Pages ................................................................... 71 2.14.3. Overall Options .................................................................................... 71 2.14.4. Ecore and UML Options ........................................................................ 72 2.14.5. UML Options ....................................................................................... 73 2.14.6. Model Registry ..................................................................................... 73 2.14.7. Syntax Coloring .................................................................................... 73 2.14.8. Editor Templates ................................................................................... 73 2.14.9. OCLinEcore Options ............................................................................. 74 3. The OCL Standard Library ........................................................................................ 75 3.1. Precedences .................................................................................................... 75 3.2. Bag(T) ....................................................................................................... 75 3.3. Boolean ..................................................................................................... 76 3.4. Class .......................................................................................................
Recommended publications
  • Build an Eclipse Development Environment for Perl, Python, and PHP Use the Dynamic Languages Toolkit (DLTK) to Create Your Own IDE
    Build an Eclipse development environment for Perl, Python, and PHP Use the Dynamic Languages Toolkit (DLTK) to create your own IDE Skill Level: Intermediate Matthew Scarpino ([email protected]) Java Developer Eclipse Engineering, LLC 03 Feb 2009 Eclipse presents a wealth of capabilities for building tools for compiled languages like C and the Java™ programming language, but provides little support for scripting languages like Perl, Python, and PHP. For these and similar languages, the Eclipse Dynamic Languages Toolkit (DLTK) comes to the rescue. Walk through the process of building a DLTK-based IDE and discover sample code for each step. Section 1. Before you start About this tutorial This tutorial shows how Eclipse's DLTK makes it possible to build development tools for scripting languages. In particular, it explains how to implement syntax coloring, user preferences, and interpreter integration in a plug-in-based project. Objectives This tutorial explains — one step at a time — how to build a DLTK-based Build an Eclipse development environment for Perl, Python, and PHP © Copyright IBM Corporation 2008. All rights reserved. Page 1 of 33 developerWorks® ibm.com/developerWorks development environment. The discussion presents the DLTK by focusing on a practical plug-in project based on the Octave numerical computation language. Topics covered include: Frequently used acronyms • DLTK: Dynamic Languages Toolkit • GPL: GNU Public License • IDE: Integrated Development Environment • JRE: Java Runtime Environment • MVC: Model-View-Controller • SWT: Standard Widget Toolkit • UI: User Interface • Creating a plug-in project. • Configuring the editor and the DLTK text tools. • Adding classes to control syntax coloring in the text editor.
    [Show full text]
  • Customizing Eclipse RCP Applications Techniques to Use with SWT and Jface
    Customizing Eclipse RCP applications Techniques to use with SWT and JFace Skill Level: Intermediate Scott Delap ([email protected]) Desktop/Enterprise Java Consultant Annas Andy Maleh ([email protected]) Consultant 27 Feb 2007 Most developers think that an Eclipse Rich Client Platform (RCP) application must look similar in nature to the Eclipse integrated development environment (IDE). This isn't the case, however. This tutorial will explain a number of simple techniques you can use with the Standard Widget Toolkit (SWT) and JFace to create applications that have much more personality than the Eclipse IDE. Section 1. Before you start About this tutorial This tutorial will explain a number of UI elements that can be changed in Eclipse RCP, JFace, and SWT. Along the way, you will learn about basic changes you can make, such as fonts and colors. You will also learn advanced techniques, including how to create custom wizards and section headers. Using these in conjunction should provide you the ability to go from a typical-looking Eclipse RCP application to a distinctive but visually appealing one. Prerequisites Customizing Eclipse RCP applications © Copyright IBM Corporation 1994, 2008. All rights reserved. Page 1 of 40 developerWorks® ibm.com/developerWorks You should have a basic familiarity with SWT, JFace, and Eclipse RCP. System requirements To run the examples, you need a computer capable of adequately running Eclipse V3.2 and 50 MB of free disk space. Section 2. Heavyweight and lightweight widgets Before diving into techniques that can be used to modify SWT, JFace, and Eclipse RCP in general, it's important to cover the fundamental characteristics of SWT and how they apply to the appearance of the widget set.
    [Show full text]
  • Recoder with Eclipse
    School of Mathematics and Systems Engineering Reports from MSI - Rapporter från MSI Recoder with Eclipse Saúl Díaz González Álvaro Pariente Alonso June MSI Report 09031 2009 Växjö University ISSN 1650-2647 SE-351 95 VÄXJÖ ISRN VXU/MSI/DA/E/--09031/--SE Abstract RECODER is a Java framework aimed at source code analysis and metaprogramming. It works on several layers to offer a set of semi-automatic transformations and tools, ranging from a source code parser and unparser, offering a highly detailed syntactical model, analysis tools which are able to infer types of expressions, evaluate compile-time constants and keep cross-reference information, to transformations of the very Java sources, containing a library of common transformations and incremental analysis capabilities. These make up an useful set of tools which can be extended to provide the basis for more advanced refactoring and metacompiler applications, in very different fields, from code beautification and simple preprocessors, stepping to software visualization and design problem detection tools to adaptive programming environments and invasive software composition. The core system development of RECODER started in the academic field and as such, it was confined into a small platform of users. Although a powerful tool, RECODER framework lacks usability and requires extensive and careful configuration to work properly. In order to overcome such limitations, we have taken advantage of the Eclipse Integrated Development Environment (Eclipse IDE) developed by IBM, specifically its Plugin Framework Architecture to build a tool and a vehicle where to integrate RECODER functionalities into a wide-used, well-known platform to provide a semi- automated and user-friendly interface.
    [Show full text]
  • Xtext / Sirius - Integration the Main Use-Cases
    Xtext / Sirius - Integration The Main Use-Cases White Paper December 2017 SUMMARY Chapter 1 Introduction 1 Chapter 2 Let’s start 2 Chapter 2.1 What modeling is about? 2 Chapter 2.2 Benefits of graphical modeling 3 Chapter 2.3 Benefits of textual modeling 5 Chapter 3 What is Xtext? 6 Chapter 4 What is Sirius? 8 Chapter 5 Xtext & Sirius in action 10 Chapter 5.1 Case 1: Editing the same models both graphically and textually 10 Chapter 5.2 Case 2: Embedding an Xtext Editor into Sirius 15 Chapter 6 How may we help you? 18 Introduction Introduction You are going to create a domain-specific modeling tool and you wonder how users will edit and visualize the models: textually with a dedicated syntax and a rich textual editor ? or graphically with diagrams drawn with a palette and smart tools? Both approaches are interesting and can be used complementary: While text is able to carry more detailed information, a diagram highlights the relationship between elements much better. In the end, a good tool should combine both, and use each notation where it suits best. In this white paper, we will explain the benefits of each approach. Then we will present Eclipse Xtext and Eclipse Sirius, two open-source frameworks for the development of textual and graphical model editors. And finally, we will detailed two use-cases where these two technologies can be integrated in the same modeling workbench. 1 Let’s start Let’s start What modeling is about? Before presenting the graphical and textual modeling approaches, it is important to briefly clarify what we mean by modeling.
    [Show full text]
  • Eclipse (Software) 1 Eclipse (Software)
    Eclipse (software) 1 Eclipse (software) Eclipse Screenshot of Eclipse 3.6 Developer(s) Free and open source software community Stable release 3.6.2 Helios / 25 February 2011 Preview release 3.7M6 / 10 March 2011 Development status Active Written in Java Operating system Cross-platform: Linux, Mac OS X, Solaris, Windows Platform Java SE, Standard Widget Toolkit Available in Multilingual Type Software development License Eclipse Public License Website [1] Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system. It is written mostly in Java and can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Perl, PHP, Python, Ruby (including Ruby on Rails framework), Scala, Clojure, and Scheme. The IDE is often called Eclipse ADT for Ada, Eclipse CDT for C/C++, Eclipse JDT for Java, and Eclipse PDT for PHP. The initial codebase originated from VisualAge.[2] In its default form it is meant for Java developers, consisting of the Java Development Tools (JDT). Users can extend its abilities by installing plug-ins written for the Eclipse software framework, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules. Released under the terms of the Eclipse Public License, Eclipse is free and open source software. It was one of the first IDEs to run under GNU Classpath and it runs without issues under IcedTea. Eclipse (software) 2 Architecture Eclipse employs plug-ins in order to provide all of its functionality on top of (and including) the runtime system, in contrast to some other applications where functionality is typically hard coded.
    [Show full text]
  • Galileo Release Train 2009
    Galileo Release Train 2009 1 6 Years in a Row 33 Projects 24 million LOC 23 Projects 18 million LOC 21 Projects 17 million LOC 10 Projects WTP BIRT TPTP TPTP EMF CDT VE CDT Ganymede Galileo Eclipse 3.0 Eclipse 3.1 Callisto Europa June 28 2004 June 28 2005 June 30 2006 June 29, 2007 June 25, 2008 June 24, 2008 2 Galileo Stats - 33 project teams - 24+ million LOC - 44 companies providing committers 3 Why a release train? Help spur commercial adoption of Eclipse technology Consumers use many projects not just the Platform Inter-dependency between projects Eclipse project teams are independent BUT the project code is inter-dependent. Alignment of version compatibility Remove latency between project releases 4 How did we make it happen? Architecture Modular & Extensible Architecture vs Monolithic Release Governance Projects remain independent Process Open source development process Frequent milestone releases 5 Key Themes Advancement in Eclipse Runtime Technology Growth of Eclipse Modeling Domain Specific Languages Expanding Enterprise Adoption 6 Eclipse Runtime Technology New Support for OSGi in Equinox Implementation of the new OSGi 4.2 specification Distributed OSGi services PDE Improvements OSGI Declarative Services tooling Publish to a p2 repository API Analysis Tools Target platform support in PDE Make it easier to develop software that runs on EclipseRT runtimes EclipseRT runtime SDKs available in Galileo repository PDE tooling P2 Provisioning Improvements More flexible UI for RCP applications New Publisher tool that make it easier to publish content to repositories 7 Modeling Domain Specific Languages Developers need to deal with a growing set of APIs APIs for different infrastructure services, standards, business standards, etc.
    [Show full text]
  • Eclipse Roadmap V5
    Eclipse RoadMap v5 Introduction As required by the Eclipse Development Process, this document describes the 2010 Eclipse Roadmap. There are three main sections to this document: 1. This Preamble provides some background on Eclipse and the Foundation, and identifies the strategic goals of Eclipse. It also provides a brief overview of the scope of future projects 2. The Themes and Priorities which has been developed by the Eclipse Councils. 3. The Platform Release Plan which has been developed by the Eclipse Planning Council. The Roadmap is intended to be a living document which will see future iterations. This document is the fifth version of the Eclipse Roadmap, and is labeled as version 5.0. In order to preserve this document while the underlying information evolves, the pages have been frozen by copying them from their original project hosted locations. The goal of the Roadmap is to provide the Eclipse ecosystem with guidance and visibility on the future directions of the Eclipse open source community. An important element in this visibility is that the Roadmap help the EMO and the Board of Directors in determining which projects will be accepted by Eclipse during the life of this revision of the Roadmap. In other words, new projects must be consistent with the Roadmap. This does not mean that every new project must be explicitly envisaged by the Roadmap. It does mean that new projects cannot be inconsistent with the stated directions of Eclipse. In particular, Eclipse expects that incubator projects created in the Technology PMC will cover areas not explicitly described in the Roadmap.
    [Show full text]
  • Flexible Graphical Editors for Extensible Modular Meta Models
    X perf =1.00 X loss =0.01 SDSoftware Design and Quality Flexible Graphical Editors for Extensible Modular Meta Models Master’s Thesis of B.Sc. Michael Junker at the Department of Informatics Institute for Program Structures and Data Organization (IPD) Reviewer: Prof. Dr. Ralf Reussner Second reviewer: Jun.-Prof. Dr.-Ing. Anne Koziolek Advisor: Dipl.-Inform. Misha Strittmatter Second advisor: M.Sc. Heiko Klare 12. April 2016 – 11. October 2016 Karlsruher Institut für Technologie Fakultät für Informatik Postfach 6980 76128 Karlsruhe I declare that I have developed and written the enclosed thesis completely by myself, and have not used sources or means without declaration in the text. Karlsruhe, 10.October 2016 .................................... (B.Sc. Michael Junker) Abstract In model-driven software development, graphical editors can be used to create model instances more eciently and intuitively than with pure XML code. These graphical editors rely on models created on the basis of a meta-model. If such a meta-model is extended invasively not only its code has to be re-generated but also the graphical editor needs to be adapted. When developing multiple extensions, the meta-model as well as the corresponding graphical editor tend to get complex and error-prone. One way of coping with this complexity is to use modular meta-models and extending them noninvasively. However, having multiple meta-model fragments providing extended features is only half the job as equivalent graphical editors are needed as well. This master’s thesis therefore analyzes dierent types of extensions for meta-models as well as on graphical editor level.
    [Show full text]
  • RCP Applications
    Helios Wayne Beaton The Eclipse Foundation Copyright © 2010 Eclipse Foundation, Inc., Made available under the Eclipse Public License v 1.0 What is Eclipse? Copyright © 2010 Eclipse Foundation, Inc., Made available under the Eclipse Public License v 1.0 Eclipse is a Java IDE .Language-aware editors, views, ¼ .Refactoring support .Integrated unit testing and debugging .Incremental compilation and build .Team development support Copyright © 2010 Eclipse Foundation, Inc., Made available under the Eclipse Public License v 1.0 3 Eclipse is an IDE Framework .Eclipse + JDT = Java IDE . First class framework for Java, language aware editor, incremental build, integrated debugging, ... .Eclipse + CDT = C/C++ IDE . First class framework for C/C++, language aware editor, refactoring, search .Eclipse + PDT = PHP IDE .Eclipse + JDT + CDT + PDT = Java, C/C++, PHP IDE . Ruby, TCL, JavaScript, ... Copyright © 2010 Eclipse Foundation, Inc., Made available under the Eclipse Public License v 1.0 4 Eclipse is a Tools Framework .Plug-ins make Eclipse whatever you need it to be .Platform of frameworks and exemplary tools .Tools extend the platform using bundles/plug-ins . Business Intelligence and Reporting Tools, Web Tools, Data Tools, Eclipse Modeling Framework, ... Copyright © 2010 Eclipse Foundation, Inc., Made available under the Eclipse Public License v 1.0 5 Eclipse is a Application Framework .Remove the IDE elements; you're left with a general-purpose application framework . Linux, Windows, Mac OSX, UNIX, embedded . Rich widget set, graphics . Native-OS integration (drag and drop, OLE/XPCOM integration) .A platform for rich clients Copyright © 2010 Eclipse Foundation, Inc., Made available under the Eclipse Public License v 1.0 6 Eclipse is Runtimes! .Remove the UI elements and you©re left with a general-purpose component model .
    [Show full text]
  • EMF-REST: Generation of Restful Apis from Models
    EMF-REST: Generation of RESTful APIs from Models Hamza Ed-douibi, Javier Luis Cánovas Izquierdo, Abel Gómez, Massimo Tisi, Jordi Cabot AtlanMod team (Inria, Mines Nantes, LINA), Nantes, France {hamza.ed-douibi,javier.canovas,abel.gomez-llana, massimo.tisi,jordi.cabot}@inria.fr Abstract. In the last years, RESTful Web services have become more and more popular as a lightweight solution to connect remote systems in distributed and Cloud-based architectures. However, being an architectural style rather than a specification or standard, the proper design of RESTful Web services is not triv- ial since developers have to deal with a plethora of recommendations and best practices. Model-Driven Engineering (MDE) emphasizes the use of models and model trans- formations to raise the level of abstraction and semi-automate the development of software. In this paper we present an approach that leverages on MDE tech- niques to generate RESTful services. The approach, called EMF-REST, takes EMF data models as input and generates Web APIs following the REST princi- ples and relying on well-known libraries and standards, thus facilitating its com- prehension and maintainability. Additionally, EMF-REST integrates model and Web-specific features to provide model validation and security capabilities, re- spectively, to the generated API. For Web developers, our approach brings more agility to the Web development process by providing ready-to-run-and-test Web APIs out of data models. Also, our approach provides MDE practitioners the ba- sis to develop Cloud-based modeling solutions as well as enhanced collaborative support. 1 Introduction Web services have increasingly become popular mainly because they simplify clien- t/server decoupling and foster interoperability.
    [Show full text]
  • PRISM Model Checker As an Eclipse-Plugin
    MASARYK UNIVERSITY FACULTY}w¡¢£¤¥¦§¨ OF I !"#$%&'()+,-./012345<yA|NFORMATICS PRISM model checker as an Eclipse-plugin DIPLOMA THESIS Bc. Milan Malota Brno, Autumn 2015 Declaration Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. In Brno, January 11, 2016 Bc. Milan Malota Advisor: RNDr. Vojtechˇ Rehˇ ak,´ Ph.D. ii Acknowledgement I would like to thank my advisor Vojtechˇ Rehˇ ak´ for valuable advice, com- ments, support and patience during the writing of this thesis. I also want to express my gratitude to my family and my girlfriend for their support during studies. iii Abstract PRISM is a probabilistic model checker and is used in many different ap- plication domains and is well known among scientists dealing with formal modeling and analysis of systems that exhibit random or probabilistic be- havior. PRISM’s GUI was developed in the beginning of the PRISM life cycle and technologies made great progress so it can seem obsolete. That is why the request for a new GUI was pronounced. One of the platforms suitable for integrating an application and preferred by the original development team is the Eclipse platform. In the scope of this thesis we analyze available Eclipse platforms and notable graphical user interface frameworks. On the basis of the analysis new graphical user interface allowing all funcionality of the current PRISM GUI is implemented. iv Keywords PRISM, Eclipse RCP, Eclipse e4, AWT, Swing, SWT, JFace, Albireo v Contents 1 Introduction ...............................3 1.1 Motivation .............................3 2 Preliminaries ..............................5 2.1 PRISM model checker ......................5 2.1.1 The PRISM language .
    [Show full text]
  • Flexibility at the Roots of Eclipse
    6°ÊÈ >ʽäÇ Dynamic Wizard Modeling with GMF Introduction to the Using GMF to Build a Dynamic Wizard Generic Eclipse Framework and a Graphical Editor Modeling System Developing a Deploying the BIRT Graphical Modeling Viewer to JBoss Tool for Eclipse Disseminate Report Content to an Application Server Subversive The Eclipse Enabling Plug-In for Integration and Subversion Interoperability for Eclipse based Development An Introduction to the Corona Project Flexibility at the Roots of Eclipse Solving the GUI Dilemma: SWTSwing and Eclipse on Swing 6°ÊÈ >ʽäÇ Vol.6 January 2007 Dynamic Wizard Modeling with GMF Introduction to the Using GMF to Build a Dynamic Wizard Generic Eclipse Table of Contents Framework and a Graphical Editor Modeling System Developing a Deploying the BIRT Graphical Modeling Viewer to JBoss Tool for Eclipse Disseminate Report Content to an Application Server Subversive The Eclipse Enabling Plug-In for Integration and Subversion FEATURES Interoperability for Eclipse based Development An Introduction to the Corona Project Flexibility at the Roots of Eclipse 29 Flexibility at the Roots of Eclipse Solving the GUI Dilemma: SWTSwing and Eclipse on Solving the GUI Dilemma: Swing SWTSwing and Eclipse on Swing No trench in the world of Java is deeper then that between SWT and Swing or Eclipse and Sun. Unity is only found in the knowledge that everybody suff ers from this argument. But how to end this almost religious battle over the righteous GUI-toolkit? How to bang their heads together if they only know DEPARTMENT one point of view—for them or against them! Th e sister projects SWTSwing and Eclipse on Swing News & Trends (EOS) achieve this trick.
    [Show full text]