Extending OCL with Null-References

Towards a Formal Semantics for OCL 2.1
  • Achim D. Brucker
  • Matthias P. Krieger
  • Burkhart Wolff
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6002)


From its beginnings, OCL is based on a strict semantics for undefinedness, with the exception of the logical connectives of type Boolean that constitute a three-valued propositional logic. Recent versions of the OCL standard added a second exception element, which, similar to the null references in object-oriented programming languages, is given a non-strict semantics. Unfortunately, this extension has been done in an ad hoc manner, which results in several inconsistencies and contradictions.

In this paper, we present a consistent formal semantics (based on our HOL-OCL approach) that includes such a non-strict exception element. We discuss the possible consequences concerning class diagram semantics as well as deduction rules. The benefits of our approach for the specification-pragmatics of design level operation contracts are demonstrated with a small case-study.


HOL-OCL UML OCL null reference formal semantics 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Andrews, P.B.: Introduction to Mathematical Logic and Type Theory: To Truth through Proof, 2nd edn. Kluwer Academic Publishers, Dordrecht (2002)zbMATHGoogle Scholar
  2. 2.
    Barnett, M., Leino, K.R.M., Schulte, W.: The Spec# programming system: An overview. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 49–69. Springer, Heidelberg (2005)Google Scholar
  3. 3.
    Brucker, A.D., Doser, J., Wolff, B.: An MDA framework supporting OCL. Electronic Communications of the EASST 5 (2006)Google Scholar
  4. 4.
    Brucker, A.D., Wolff, B.: The HOL-OCL book. Tech. Rep. 525, ETH Zurich (2006)Google Scholar
  5. 5.
    Brucker, A.D., Wolff, B.: An extensible encoding of object-oriented data models in HOL. Journal of Automated Reasoning 41, 219–249 (2008)zbMATHCrossRefGoogle Scholar
  6. 6.
    Brucker, A.D., Wolff, B.: Semantics, calculi, and analysis for object-oriented specifications. Acta Informatica 46(4), 255–284 (2009)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Chalin, P., Rioux, F.: Non-null references by default in the Java modeling language. In: SAVCBS 2005: Proceedings of the 2005 conference on Specification and verification of component-based systems, p. 9. ACM Press, New York (2005)CrossRefGoogle Scholar
  8. 8.
    Church, A.: A formulation of the simple theory of types. Journal of Symbolic Logic 5(2), 56–68 (1940)zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Ekman, T., Hedin, G.: Pluggable checking and inferencing of nonnull types for Java. Journal of Object Technology 6(9), 455–475 (2007)Google Scholar
  10. 10.
    Fähndrich, M., Leino, K.R.M.: Declaring and checking non-null types in an object-oriented language. In: OOPSLA, pp. 302–312. ACM Press, New York (2003)Google Scholar
  11. 11.
    Gogolla, M., Kuhlmann, M., Büttner, F.: A benchmark for OCL engine accuracy, determinateness, and efficiency. In: Czarnecki, K., Ober, I., Bruel, J.-M., Uhl, A., Völter, M. (eds.) MODELS 2008. LNCS, vol. 5301, pp. 446–459. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  12. 12.
    Gordon, M.J.C., Melham, T.F.: Introduction to HOL: a theorem proving environment for higher order logic. Cambridge University Press, Cambridge (1993)zbMATHGoogle Scholar
  13. 13.
    Kosiuczenko, P.: Specification of invariability in OCL. In: Nierstrasz, O., Whittle, J., Harel, D., Reggio, G. (eds.) MoDELS 2006. LNCS, vol. 4199, pp. 676–691. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  14. 14.
    Leavens, G.T., Poll, E., Clifton, C., Cheon, Y., Ruby, C., Cok, D.R., Müller, P., Kiniry, J., Chalin, P.: JML reference manual, revision 1.2 (2007)Google Scholar
  15. 15.
    Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle’s logic: HOL (2009)Google Scholar
  16. 16.
    UML 2.0 OCL specification (2003). Available as OMG document ptc/03-10-14Google Scholar
  17. 17.
    UML 2.0 OCL specification (2006). Available as OMG document formal/06-05-01Google Scholar
  18. 18.
    UML 2.2 infrastructure (2009). Available as OMG document formal/2009-02-04Google Scholar
  19. 19.
    Richters, M.: A precise approach to validating UML models and OCL constraints. Ph.D. thesis, Universität Bremen, Logos Verlag, BISS Monographs, No. 14 (2002)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Achim D. Brucker
    • 1
  • Matthias P. Krieger
    • 2
  • Burkhart Wolff
    • 2
  1. 1.SAP ResearchKarlsruheGermany
  2. 2.Université Paris-SudOrsay CedexFrance

Personalised recommendations