Part of the book series:Lecture Notes in Computer Science ((LNPSE,volume 12818))
Included in the following conference series:
472Accesses
4Citations
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
- 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
Buy Now
- Chapter
- JPY 3498
- Price includes VAT (Japan)
- eBook
- JPY 8007
- Price includes VAT (Japan)
- Softcover Book
- JPY 10009
- Price includes VAT (Japan)
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.
Used in the ATL extension of OCL.
References
AgileUML repository (2020).https://github.com/eclipse/agileuml/
Belaunde, M.: Evolution of the OCL OMG specification, OCL (2010)
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
Ciesielski, K.: Set Theory for the Working Mathematician. Cambridge University Press, Cambridge (1997)
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
Eclipse, ATL user guide, eclipse.org (2019)
Eclipse AgileUML project (2020).https://projects.eclipse.org/projects/modeling.agileuml
Eclipse OCL Version 6.4.0 (2021).https://projects.eclipse.org/projects/modeling.mdt.ocl
The Epsilon Object Language (2020).https://www.eclipse.org/epsilon/doc/eol
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
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
Kleppe, A.: Object constraint language: metamodelling semantics (Chap. 7). In: UML 2 Semantics and Applications. Wiley (2009)
Lano, K.: The B Language and Method. Springer, Heidelberg (1996).https://doi.org/10.1007/978-1-4471-1494-9
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
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
Lano, K.: Agile Model-Based Development Using UML-RSDS. CRC Press, Boca Raton (2016)
Lano, K.: Map type support in OCL?, November 2018.https://www.eclipse.org/forums/index.php/t/1096077/
OMG, Object Constraint Language 2.4 Specification (2014)
OMG, MOF2 Query/View/Transformation v1.3 (2016)
OMG (2020).https://issues.omg.org/issues/spec/OCL/2.4
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
Spivey, J.: The Z Notation. Prentice Hall, Hoboken (1989)
Willink, E.: OCL omissions and contradictions, OMG ADTF (2012)
Willink, E.: Reflections on OCL 2. J. Object Technol.19(3), 1–16 (2020)
Willink, E.: An OCL map type. In: OCL 2019 (2019)
Author information
Authors and Affiliations
Department of Informatics, King’s College London, London, UK
Kevin Lano
Department of Software Engineering, University of Isfahan, Isfahan, Iran
Shekoufeh Kolahdouz-Rahimi
- Kevin Lano
Search author on:PubMed Google Scholar
- Shekoufeh Kolahdouz-Rahimi
Search author on:PubMed Google Scholar
Corresponding author
Correspondence toKevin Lano.
Editor information
Editors and Affiliations
Tehran Institute for Advanced Studies, Tehran, Iran
Hossein Hojjat
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

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:

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):

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

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:

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.

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:

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:

This is associative and commutative.
including(k : K, v : T) : Map(K,T) The pairs ofself, with the additional/overriding mapping ofk tov:

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:

any Defined as

Likewise forforAll,exists,one.
select The map formed by restricting to range elements which satisfy theselect condition:

Similarly forreject.
Rights and permissions
Copyright information
© 2021 IFIP International Federation for Information Processing
About this paper
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
Published:
Publisher Name:Springer, Cham
Print ISBN:978-3-030-89246-3
Online ISBN:978-3-030-89247-0
eBook Packages:Computer ScienceComputer Science (R0)
Share this paper
Anyone you share the following link with will be able to read this content:
Sorry, a shareable link is not currently available for this article.
Provided by the Springer Nature SharedIt content-sharing initiative


