<p>At its core, OCL as currently defined is a first-order functional language: its expressions evaluate to single values, with collections accounting for multitudes of values, and special values <Emphasis FontCategory="NonProportional">null</Emphasis> and <Emphasis FontCategory="NonProportional">invalid</Emphasis> for partiality. By contrast, the data model providing the context of OCL expressions is inherently relational: the associations of UML class diagrams are essentially relations, with uniqueness and order designators extending expressiveness to ordered multirelations. As a result, OCL suffers from a functional/relational impedance mismatch, which is only superficially addressed by its navigation shorthands. At the same time, OCL is inherently unsafe: expressions containing subexpressions evaluating to <Emphasis FontCategory="NonProportional">null</Emphasis> may be invalid, translating to a runtime error in programming languages. We address this situation by turning OCL into a relational language that retains most of OCL’s original syntax and semantics, yet revises its fundamental design decisions that lead up to the noted problems. In particular, our version of OCL, which we call OCL<InlineEquation ID="IEq3"> <InlineMediaObject> <ImageObject Color="BlackWhite" FileRef="10270_2025_1286_Article_IEq1.gif" Format="GIF" Height="13" Rendition="HTML" Resolution="72" Type="Linedraw" Width="9" /> </InlineMediaObject> <EquationSource Format="TEX">\({^\sharp }\)</EquationSource> <EquationSource Format="MATHML"><math> <mmultiscripts> <mrow /> <mrow /> <mo>♯</mo> </mmultiscripts> </math></EquationSource> </InlineEquation>, is type-safe.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Meet OCL\({^\sharp }\), a relational object constraint language

  • Friedrich Steimann,
  • Robert Clarisó,
  • Martin Gogolla

摘要

At its core, OCL as currently defined is a first-order functional language: its expressions evaluate to single values, with collections accounting for multitudes of values, and special values null and invalid for partiality. By contrast, the data model providing the context of OCL expressions is inherently relational: the associations of UML class diagrams are essentially relations, with uniqueness and order designators extending expressiveness to ordered multirelations. As a result, OCL suffers from a functional/relational impedance mismatch, which is only superficially addressed by its navigation shorthands. At the same time, OCL is inherently unsafe: expressions containing subexpressions evaluating to null may be invalid, translating to a runtime error in programming languages. We address this situation by turning OCL into a relational language that retains most of OCL’s original syntax and semantics, yet revises its fundamental design decisions that lead up to the noted problems. In particular, our version of OCL, which we call OCL \({^\sharp }\) , is type-safe.