Skip to main navigation Skip to search Skip to main content

OCL2NL: Automatic generation of natural language descriptions from OCL contracts

  • Yilong Yang
  • , Qizhen Li
  • , Tianshu Bao
  • , Qin Li
  • , Weiru Wang*
  • *Corresponding author for this work
  • Beihang University
  • Liupanshui Normal University
  • Beijing University of Technology

Research output: Contribution to journalArticlepeer-review

Abstract

Formal contracts play a crucial role in precisely specifying system requirements and facilitating the verification of system implementation through automated test case generation or formal verification techniques, particularly in the development of safety-critical systems. The Object Constraint Language (OCL) is a lightweight formal language widely utilized for expressing constraints in UML-based models. However, due to the semantic gap between OCL expressions and their interpretations, comprehending OCL contracts can be challenging. In this paper, we propose a novel approach called OCL2NL, which enables the automatic generation of natural language descriptions from OCL contracts. OCL2NL encompasses a comprehensive set of translation rules and algorithms that map OCL contracts to semantic and signature descriptions of system operations.To validate our approach, we conducted four case studies. The results demonstrate a high success rate, with 97.06% of the OCL expressions and 87.68% of the signatures generating accurate descriptions. Moreover, domain experts evaluate that 50 out of 52 descriptions of OCL expressions and 11 out of 12 signature descriptions effectively capture essential information about the corresponding OCL contracts. The natural language descriptions significantly enhance the understanding of OCL contracts when compared to the contracts alone. Overall, the results are promising, indicating potential for extension in the software industry.

Original languageEnglish
Article number103513
JournalScience of Computer Programming
Volume254
DOIs
StatePublished - Oct 2026

Keywords

  • Formal contracts
  • Natural language
  • OCL
  • OCL contracts

Fingerprint

Dive into the research topics of 'OCL2NL: Automatic generation of natural language descriptions from OCL contracts'. Together they form a unique fingerprint.

Cite this