Structural Model Subtyping with OCL Constraints

Structural Model Subtyping with OCL Constraints

Structural Model Subtyping with OCL Constraints Artur Boronat Department of Informatics University of Leicester United Kingdom [email protected] Abstract 1 Introduction In model-driven engineering (MDE), models abstract the rel- Our aim in this work is to revisit the research question of evant features of software artefacts and model management whether type subsumption − i.e. the relation capturing that operations, including model transformations, act on them any inhabitant of a given subtype is also an inhabitant of a automating large tasks of the development process. Flexible given supertype − is a valid mechanism for facilitating reuse reuse of such operations is an important factor to improve of model management operations in MDE in order to analyse productivity when developing and maintaining MDE solu- its advantages and limitations. We approach this topic by tions. In this work, we revisit the traditional notion of object exposing a general problem involving reuse, which we then subtyping based on subsumption, discarded by other ap- solve by using structural model subtyping. proaches to model subtyping. We refine a type system for In a typed setting, model management operations are ap- object-oriented programming, with multiple inheritance, to plied to models that conform to metamodels, which define support model types in order to analyse its advantages and the abstract syntax of a modeling language. Additional well- limitations with respect to reuse in MDE. Specifically, we ex- formedness constraints can be added to the language, usually tend type expressions with referential constraints and with by encoding them in an OCL dialect. The notion of a pair OCL constraints. Our approach has been validated with a tool (M, Ω) formed by a metamodel M and its (OCL) constraints that extracts model types from (EMF) metamodels, paired Ω is captured as a metamodel specification [4]. A very gen- with their OCL constraints, automatically and that exploits eral form of reuse emerges when we want to learn whether the extended subtyping relation to reuse model management we can extrapolate model management operations from one operations. We show that structural model subtyping is ex- metamodel specification to another one. This involves learn- pressive enough to support variants of model subtyping, ing whether two metamodel specifications, whose metamod- including multiple, partial and dynamic model subtyping. els and constraints need not be related a priori, are com- The tool has received the ACM badge "Artifacts Evaluated − patible capturing the notion of subtype polymorphism in Functional". model management operations. This is a frequent problem in the evolution of modeling languages, where updates to CCS Concepts · Software and its engineering → Model- their abstract syntax and constraints may need to preserve driven software engineering; Formal language defini- forward/backward compatibility of operations. tions; Formal software verification; Depending on how typing is considered [24], we can dis- Keywords Model subtyping, EMF, OCL, type theory. tinguish semantics where typing (the instanceOf relation) is ontological, explicitly definable in the metamodeling lan- ACM Reference Format: guage, or linguistic, implicitly defined by the metamodeling Artur Boronat. 2017. Structural Model Subtyping with OCL Con- language. In addition, we consider that the semantics of straints. In Proceedings of 2017 ACM SIGPLAN International Confer- − ence on Software Language Engineering (SLE’17). ACM, New York, object subtyping corresponds to (static) subclassing gen- NY, USA, 12 pages. https://doi.org/10.1145/3136014.3136026 eralization − in the first appproach, and to subsumption, in the second approach. Hence, we distinguish approaches Permission to make digital or hard copies of all or part of this work for where models are represented as graphs, where typing is on- personal or classroom use is granted without fee provided that copies tological; or as terms, where typing is linguistic. On the are not made or distributed for profit or commercial advantage and that one hand, graph transformation theory and well-known copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must (meta)modeling environments, such as the Eclipse Model- be honored. Abstracting with credit is permitted. To copy otherwise, or ing Framework (EMF) and the USE environment [18, 23], republish, to post on servers or to redistribute to lists, requires prior specific rely on the first representation, exploiting a set-theoretic permission and/or a fee. Request permissions from [email protected]. representation to implement tools, e.g. for checking model SLE’17, October 23ś24, 2017, Vancouver, Canada typing and for analysing (OCL) constraints. On the other © 2017 Copyright held by the owner/author(s). Publication rights licensed hand, type-theoretic approaches, such as [10, 26], rely on to Association for Computing Machinery. ACM ISBN 978-1-4503-5525-4/17/10...$15.00 the second representation for exploiting inductive reasoning https://doi.org/10.1145/3136014.3136026 and higher-order functions. 194 SLE’17, October 23ś24, 2017, Vancouver, Canada Artur Boronat To solve the aforementioned problem, the following re- Graph edges nodes Node source * sults have been developed in this work: name : String * Edge (1) Extension of OO types, with multiple inheritance seman- name : String marking 0..1 target name : String Mark marks tics [8], to model types with referential constraints, reusing * context Edge inv map: a type-theoretic framework, with linguistic typing and a con- not(Edge.allInstances()->exists(t | t.source=self.source and t.target<>self.target)) venient semantics for subtyping. Our model types formalize StateMachine * Observation the common features of EMF metamodels, including classes 1..* edges name : String marking 1..* 0..1 marks with attributes, cross-references and containments, multiple Transition nodes State source inheritance, data types and enumeration types, multiplic- initial name : String name: String isCompletion : Bool ity, ordering, uniqueness and bidirectionality constraints for final * target cross-references and containments. context Transition inv determism: not(Transition.allInstances()->exists(t | t.source=self.source and t.target<>self.target)) (2) Attachment of the USE semantics of OCL constraints [27], context Transition inv eventTransition: with ontological typing, to extended OO types in order to name <> '' implies isCompletion=false reuse tool support for mechanizing the satisfaction of OCL constraints in our model types. Figure 1. (Mд, Ωд ) − top − and (Msm, Ωsm ) − bottom (3) Definition of a subtyping relation between metamodel specifications that couples extended OO subtyping, between the types in both metamodels, with the compatibility of their the one hand, (M , Ω ) characterizes the graph of a func- OCL constraints. Such a subtyping relation can be regarded д д tion defined over nodes. On the other hand, (M , Ω ) as a structural refinement relation between metamodel spec- sm sm characterizes deterministic state machines where transitions ifications. The computation of the subtyping relation fortwo can be triggered by an event (indicated in the name attribute given metamodel specifications relies on the construction of the transition) or are triggerless, e.g. they are completion of an extension metamodel that reflects (linguistic) model transitions. These metamodels provide a mechanism to mark subtyping using (ontological) subtyping, enabling reasoning nodes, and states, as already mapped, or as already observed. about the compability of OCL constraints from both meta- We can envisage an operation (M , Ω ) → (M , Ω ) for model specifications. The extension metamodel also serves д д д д applying a map in (M , Ω ) to a particular node by mark- as the basis for reusing model management operations as-is, д д ing it. Specifically, this operation has been implemented as i.e. without introducing changes to the operation behaviour. an ATL model transformation for (M , Ω ) that creates an (4) A semi-decidable procedure that solves the proposed prob- д д object Mark for an unmarked node whose predecessor is lem by using structural model subtyping and its implemen- marked. Our approach enables the reuse of that operation tation in a tool, facilitating flexibility in MDE by supporting for simulating state machines conforming to (M , Ω ). dynamic, partial and multiple typing. The tool implement- sm sm Our structural subtyping mechanism has also been val- ing this procedure has received the ACM badge łArtifacts idated with the example used for model subtyping in [31] Evaluated - Functionalž and is available, with case studies, at and with a second case study on the evolution of modeling https://mde-subtyping.github.io/web/. languages. These case studies have been implemented and In the following subsections, we introduce an example are documented at https://mde-subtyping.github.io/web/. and discuss approaches for model typing, focussing on ac- cepted notions of model subtyping for EMF metamodels and for graph transformation theory. In section 4, a syntactic 3 Approaches to Model Subtyping representation for model types and structural model sub- In the recent literature on model transformation, there is typing are introduced. In section 5, we map a semantics of an emerging interest in formalizing mechanisms for reuse metamodels specifications to our model types and extend

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us