Pattern-based Mapping of OCL Specifications to JML Contracts

Ali Hamie

Abstract

OCL is a formal notation to specify constraints on UML models that cannot otherwise be expressed using diagrammatic notations such as class diagrams. The type of constraints that can be expressed using OCL include class invariants and operation preconditions and postconditions. However, since OCL constraints cannot be directly executed and checked at runtime by an implementation, constraints violations may not be detected or noticed causing many potential development and maintenance problems. This paper describes an approach for deriving a JML specification for a java implementation (a contract) from a specification written in UML and augmented with OCL constraints. This facilitates the checking of OCL constraints at runtime by translating them to JML executable assertions. The approach is based on the concept of constraint patterns that enable the reuse of commonly occurring constraints within a given context in software modelling. Each OCL constraint pattern would be mapped to a corresponding JML pattern that can be used in the translation process. The result is a library of JML constraint patterns that provides a seamless transition from UML/OCL designs to Java implementations.

References

  1. Ackermann, J. and Turowski, K. (2006). A Library of OCL Specification Patterns for Behavioral Specification of Software Components. In Proceedings of the 18th international conference on Advanced Information Systems Engineering, CAiSE'06, pages 255-269, Berlin, Heidelberg. Springer-Verlag.
  2. Avila, C., Flores, G., and Cheon, Y. (2008). A Librarybased Approach to Translating OCL Constraints to JML Assertions for Runtime Checking. In International Conference on Software Engineering Research and Practice, Las Vegas, Nevada, pages 403-408.
  3. Cheon, Y. and Leavens, G. T. (2002). A Runtime Assertion Checker for the Java Modeling Language (JML). In Proceedings of the International Conference on Software Engineering Research and Practice (SERP 02), Las Vegas, pages 322-328. CSREA Press.
  4. Cheon, Y., Leavens, G. T., Sitaraman, M., and Edwards, S. (2005). Model Variables: Cleanly Supporting Abstraction in Design by Contract. Software-practice & Experience, 35(6):583-599.
  5. Cok, D. R. and Kiniry, J. R. (2004). ESC/Java2: Uniting ESC/Java and JML - Progress and Issues in Building and Using ESC/Java2. In Construction and Analysis of Safe, Secure and Interoperable Smart Devices: International Workshop, CASSIS 2004. SpringerVerlag.
  6. Davis, J. P. and Bonnell, R. D. (2007). Propositional Logic Constraint Patterns and Their Use in UMLBased Conceptual Modeling and Analysis. IEEE Trans. Knowl. Data Eng., pages 427-440.
  7. Frankel, D. (2002). Model Driven Architecture: Applying MDA to Enterprise Computing. John Wiley & Sons, Inc., New York, NY, USA.
  8. Hamie, A. (2004). Translating the Object Constraint Language into the Java Modelling Language. In Proceedings of the ACM Symposium on Applied Computing, pages 1531-1535. ACM Press.
  9. Jacobs, B. and Poll, E. (2003). Java Program Verification at Nijmegen: Developments and Perspective. In Nijmegen Institute of Computing and Information Sciences, pages 134-153. Springer.
  10. Leavens, G. T., Baker, A. L., and Ruby, C. (2006). Preliminary Design of JML: A Behavioral Interface Specification Language for Java. SIGSOFT, 31(3):1-38.
  11. Leavens, G. T., Cheon, Y., Clifton, C., Ruby, C., and Cok, D. R. (2003). How the design of JML accommodates both runtime assertion checking and formal verification. In SCIENCE OF COMPUTER PROGRAMMING, pages 262-284.
  12. OMG (2006). Unified Modeling Language Specification 2.0: Infrastructure. OMG doc. smsc/06-02-06.
  13. Wahler, M., Koehler, J., and Brucker, A. D. (2006). ModelDriven Constraint Engineering. In MoDELS Workshp. on OCL for (Meta-)Models in Multiple Application Domains, pages 111-125.
  14. Warmer, J. and Kleppe, A. (2003). The Object Constraint Language: Getting Your Models Ready for MDA. Addison-Wesley, Reading, MA.
Download


Paper Citation


in Harvard Style

Hamie A. (2014). Pattern-based Mapping of OCL Specifications to JML Contracts . In Proceedings of the 2nd International Conference on Model-Driven Engineering and Software Development - Volume 1: MODELSWARD, ISBN 978-989-758-007-9, pages 193-200. DOI: 10.5220/0004698301930200


in Bibtex Style

@conference{modelsward14,
author={Ali Hamie},
title={Pattern-based Mapping of OCL Specifications to JML Contracts},
booktitle={Proceedings of the 2nd International Conference on Model-Driven Engineering and Software Development - Volume 1: MODELSWARD,},
year={2014},
pages={193-200},
publisher={SciTePress},
organization={INSTICC},
doi={10.5220/0004698301930200},
isbn={978-989-758-007-9},
}


in EndNote Style

TY - CONF
JO - Proceedings of the 2nd International Conference on Model-Driven Engineering and Software Development - Volume 1: MODELSWARD,
TI - Pattern-based Mapping of OCL Specifications to JML Contracts
SN - 978-989-758-007-9
AU - Hamie A.
PY - 2014
SP - 193
EP - 200
DO - 10.5220/0004698301930200