Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

Advertisement

Springer Nature Link
Log in

Extending OCL with Map and Function Types

  • Conference paper
  • First Online:

Part of the book series:Lecture Notes in Computer Science ((LNPSE,volume 12818))

Included in the following conference series:

Abstract

Map and function types are of high utility in software specification and design, for example, maps can be used to represent configurations or caches, whilst function values can be used to enable genericity and reuse in a specification, and to support mechanisms such as callbacks or closures in an implementation. Map and function types have been incorporated into the leading programming languages, including Java, C++, Swift and Python.

The Object Constraint Language (OCL) specification notation lacks such types, and in this paper we make a proposal for a consistent extension of OCL with map and function types, and we identify modifications to OCL semantics to include these types. We also describe how map and function types are implemented using the Eclipse AgileUML toolset.

This is a preview of subscription content,log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+
from ¥17,985 /Month
  • Starting from 10 chapters or articles per month
  • Access and download chapters and articles from more than 300k books and 2,500 journals
  • Cancel anytime
View plans

Buy Now

Chapter
JPY 3498
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
JPY 8007
Price includes VAT (Japan)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
JPY 10009
Price includes VAT (Japan)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide -see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Similar content being viewed by others

Explore related subjects

Discover the latest articles, books and news in related subjects, suggested using machine learning.

Notes

  1. 1.

    Used in the ATL extension of OCL.

References

  1. AgileUML repository (2020).https://github.com/eclipse/agileuml/

  2. Belaunde, M.: Evolution of the OCL OMG specification, OCL (2010)

    Google Scholar 

  3. Sánchez Cuadrado, J., Jouault, F., García Molina, J., Bézivin, J.: Optimization patterns for OCL-based model transformations. In: Chaudron, M.R.V. (ed.) MODELS 2008. LNCS, vol. 5421, pp. 273–284. Springer, Heidelberg (2009).https://doi.org/10.1007/978-3-642-01648-6_29

    Chapter  Google Scholar 

  4. Ciesielski, K.: Set Theory for the Working Mathematician. Cambridge University Press, Cambridge (1997)

    Book  Google Scholar 

  5. Cook, S., Kleppe, A., Mitchell, R., Rumpe, B., Warmer, J., Wills, A.: The Amsterdam manifesto on OCL. In: Clark, T., Warmer, J. (eds.) Object Modeling with the OCL. LNCS, vol. 2263, pp. 115–149. Springer, Heidelberg (2002).https://doi.org/10.1007/3-540-45669-4_7

    Chapter MATH  Google Scholar 

  6. Eclipse, ATL user guide, eclipse.org (2019)

    Google Scholar 

  7. Eclipse AgileUML project (2020).https://projects.eclipse.org/projects/modeling.agileuml

  8. Eclipse OCL Version 6.4.0 (2021).https://projects.eclipse.org/projects/modeling.mdt.ocl

  9. The Epsilon Object Language (2020).https://www.eclipse.org/epsilon/doc/eol

  10. Hennicker, R., Hussmann, H., Bidoit, M.: On the precise meaning of OCL constraints. In: Clark, T., Warmer, J. (eds.) Object Modeling with the OCL. LNCS, vol. 2263, pp. 69–84. Springer, Heidelberg (2002).https://doi.org/10.1007/3-540-45669-4_5

    Chapter MATH  Google Scholar 

  11. Kleppe, A., Warmer, J., Cook, S.: Informal formality? The object constraint language and its application in the UML metamodel. In: Bézivin, J., Muller, P.-A. (eds.) UML 1998. LNCS, vol. 1618, pp. 148–161. Springer, Heidelberg (1999).https://doi.org/10.1007/978-3-540-48480-6_12

    Chapter  Google Scholar 

  12. Kleppe, A.: Object constraint language: metamodelling semantics (Chap. 7). In: UML 2 Semantics and Applications. Wiley (2009)

    Google Scholar 

  13. Lano, K.: The B Language and Method. Springer, Heidelberg (1996).https://doi.org/10.1007/978-1-4471-1494-9

    Book  Google Scholar 

  14. Lano, K.: A compositional semantics of UML-RSDS. Softw. Syst. Model.8(1), 85–116 (2009).https://doi.org/10.1007/s10270-007-0064-x

    Article  Google Scholar 

  15. Lano, K., Clark, T., Kolahdouz-Rahimi, S.: A framework for model transformation verification. Form. Asp. Comput.27(1), 193–235 (2014).https://doi.org/10.1007/s00165-014-0313-z

    Article MathSciNet MATH  Google Scholar 

  16. Lano, K.: Agile Model-Based Development Using UML-RSDS. CRC Press, Boca Raton (2016)

    Google Scholar 

  17. Lano, K.: Map type support in OCL?, November 2018.https://www.eclipse.org/forums/index.php/t/1096077/

  18. OMG, Object Constraint Language 2.4 Specification (2014)

    Google Scholar 

  19. OMG, MOF2 Query/View/Transformation v1.3 (2016)

    Google Scholar 

  20. OMG (2020).https://issues.omg.org/issues/spec/OCL/2.4

  21. Richters, M., Gogolla, M.: On formalizing the UML object constraint language OCL. In: Ling, T.-W., Ram, S., Li Lee, M. (eds.) ER 1998. LNCS, vol. 1507, pp. 449–464. Springer, Heidelberg (1998).https://doi.org/10.1007/978-3-540-49524-6_35

    Chapter  Google Scholar 

  22. Spivey, J.: The Z Notation. Prentice Hall, Hoboken (1989)

    MATH  Google Scholar 

  23. Willink, E.: OCL omissions and contradictions, OMG ADTF (2012)

    Google Scholar 

  24. Willink, E.: Reflections on OCL 2. J. Object Technol.19(3), 1–16 (2020)

    Google Scholar 

  25. Willink, E.: An OCL map type. In: OCL 2019 (2019)

    Google Scholar 

Download references

Author information

Authors and Affiliations

  1. Department of Informatics, King’s College London, London, UK

    Kevin Lano

  2. Department of Software Engineering, University of Isfahan, Isfahan, Iran

    Shekoufeh Kolahdouz-Rahimi

Authors
  1. Kevin Lano
  2. Shekoufeh Kolahdouz-Rahimi

Corresponding author

Correspondence toKevin Lano.

Editor information

Editors and Affiliations

  1. Tehran Institute for Advanced Studies, Tehran, Iran

    Hossein Hojjat

  2. CNR - ISTI, Pisa, Italy

    Mieke Massink

A Additional Map Type Operators

A Additional Map Type Operators

The following map operators can also be formalised in our proposed extension of OCL.

size() : Integer

figure k

This is equal to\(self{\rightarrow }keys(){\rightarrow }size()\).

includesValue(object : T) : Boolean True if theobject is an element of the map range, false otherwise:

figure l

Similarly for\({\rightarrow }includesKey()\),\({\rightarrow }excludesValue()\),\({\rightarrow }excludesKey()\).

count(object : T) : Integer The number of times theobject occurs as an element of the map range (a bag):

figure m

includesAll(c2 : Map(K,T)) : Boolean True ifc2 is a map, and the set of pairs ofself contains all those ofc2, false otherwise:

figure n

Similarly for\({\rightarrow }excludesAll()\).

isEmpty() : Boolean, notEmpty() : Boolean Defined based on\(self{\rightarrow }asSet()\).

max() : T, min() : T, sum() : T Defined as the corresponding operations on\(self{\rightarrow }values()\).

asSet() : Set(Tuple(key : K, value : T)) The set of pairs of elements in the map. Since duplicate keys are not permitted, this has the same size as\(self{\rightarrow }keys()\).

restrict(ks : Set(K)) : Map(K,T) Domain restriction. The map restricted to the keys inks. Its elements are the pairs ofself whose key is inks:

figure o

Range restriction is provided via the\({\rightarrow }select\) operator.

-(m: Map(K,T)) : Map(K,T) Map subtraction: the elements ofself that are not inm.

figure p

union(m : Map(K,T)) : Map(K,T) Map override, the operation\(self \oplus m\) or\(self~{{<}{+}}~m\) in mathematical notation. This consists of the pairs ofself which do not conflict with pairs ofm, together with all pairs ofm:

figure q

This is the same asputAll in EOL [9]. Unlike set union, it is not commutative.

intersection(m : Map(K,T)) : Map(K,T) The pairs ofself which are also inm:

figure r

This is associative and commutative.

including(k : K, v : T) : Map(K,T) The pairs ofself, with the additional/overriding mapping ofk tov:

figure s

We also use the abbreviated notation\(m[k] = v\) for\(m = m{\text{@ }pre}{\rightarrow }including(k,v)\).

excluding(k : K, v : T) : Map(K,T) The pairs ofself, with any mapping ofk tov removed:

figure t

any Defined as

figure u

Likewise forforAll,exists,one.

select The map formed by restricting to range elements which satisfy theselect condition:

figure v

Similarly forreject.

Rights and permissions

Copyright information

© 2021 IFIP International Federation for Information Processing

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Lano, K., Kolahdouz-Rahimi, S. (2021). Extending OCL with Map and Function Types. In: Hojjat, H., Massink, M. (eds) Fundamentals of Software Engineering. FSEN 2021. Lecture Notes in Computer Science(), vol 12818. Springer, Cham. https://doi.org/10.1007/978-3-030-89247-0_8

Download citation

Keywords

Publish with us

Societies and partnerships

Access this chapter

Subscribe and save

Springer+
from ¥17,985 /Month
  • Starting from 10 chapters or articles per month
  • Access and download chapters and articles from more than 300k books and 2,500 journals
  • Cancel anytime
View plans

Buy Now

Chapter
JPY 3498
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
JPY 8007
Price includes VAT (Japan)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
JPY 10009
Price includes VAT (Japan)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide -see info

Tax calculation will be finalised at checkout

Purchases are for personal use only


[8]ページ先頭

©2009-2025 Movatter.jp