<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8334456010154055760</id><updated>2011-04-21T14:20:17.585-07:00</updated><title type='text'>OCL in Eclipse: This and That</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oclineclipse.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://oclineclipse.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Miguel Garcia</name><uri>http://www.blogger.com/profile/09949136685995342215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8334456010154055760.post-38644985495544887</id><published>2007-07-31T08:41:00.000-07:00</published><updated>2007-07-31T08:56:30.972-07:00</updated><title type='text'>OCL Tools proposal in Eclipse</title><content type='html'>I've submitted (along with A. Jibran Shidqie) a proposal to create an OCL Tools component at the MDT project. The official announcement has been made today on the eclipse.modeling.mdt newsgroup, you may participate in the discussion by going there.&lt;br /&gt;&lt;br /&gt;The text of the proposal follows:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;&lt;span style="font-size:130%;"&gt;OCL Tools&lt;/span&gt;&lt;/h1&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;I. Introduction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;OCL Tools is a proposed open source component&lt;br /&gt;in the &lt;a href="http://www.eclipse.org/modeling/mdt/"&gt;Model Development Tools (MDT)&lt;/a&gt; Project to  support the editing, refactoring, code generation, execution,  and interactive debugging of the OCL constraints given for some underlying (Ecore or UML2) class model, building upon the infrastructure provided by the MDT OCL component.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;This proposal is in the Project Proposal Phase (as defined in the &lt;a href="http://www.eclipse.org/projects/dev_process/development_process.php"&gt;Eclipse Development Process&lt;/a&gt; document) and is written to declare itsintent and scope. This proposal is written to solicit additionalparticipation and input from the Eclipse community. You are invited tocomment on and/or join the component. Please send all feedback to the  &lt;p&gt;&lt;a href="news://news.eclipse.org/eclipse.modeling.mdt"&gt;eclipse.modeling.mdt&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;newsgroup.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;span style="font-size:130%;"&gt;II. Background&lt;/span&gt;&lt;/h2&gt;&lt;br /&gt;The Eclipse infrastructure for modeling is based on EMF and UML2, with support&lt;br /&gt;for OCL 2.0 (Object Constraint Language) provided by the Model Development Tools (MDT) project. The expressive power of OCL allows capturing a sizable amount of development&lt;br /&gt;requirements in a declarative manner:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;(a.1) data modeling aspects can be expressed as an (Ecore or UML2) data&lt;br /&gt;schema further constrained by OCL invariants;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(a.2) a number of functional requirements can be specified as&lt;br /&gt;operation pre- and postconditions, together with&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(a.3) side-effects-free queries (defining the values of instance&lt;br /&gt;fields and operations)&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;As of now, OCL constraints can be evaluated at runtime by:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;(b.1) its textual representation into its Abstract Syntax Tree (AST)&lt;br /&gt;representation,&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt; (b.2) invoking an &lt;tt&gt;EvaluationVisitor&lt;/tt&gt; (also provided by MDT OCL)&lt;br /&gt;on the AST representation. Evaluation takes place in the context of an&lt;br /&gt;object population.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;The steps required to realize (b.1) and (b.2) are explained in the references listed below. Carrying out such steps presupposes knowledge well beyond writing OCL expressions.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; (c.1) for Ecore,  in an Eclipse Technical Article by Christian W. Damus&lt;br /&gt;("&lt;a href="http://www.eclipse.org/articles/article.php?file=Article-EMF-Codegen-with-OCL/index.html"&gt;Implementing Model Integrity in EMF with EMFT OCL&lt;/a&gt;") &lt;a href="http://www.blogger.com/post-create.g?blogID=8334456010154055760#biblio1"&gt;[3]&lt;/a&gt;,&lt;br /&gt;with an exemplary realization (custom JET templates). The user is expected to adapt such techniques (for example, in case a text file contains the OCL constraints as&lt;br /&gt;opposed to being available as annotations to an Ecore-based model).&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt; (c.2) for UML2, at &lt;a href="http://wiki.eclipse.org/index.php/MDT_1.0_New_and_Noteworthy#OCL_Integration"&gt;&lt;br /&gt;http://wiki.eclipse.org/index.php/MDT_1.0_New_and_Noteworthy#OCL_Integration&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;In order to bring usability of OCL specs on par with that of EMF and UML2,&lt;br /&gt;at the very least an OCL compiler is necessary, building upon (Ecore,UML2) -&gt;&lt;br /&gt;Java code generation and weaving (a.1) through (a.3) into the&lt;br /&gt;resulting Java code. In particular, the generated code can then be&lt;br /&gt;directly used as the Model component in an MVC architecture (for&lt;br /&gt;example, as part of a graphical editor generated with Eclipse GMF).&lt;br /&gt;Additionally, the compiled OCL expressions execute faster (twice on&lt;br /&gt;average) than their interpreted counterparts. In order to compare the performance of alternative compilation algorithms, a benchmark suite of OCL expressions would be desirable.&lt;br /&gt;&lt;p&gt;&lt;/p&gt;For OCL specifications to be seamlessly integrated in an MDSD toolchain, besides batch compilation, other tools are necessary:  custom text editor, source-level debugging support, i.e. IDE capability.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;span style="font-size:130%;"&gt;III. Scope&lt;/span&gt;&lt;/h2&gt;&lt;br /&gt;The objectives of the OCL Tools component are to:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;(d.1) provide a working implementation of a compilation algorithm&lt;br /&gt;targeting both EMF and UML2. That algorithm (in its EMF specialization)&lt;br /&gt;has been described in a position paper &lt;a href="http://www.blogger.com/post-create.g?blogID=8334456010154055760#biblio2"&gt;[2]&lt;/a&gt; submitted to the  &lt;a href="http://www.eclipsecon.org/summiteurope2007/index.php?page=symposia/#modeling"&gt;Modeling Symposium&lt;br /&gt;&lt;/a&gt;at  &lt;a href="http://www.eclipsecon.org/summiteurope2007"&gt;Eclipse Summit Europe 2007  &lt;/a&gt;and has been implemented in the code contribution mentioned below.  A related Eclipse Technical Article (&lt;a href="http://www.eclipse.org/articles/article.php?file=Article-HowToProcessOCLAbstractSyntaxTrees/index.html"&gt;"How to Process OCL Abstract Syntax Trees"&lt;/a&gt;) &lt;a href="http://www.blogger.com/post-create.g?blogID=8334456010154055760#biblio4"&gt;[4]&lt;/a&gt; has been contributed by one of the authors of&lt;br /&gt;this proposal, simplifying the learning curve for future contributors.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(d.2) provide sample (Ecore and UML2) + OCL models to speed up the adoption by&lt;br /&gt;first-time users of OCL Tools. Initially, two non-trivial models are to be made available:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; (d.2.a) Royal &amp; Loyal, described in the book on OCL by Warmer and Kleppe; and&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(d.2.b) a metamodel of the JPQL language (Java Persistence Query Language) which encodes as OCL invariants all the well-formedness rules ("static semantics")&lt;br /&gt;stated as English sentences in JSR-220 (described in  &lt;a href="http://www.sts.tu-harburg.de/%7Emi.garcia/pubs/atem06/paper/Garcia_ATEM06_Formalizing_the_well-formedness_rules_of_EJB3QL_in_UML_OCL.pdf"&gt;this paper&lt;/a&gt;)&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;(d.3)  solicit contributions to adapt the compilation algorithm&lt;br /&gt;embedded in our implementation to other domains:&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(d.3.a) first and foremost, to accept UML2 class models as input,&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(d.3.b) targeting object models other than Java&lt;br /&gt;(for example, by translating OCL constraints into the&lt;br /&gt;query language of Java Persistence API, the Object-Relational Mapping&lt;br /&gt;technology standardized by JSR-220).&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(d.4) provide IDE capability:&lt;br /&gt;&lt;/li&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;(d.4.a) a text editor supporting usability features such as syntax-directed completion, markers for violations of well-formedness, use-defs navigation, folding, and structural views (e.g., OCLASTView &lt;a href="http://www.blogger.com/post-create.g?blogID=8334456010154055760#biblio4"&gt;[4]&lt;/a&gt;)&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(d.4.b) refactoring support&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;(d.4.c) source-level, interactive debugging&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;IV. Description&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This section focuses on the functionality available in the code contribution.&lt;br /&gt;Pointers to related work are included in the next section ("Relationship with other Eclipse-based projects").&lt;br /&gt;&lt;br /&gt;An OCL compiler is available, which follows the classical software architecture of a&lt;br /&gt;batch compiler &lt;a href="http://www.blogger.com/post-create.g?blogID=8334456010154055760#biblio1"&gt;[1]&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;(e.1) a front-end component, shared among all&lt;br /&gt;"target architectures" (EMF and UML2). During the front-end phase,&lt;br /&gt;textual input is parsed into Concrete Syntax Trees&lt;br /&gt;(CSTs), which once validated are used to build the ASTs&lt;br /&gt;that compilation proper takes as input. These two activities involve a&lt;br /&gt;number of sub-steps, such as resolving mutual forward-references and&lt;br /&gt;collecting error markers. These sub-steps are realized with&lt;br /&gt;building blocks provided by MDT OCL, while bookkeeping and glue code&lt;br /&gt;has been added to hold everything together.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(e.2) the in-memory copy of the input model (our compiler does not&lt;br /&gt;modify the actual input) is decorated with EAnnotations that are&lt;br /&gt;taken later by EMF CodeGen (and in the future by UML2 CodeGen)&lt;br /&gt;as the source of method bodies and&lt;br /&gt;additional declarations: helper methods, helper types (e.g.&lt;br /&gt;those resulting from OCL tuples), and helper utilities (e.g. those to&lt;br /&gt;track all instances in a &lt;tt&gt;ResourceSet&lt;/tt&gt;, realizing OCL's &lt;tt&gt;allInstances()&lt;/tt&gt;)&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;Some patterns exhibited by the resulting code are (a more&lt;br /&gt;comprehensive exposition can be found in &lt;a href="http://www.blogger.com/post-create.g?blogID=8334456010154055760#biblio2"&gt;[2]&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(f.1) OCL preconditions and postconditions are translated into Java&lt;br /&gt;assert statements&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(f.2) OCL define and derive statements are translated into getters&lt;br /&gt;(for properties) and into method bodies (for operations)&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;(f.3) OCL invariants are translated into dedicated Java methods. It is&lt;br /&gt;the responsibility of the user to invoke them at times deemed&lt;br /&gt;appropriate.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;The OCL Compiler is packaged as an Eclipse plugin with a basic UI (an&lt;br /&gt;action for an &lt;tt&gt;IFile&lt;/tt&gt; to start compilation, a preferences page to&lt;br /&gt;choose compilation options). The input (as of now) is assumed&lt;br /&gt;to be a single &lt;tt&gt;.ecore&lt;/tt&gt; file accompanied by an &lt;tt&gt;.ocl&lt;/tt&gt; file with the same name.&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;&lt;span style="font-size:130%;"&gt;V. Relationship with Other Eclipse-based Projects&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The &lt;a href="http://domino.research.ibm.com/comm/research_projects.nsf/pages/safari.Introduction.html"&gt;SAFARI project&lt;/a&gt;  aims at generating an IDE out of the description of an object oriented, imperative programming language,  in principle covering the whole spectrum from structured editing to interactive debugging.&lt;br /&gt;&lt;a href="http://www.sts.tu-harburg.de/%7Emi.garcia/SoC2007/GenDSLToolsFromLangDef.pdf"&gt;&lt;br /&gt;Other efforts&lt;/a&gt; have focused on the structured editing and AST-building phases,&lt;br /&gt;with an emphasis on using as internal representation of ASTs&lt;br /&gt;an instantiation of an Ecore + OCL language metamodel ("eat your own dog food").&lt;br /&gt;&lt;/p&gt;&lt;a href="http://www.alphaworks.ibm.com/tech/emfatic"&gt;Emfatic&lt;/a&gt; has been extended by one of the authors of this proposals,  as documented in &lt;a href="http://www.sts.tu-harburg.de/%7Emi.garcia/SoC2007/ImprovementsToTheEmfaticEditor.pdf"&gt;http://www.sts.tu-harburg.de/~mi.garcia/SoC2007/ImprovementsToTheEmfaticEditor.pdf&lt;/a&gt; and in &lt;a href="http://www.sts.tu-harburg.de/%7Emi.garcia/SoC2007/draftreport.pdf"&gt;http://www.sts.tu-harburg.de/~mi.garcia/SoC2007/draftreport.pdf&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Refactoring of OCL expressions is the goal of the tool &lt;a href="http://www.roclet.org/"&gt;&lt;/a&gt;&lt;a href="http://www.roclet.org"&gt;http://www.roclet.org&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As resources such as the above on IDE-related issues become available,&lt;br /&gt;their application in the context of this component will be considered.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;span style="font-size:130%;"&gt;VI. Organization&lt;/span&gt;&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;VI.a) Initial committers&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;The initial committers will focus on evolving and hardening the OCL&lt;br /&gt;compiler, as input models are contributed by the community. The&lt;br /&gt;initial committers are also willing to provide know-how to the&lt;br /&gt;community on OCL tooling in general (e.g, for those developing&lt;br /&gt;translations from OCL into other languages, such as JPQL).  Our agile&lt;br /&gt;development process will follow eclipse.org's standards for openness&lt;br /&gt;and transparency.  The initial committers are:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt; Miguel Garcia (Technische Universitaet Hamburg-Harburg,&lt;br /&gt;Germany),  &lt;a href="http://www.sts.tu-harburg.de/%7Emi.garcia/"&gt;&lt;/a&gt;&lt;a href="http://www.sts.tu-harburg.de/%7Emi.garcia/"&gt;http://www.sts.tu-harburg.de/~mi.garcia/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;A. Jibran Shidqie (Technische Universitaet Hamburg-Harburg, Germany)&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;h3&gt;VI.b) Code contributions&lt;/h3&gt;&lt;br /&gt;The OCL Compiler for EMF described by its authors in &lt;a href="http://www.blogger.com/post-create.g?blogID=8334456010154055760#biblio2"&gt;[2]&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;VI.c) Interested parties&lt;/h3&gt;&lt;br /&gt;The team of initial committers will explore statements of interest&lt;br /&gt;from persons experienced in OCL processing or willing to gain such&lt;br /&gt;experience.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;VI.d) Developer community&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;We expect the initial set of committers to grow, as the intial contribution&lt;br /&gt;establishes a platform which automates the front-end phases of&lt;br /&gt;OCL processing (a common need for most, if not all, OCL processing tasks).&lt;br /&gt;&lt;br /&gt;There is an active OCL community, with participants from industry and&lt;br /&gt;academia attending (among others) the OCL workshop series at the&lt;br /&gt;MoDELS conference (&lt;a href="http://st.inf.tu-dresden.de/Ocl4All2007/"&gt;http://st.inf.tu-dresden.de/Ocl4All2007/&lt;/a&gt;). The&lt;br /&gt;techniques advanced by this community can naturally build upon and extend the&lt;br /&gt;tooling proposed here.&lt;br /&gt;&lt;br /&gt;Similarly, members of the growing QVT community usually have a&lt;br /&gt;background in OCL processing, and would be willing to have OCL play a&lt;br /&gt;bigger role in their techniques provided the proposed infrastructure is&lt;br /&gt;available.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;VI.e) User community&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Feedback from a large user community of commercial developers is&lt;br /&gt;critical to harvesting real-world and complete OCL&lt;br /&gt;specifications. Actually, harvesting such specifications reveals an&lt;br /&gt;egg-and-chicken problem: those specifying a system have a reduced&lt;br /&gt;incentive to invest effort in preparing OCL specs if they are to&lt;br /&gt;remain paper-only and thus not automatically enforceable. On the other&lt;br /&gt;hand, the developers of OCL tooling are reluctant to target a small&lt;br /&gt;audience. The OCL compiler component is good positioned to break this&lt;br /&gt;cycle, providing immediate benefit to the authors of OCL&lt;br /&gt;specifications in the form of a portable and efficient implementation&lt;br /&gt;of the (Ecore,UML2) + OCL spec given as input.&lt;br /&gt;&lt;br /&gt;The availability of OCL tooling will also expand the user base&lt;br /&gt;of directly related projects/components (OCL, EMF, UML2) thus&lt;br /&gt;accelerating the synergies of the Eclipse ecosystem.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;VII. Tentative Plan&lt;/h2&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;2007-07 v0.1: internal release for study in the EMF, UML2 and MDT OCL teams&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;2007-08 v0.2: public release for community study&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;span style="font-size:130%;"&gt;References&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[1] A. W. Appel and J. Palsberg. &lt;br /&gt;      Modern Compiler Implementation in Java. Cambridge University Press, New York, NY, USA, 2003. &lt;a href="http://www.cs.princeton.edu/%7Eappel/modern/java/"&gt;http://www.cs.princeton.edu/~appel/modern/java/&lt;/a&gt;&lt;br /&gt;&lt;dl&gt;&lt;dd&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;a name="biblio2"&gt;[2] &lt;/a&gt;OCL Compiler for EMF.&lt;br /&gt;      Garcia, M. and Shidqie, A. J.       Submission to Modeling Symposium at Eclipse Summit Europe 2007.&lt;br /&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;a name="biblio3"&gt;[3]&lt;/a&gt; &lt;a href="http://www.eclipse.org/articles/article.php?file=Article-EMF-Codegen-with-OCL/index.html"&gt;Implementing Model Integrity in EMF with MDT OCL&lt;/a&gt;&lt;br /&gt;  Christian W. Damus, Eclipse Technical Article,&lt;br /&gt;&lt;br /&gt;&lt;dl&gt;&lt;dt&gt;&lt;a name="biblio4"&gt;[4]  &lt;/a&gt;&lt;a href="http://www.eclipse.org/articles/article.php?file=Article-HowToProcessOCLAbstractSyntaxTrees/index.html"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;How to process OCL Abstract Syntax Trees&lt;/a&gt;Miguel Garcia, Eclipse Technical Article,&lt;br /&gt;&lt;/dt&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/dl&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8334456010154055760-38644985495544887?l=oclineclipse.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oclineclipse.blogspot.com/feeds/38644985495544887/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8334456010154055760&amp;postID=38644985495544887' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/38644985495544887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/38644985495544887'/><link rel='alternate' type='text/html' href='http://oclineclipse.blogspot.com/2007/07/ocl-tools-proposal-in-eclipse.html' title='OCL Tools proposal in Eclipse'/><author><name>Miguel Garcia</name><uri>http://www.blogger.com/profile/09949136685995342215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8334456010154055760.post-713412323874827889</id><published>2007-05-13T07:03:00.000-07:00</published><updated>2007-05-13T07:45:17.867-07:00</updated><title type='text'>cross-artifact queries</title><content type='html'>While extremely useful in themselves, the tools discussed in the &lt;a href="http://oclineclipse.blogspot.com/2007/05/querying-source-code-and-other.html"&gt;previous entry&lt;/a&gt; are limited to querying source-code artifacts only: configuration files, plugin.xml, etc. are left out (precisely, those for which checks such as referential integrity would be most useful). Examples of referential integrity for Struts and Eclipse Workbench plugins are provided by Michał Antkiewicz &lt;a href="http://gp.uwaterloo.ca/files/2007-antkiewicz-fsmls-examples-capabilities-mechanisms.pdf%20"&gt;here&lt;/a&gt; (not in OCL, unfortunately, although OCL has enough expressive power to encode the consistency he considers)&lt;br /&gt;&lt;br /&gt;Software artifacts, once available as instances of Ecore-based model, can be queried with OCL. Some useful links for this task:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;an Ecore-based metamodel of Java (without OCL well-formedness rules) has been contributed by Mikael Barbero (INRIA) and can be found &lt;a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3/org.eclipse.am3.zoos.atlantEcore/JavaAbstractSyntax.ecore?root=Technology_Project&amp;view=markup"&gt;here&lt;/a&gt; (for a tree-based visualization follow &lt;a href="http://www.metamodelbrowser.org/BrowseTreeServlet?url=http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3/org.eclipse.am3.zoos.atlantEcore/JavaAbstractSyntax.ecore?root=Technology_Project&amp;amp;amp;amp;view=co&amp;amp;head=JavaAbstractSyntax"&gt;this link&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;the MM above can be used in conjunction with &lt;a href="http://www.eclipse.org/gmt/modisco/toolBox/JavaAbstractSyntax/"&gt;this plugin&lt;/a&gt;, which instantiates such metamodel for a compilation unit of choice (using the JDT infrastructure)&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;more sample code for querying the “raw” AST offered by the JDT can be found in &lt;a href="http://www.eclipse.org/jdt/ui/astview/index.php"&gt;ASTView&lt;/a&gt;. In order to understand in detail the type information of a given Java file, these &lt;a href="http://kathrin.dagstuhl.de/files/Materials/05/05251/05251.FuhrerRobert1.Slides.ppt"&gt;tutorial slides&lt;/a&gt; prove extremely useful. &lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Querying a Java AST is usually cumbersome given its detailed nature. As in databases, having a stock of parameterized queries (to filter only those items useful for the task at hand) goes a long way towards improving usability.&lt;br /&gt;&lt;br /&gt;It looks to me that until the following critical mass is necessary:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;libraries of metamodels (with WFRs)&lt;/li&gt;&lt;li&gt;plugins to parse software artifacts into those metamodels&lt;/li&gt;&lt;li&gt;pre-defined queries for repetitive tasks on those metamodels &lt;/li&gt;&lt;li&gt;efficient mechanisms to evaluate queries, author them, and to visualize their results&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;in order to realize the whole potential of software repositories. Wow, that sounds like a "research agenda" ... spooky!&lt;br /&gt;&lt;br /&gt;"Watch this space!" :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8334456010154055760-713412323874827889?l=oclineclipse.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oclineclipse.blogspot.com/feeds/713412323874827889/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8334456010154055760&amp;postID=713412323874827889' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/713412323874827889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/713412323874827889'/><link rel='alternate' type='text/html' href='http://oclineclipse.blogspot.com/2007/05/cross-artifact-queries.html' title='cross-artifact queries'/><author><name>Miguel Garcia</name><uri>http://www.blogger.com/profile/09949136685995342215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8334456010154055760.post-5041303635475091156</id><published>2007-05-13T06:25:00.000-07:00</published><updated>2007-05-13T07:28:06.006-07:00</updated><title type='text'>querying source code and other artifacts</title><content type='html'>Now that agreement exists on the parsed representation of Java source code (the JDT ASTs), non-standardization has moved to the languages to query such ASTs. What is querying over ASTs good for? Examples:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;checking coding styles (such as naming conventions)&lt;/li&gt;&lt;li&gt;fault detection (to discover bugs at development time)&lt;/li&gt;&lt;li&gt;refactoring (to detect code smells, optimise and improve code design)&lt;/li&gt;&lt;li&gt;metrics (for measuring the complexity of the code)&lt;/li&gt;&lt;li&gt;aspect weaving (to identify join point shadows of interest)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Let's compare some Eclipse plugins addressing this field. For each alternative below an example is included to convey a flavor of the language (I haven’t been able to find the &lt;span style="font-style: italic;"&gt;same&lt;/span&gt; query being expressed in &lt;span style="font-style: italic;"&gt;all&lt;/span&gt; languages, that would ease comparison):&lt;br /&gt;&lt;br /&gt;a) SCL&lt;br /&gt;"Constructors must not invoke overridable methods, directly or indirectly, that access a (potentially uninitialized) instance variable"&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_t9CEblyaQHs/RkcSXNyC85I/AAAAAAAAABY/zzJyHyi1LhI/s1600-h/CtorCallVirtual-h1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_t9CEblyaQHs/RkcSXNyC85I/AAAAAAAAABY/zzJyHyi1LhI/s400/CtorCallVirtual-h1.png" alt="" id="BLOGGER_PHOTO_ID_5064036496047272850" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;b) PMD,&lt;br /&gt;"While loops must use braces”&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;public class WhileLoopsMustUseBracesRule&lt;br /&gt;extends AbstractRule {&lt;br /&gt;  public Object visit(ASTWhileStatement node, Object data) {&lt;br /&gt;    SimpleNode firstStmt = (SimpleNode)node.jjtGetChild(1);&lt;br /&gt;    if (!hasBlockAsFirstChild(firstStmt)) {&lt;br /&gt;      addViolation(data, node);&lt;br /&gt;    }&lt;br /&gt;    return super.visit(node,data);&lt;br /&gt;  }&lt;br /&gt;  private boolean hasBlockAsFirstChild(SimpleNode node) {&lt;br /&gt;    return (node.jjtGetNumChildren() != 0 &amp;&amp;amp; (node.jjtGetChild(0) instanceof ASTBlock));&lt;br /&gt;  }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;c) JQuery&lt;br /&gt;"List all public Getters"&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_t9CEblyaQHs/RkcUj9yC86I/AAAAAAAAABg/UQuFJRFNftM/s1600-h/queryEdit.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_t9CEblyaQHs/RkcUj9yC86I/AAAAAAAAABg/UQuFJRFNftM/s400/queryEdit.png" alt="" id="BLOGGER_PHOTO_ID_5064038914113860514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;d) CodeQuest&lt;br /&gt;"Lookup all implementations of an abstract method"&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;?query3(M1,M2) :- hasStrModifier(M1,'abstract'), overrides(M2,M1),            NOT(hasStrModifier(M2, 'abstract')).&lt;br /&gt;&lt;br /&gt;overrides(M1,M2) :- strongLikeThis(M1,M2), hasChild(C1,M1),&lt;br /&gt;hasChild(C2,M2), inheritableMethod(M2),&lt;br /&gt;hasSubtypePlus(C2,C1).&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The above list is incomplete, and that’s a sign of duplicate work: queries to detect particular code-smells are being expressed (slightly differently?) in different notations.&lt;br /&gt;&lt;br /&gt;Bringing it down to a few words, the pros of the different approaches are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;SCL: harmonizing formality (the definition of SCL is formal) and readability&lt;/li&gt;&lt;li&gt;PMD: letting the user add new queries (if familiar with the detailed structured of ASTs)&lt;/li&gt;&lt;li&gt;JQuery: provide Eclipse-integrated structured viewers to display (and thus navigate) results&lt;/li&gt;&lt;li&gt;CodeQuest: efficient query-answering (Datalog queries are quite proficiently optimized by industrial-strength RDBMSs)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;So each product has its stronghold. In &lt;a href="http://oclineclipse.blogspot.com/2007/05/cross-artifact-queries.html"&gt;the next blog entry&lt;/a&gt;, I’ll comment on yet another approach to querying software artifacts, comparing how if fares to those mentioned here. We’re dealing with conflicting requirements (for example, expressiveness vs. efficiency) so &lt;span style="font-style: italic;"&gt;any&lt;/span&gt; choice will involve &lt;span style="font-style: italic;"&gt;some&lt;/span&gt; trade-offs.&lt;br /&gt;&lt;br /&gt;References&lt;br /&gt;&lt;br /&gt;[1] SCL, &lt;a href="http://people.clarkson.edu/%7Edhou/projects/SCL.html"&gt;http://people.clarkson.edu/%7Edhou/projects/SCL.html&lt;/a&gt;&lt;br /&gt;[2] PMD, &lt;a href="http://pmd.sourceforge.net/"&gt;http://pmd.sourceforge.net/&lt;/a&gt;&lt;br /&gt;[3] JQuery, &lt;a href="http://jquery.cs.ubc.ca/"&gt;http://jquery.cs.ubc.ca&lt;/a&gt;&lt;br /&gt;[4] CodeQuest, &lt;a href="http://progtools.comlab.ox.ac.uk/projects/codequest"&gt;http://progtools.comlab.ox.ac.uk/projects/codequest&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Additional projects similar to all of the above are listed at:&lt;br /&gt;&lt;a href="http://pmd.sourceforge.net/similar-projects.html"&gt;http://pmd.sourceforge.net/similar-projects.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8334456010154055760-5041303635475091156?l=oclineclipse.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oclineclipse.blogspot.com/feeds/5041303635475091156/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8334456010154055760&amp;postID=5041303635475091156' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/5041303635475091156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/5041303635475091156'/><link rel='alternate' type='text/html' href='http://oclineclipse.blogspot.com/2007/05/querying-source-code-and-other.html' title='querying source code and other artifacts'/><author><name>Miguel Garcia</name><uri>http://www.blogger.com/profile/09949136685995342215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_t9CEblyaQHs/RkcSXNyC85I/AAAAAAAAABY/zzJyHyi1LhI/s72-c/CtorCallVirtual-h1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8334456010154055760.post-4517328747948135551</id><published>2007-05-09T11:23:00.000-07:00</published><updated>2007-05-09T11:55:02.229-07:00</updated><title type='text'>an OCL bibliography</title><content type='html'>&lt;p&gt;Some time ago (two years in fact) I compiled a bibliography of papers, with a focus on showing best-practices around usage of OCL. Surprisingly, most references are still relevant. I hope this list can be useful as a starting point for further exploration. The categories are listed in no particular order, with a selection of papers for each.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Configuration Management&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Felfernig, &lt;a href="http://143.205.180.128/IWAS/Publications/pubfiles/pdffiles/2004-0128-FA.pdf"&gt;A.Extending Configuration Models using OCL&lt;/a&gt;&lt;br /&gt;Technical Report KLU-IFI-2004-19 &lt;/li&gt;&lt;li&gt;Felfernig A., Friedrich G., Jannach D., Zanker M.&lt;br /&gt;&lt;a href="http://143.205.180.128/IWAS/Publications/pubfiles/pdffiles/2002-0145-AFGF.pdf"&gt;Configuration Knowledge Representation using UML/OCL&lt;br /&gt;&lt;/a&gt;Proceedings Fifth International Conference on the Unified Modeling Language - theLanguage and its applications UML'2002, 2002, Dresden, Germany&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;OCL and AspectJ&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;L. Briand, W. J. Dzidek and Y. Labiche,&lt;br /&gt;&lt;a href="http://www.sce.carleton.ca/squall/pubs/tech_report/TR_SCE-04-03.pdf"&gt;Using Aspect-Oriented Programming to Instrument OCL Contracts in Java&lt;/a&gt;&lt;br /&gt;Software Quality Laboratory, Carleton University, Technical Report(SCE-04-03), 2004&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Refactoring OCL, OCL rewriting&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;S. Markovic and T. Baar&lt;br /&gt;&lt;a href="http://lgl.epfl.ch/pub/Papers/baar-2005-models.pdf"&gt;Refactoring OCL Annotated UML Class Diagrams&lt;/a&gt;&lt;br /&gt;Proceedings of MoDELS 2005, Vol. 3713, pp. 280-294, 2005&lt;/li&gt;&lt;li&gt;M. Giese, D. Larsson&lt;br /&gt;&lt;a href="http://www.ricam.oeaw.ac.at/people/page/giese/pub/models05.pdf"&gt;Simplifying Transformations of OCL Constraints&lt;/a&gt;&lt;br /&gt;Proceedings of Models 2005, Montego Bay&lt;/li&gt;&lt;li&gt;Martin Giese, Reiner Hähnle, Daniel Larsson.&lt;br /&gt;&lt;a href="http://www.ricam.oeaw.ac.at/people/page/giese/pub/ocl04sim.pdf"&gt;Rule-Based Simplification of OCL Constraints&lt;/a&gt;&lt;br /&gt;UML2004 workshop on OCL and Model Driven Engineering, Lisbon.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;OCL for software artifacts&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;G. Antoniol, M. Di Penta, E. Merlo&lt;br /&gt;&lt;a href="http://staff.rcost.unisannio.it/mdipenta/papers/iwpc2003.pdf"&gt;YAAB (Yet Another AST Browser): Using OCL to Navigate AST&lt;/a&gt;&lt;br /&gt;Proceedings of the 11th IEEE International Workshop on Program Comprehension, May 2003, Portland, Oregon (USA)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;OCL for modeling of Software Architecture&lt;/strong&gt;&lt;/p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;ul&gt;&lt;li&gt;U. Zdun and P. Avgeriou&lt;br /&gt;&lt;a href="http://wi.wu-wien.ac.at/home/uzdun/publications/re8-zdun.pdf"&gt;Modeling architectural patterns using architectural primitives&lt;/a&gt;&lt;br /&gt;In Proceedings of the 20th ACM Conference on Object-Oriented Programming, Systems,&lt;br /&gt;Languages &amp;amp; Applications (OOPSLA 2005), pages 133-146, San Diego, CA, USA,&lt;br /&gt;October 2005. ACM Press&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;ORDBMS-based software repositories&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Ritter, N., Steiert, H.-P.&lt;br /&gt;&lt;a href="http://wwwdvs.informatik.uni-kl.de/pubs/papers/RS00.IRMA.pdf"&gt;Enforcing Modeling Guidelines in an ORDBMS-based UML Repository&lt;/a&gt;&lt;br /&gt;IRMA 2000, Anchorage, Alaska&lt;/li&gt;&lt;li&gt;OCL Support in MOF Repositories&lt;br /&gt;&lt;a href="http://modeldrivenarchitecture.esi.es/pdf/paper5-3.pdf"&gt;http://modeldrivenarchitecture.esi.es/pdf/paper5-3.pdf&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;OCL codifying business rules&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.lbd.dcc.ufmg.br/sbbd2003/artigos/paper010.pdf"&gt;Enforcement of business rules in relational databases using constraints&lt;/a&gt;&lt;br /&gt;Zimbrão G., Miranda R., Moreira de Souza J., Estolano M. H., Neto F. P.,&lt;br /&gt;XVIII Simpósio Brasileiro de Bancos de Dados - Manaus,AM, Brasil - 2003&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Translation of OCL to XQuery&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;S. Sakr, A. Gaafar&lt;br /&gt;&lt;a href="http://www.inf.uni-konstanz.de/~sakr/Framework.pdf"&gt;Towards A Framework for Mapping Between UML/OCL and XML/XQuery&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Generation of proof conditions&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Hamie A.&lt;br /&gt;&lt;a href="http://cmis.mis.brighton.ac.uk/Research/vmg/papers/SEA02.pdf"&gt;Towards Verifying Java Realizations of OCL-Constrained Design Models Using JML&lt;/a&gt;&lt;br /&gt;Proc. 6th IASTED International Conference on Software Engineering and Applications&lt;br /&gt;(SEA'2002), MIT, Cambridge, USA, 2002&lt;/li&gt;&lt;li&gt;Hamie A.&lt;br /&gt;&lt;a href="http://cmis.mis.brighton.ac.uk/Research/vmg/papers/SAC2004.pdf"&gt;Translating the Object Constraint Language into JML&lt;/a&gt;&lt;br /&gt;SAC'04, 19th ACM Symposium on Applied Computing, Nicosia, Cyprus, March 2004&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8334456010154055760-4517328747948135551?l=oclineclipse.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oclineclipse.blogspot.com/feeds/4517328747948135551/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8334456010154055760&amp;postID=4517328747948135551' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/4517328747948135551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/4517328747948135551'/><link rel='alternate' type='text/html' href='http://oclineclipse.blogspot.com/2007/05/some-time-ago-two-years-in-fact-i.html' title='an OCL bibliography'/><author><name>Miguel Garcia</name><uri>http://www.blogger.com/profile/09949136685995342215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8334456010154055760.post-8294350576480215372</id><published>2007-05-09T10:19:00.000-07:00</published><updated>2007-05-09T11:52:41.578-07:00</updated><title type='text'>verbalizing OCL</title><content type='html'>Tools to "read aloud" a formal specification belong to the basic repertoire of the (Controlled) Natural Language research community. "Reading aloud" more like paraphrasing, e.g.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;div style="TEXT-ALIGN: center"&gt;∀x.Number(x)∧Prime(x)∧LessThan(x,3)⇒Even(x)&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="TEXT-ALIGN: left"&gt;can be rewritten into&lt;br /&gt;&lt;div style="TEXT-ALIGN: center"&gt;Every prime number less than 3 is even&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;A tool along these lines for OCL is &lt;a href="http://www.key-project.org/oclnl/"&gt;OCLNL&lt;/a&gt;. Given this OCL as input:&lt;br /&gt;&lt;br /&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none"&gt;&lt;span lang="EN-US"   style="font-family:';font-size:100%;"&gt;context Copy&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none"&gt;&lt;span lang="EN-US"   style="font-family:';font-size:10;"&gt;&lt;span style="font-size:100%;"&gt;inv: Copy.allInstances()-&gt;forAll(c1,c2&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;not (c1=c2) implies not (c1.barCode=c2.barCode))&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;The verbalization computed by OCLNL is: &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse" cellspacing="0" cellpadding="0" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 442.8pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid" valign="top" width="590"&gt;&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;for the class &lt;b&gt;Copy &lt;/b&gt;the following invariants hold : &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul type="disc"&gt;&lt;li class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;for all copies c2 , c1 in the set of all instances of Copy &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 36pt"&gt;&lt;span lang="EN-US"&gt;if it is not the case that &lt;i&gt;c1 &lt;/i&gt;is equal to &lt;i&gt;c2 &lt;/i&gt;then this implies that it is not the case that the bar code of &lt;i&gt;c1 &lt;/i&gt;is equal to the bar code of &lt;i&gt;c2 &lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;OCLNL has been applied to JavaCard APIs (security aspects mostly) and similar real-world case studies. Papers and theses can be found in the &lt;a href="http://www.key-project.org/oclnl/"&gt;OCLNL homepage&lt;/a&gt; , the &lt;a href="http://www.key-project.org/oclnl/techdoc.html"&gt;technical doc&lt;/a&gt; makes us aware to the fact that the core of OCLNL has been implemented in Haskell (but hey, if you've mastered Java's type system then you've accomplished more than you need to learn Haskell). The input models are not Ecore-based.&lt;br /&gt;&lt;/p&gt;One quick way to get your hands dirty in this playground (verbalization of Ecore + OCL models) consists in detecting patterns in OCL Abstract Syntax Trees (ASTs) for which there's an (empirically convenient) English-language paraphrasing. For example, there's one such pattern behind the invariant above, that allows its translation to the more compact:&lt;br /&gt;&lt;br /&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;Two different copies have different bar codes&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;In a way, that's not playing fair, because covering just some such patterns from all those that may show up in valid OCL ASTs does not get the full job done. Still, it's interesting if you want to try your hand at processing OCL ASTs ... which brings me to the real plunge I wanted to make: take a look at my article on that very subject, &lt;a href="http://www.eclipse.org/articles/article.php?file=Article-HowToProcessOCLAbstractSyntaxTrees/index.html"&gt;How to process OCL Abstract Syntax Trees&lt;/a&gt; , and its accompanying Eclipse-based plugin. With it, you can do cool stuff such as:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_t9CEblyaQHs/RkII0dyC8zI/AAAAAAAAAAs/YZMn6uk04Hw/s1600-h/implicitIteratorVar.PNG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5062618628558615346" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_t9CEblyaQHs/RkII0dyC8zI/AAAAAAAAAAs/YZMn6uk04Hw/s400/implicitIteratorVar.PNG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;'nuff said! Actually a big advantage of turning a formal spec into controlled natural language is the larger audience that can review it (and thus find errors). This aspect is highlighted in &lt;a href="http://www.cs.chalmers.se/~krijo/gfspec/burke/"&gt;David Burke's master thesis&lt;/a&gt;, an excerpt follows:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_t9CEblyaQHs/RkIKDdyC80I/AAAAAAAAAA0/GaEhKHTZriI/s1600-h/errorDiscovered.PNG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5062619985768280898" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_t9CEblyaQHs/RkIKDdyC80I/AAAAAAAAAA0/GaEhKHTZriI/s400/errorDiscovered.PNG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;May be it's just me, but I think it would be great if someone took up the task of performing similar OCL AST processing for Eclipse!&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8334456010154055760-8294350576480215372?l=oclineclipse.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oclineclipse.blogspot.com/feeds/8294350576480215372/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8334456010154055760&amp;postID=8294350576480215372' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/8294350576480215372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/8294350576480215372'/><link rel='alternate' type='text/html' href='http://oclineclipse.blogspot.com/2007/05/verbalizing-ocl.html' title='verbalizing OCL'/><author><name>Miguel Garcia</name><uri>http://www.blogger.com/profile/09949136685995342215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_t9CEblyaQHs/RkII0dyC8zI/AAAAAAAAAAs/YZMn6uk04Hw/s72-c/implicitIteratorVar.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8334456010154055760.post-6023150272010692837</id><published>2007-05-07T09:23:00.000-07:00</published><updated>2007-05-07T09:38:15.482-07:00</updated><title type='text'>OCL in Topcased 1.0.0M3, very first impressions</title><content type='html'>It all started with exploring the OCL editor:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_t9CEblyaQHs/Rj9Un9yC8xI/AAAAAAAAAAc/ldA4X7FcDFQ/s1600-h/userViewOfOCLEditor.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_t9CEblyaQHs/Rj9Un9yC8xI/AAAAAAAAAAc/ldA4X7FcDFQ/s400/userViewOfOCLEditor.PNG" alt="" id="BLOGGER_PHOTO_ID_5061857551763829522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;(including the context menu "Evaluate rule on model", appears after right-clicking an OCL expression)&lt;br /&gt;&lt;br /&gt;Then I noticed other use cases:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;OCL Model Statistics&lt;br /&gt;&lt;/li&gt;&lt;li&gt;OCL Model Checker&lt;/li&gt;&lt;/ul&gt;which can be accessed through&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_t9CEblyaQHs/Rj9UdtyC8wI/AAAAAAAAAAU/eKbyi1wRZSE/s1600-h/use+case+2.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_t9CEblyaQHs/Rj9UdtyC8wI/AAAAAAAAAAU/eKbyi1wRZSE/s400/use+case+2.PNG" alt="" id="BLOGGER_PHOTO_ID_5061857375670170370" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hopefully more details will appear once I'm done with the source code,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_t9CEblyaQHs/Rj9U6dyC8yI/AAAAAAAAAAk/HOfxCnaJLa4/s1600-h/some+OCL-related+plugins+in+topcased.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_t9CEblyaQHs/Rj9U6dyC8yI/AAAAAAAAAAk/HOfxCnaJLa4/s400/some+OCL-related+plugins+in+topcased.PNG" alt="" id="BLOGGER_PHOTO_ID_5061857869591409442" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;My conclusion so far is: Hey, this kind of blogging is not that time consuming!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8334456010154055760-6023150272010692837?l=oclineclipse.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oclineclipse.blogspot.com/feeds/6023150272010692837/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8334456010154055760&amp;postID=6023150272010692837' title='1 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/6023150272010692837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8334456010154055760/posts/default/6023150272010692837'/><link rel='alternate' type='text/html' href='http://oclineclipse.blogspot.com/2007/05/ocl-in-topcased-100m3-very-first.html' title='OCL in Topcased 1.0.0M3, very first impressions'/><author><name>Miguel Garcia</name><uri>http://www.blogger.com/profile/09949136685995342215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_t9CEblyaQHs/Rj9Un9yC8xI/AAAAAAAAAAc/ldA4X7FcDFQ/s72-c/userViewOfOCLEditor.PNG' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
