围绕EMF探索(3)之初探OCL


 前索引: 围绕EMF探索(1)之存储和查询
 前索引: 围绕EMF探索(2)之再探查询组件

围绕EMF探索(3)之初探OCL

       围绕EMF模型,有个很重要的基础性组件叫 EMF OCL,这是一个实现了OCL2.0标准的组件,提供了对OCL Expression的解析、校验。OCL全称是Object Constraint Language。
 
       对OCL之前接触不是很多。两年前,在MDAChina还存在的时候,见到一些朋友谈论它。但对当时的技术和应用来说,OCL还是过于“理想化”。事实上,直到今天,OCL在国内的应用也是很稀少的。
       如果不是因为探索EMF OCL这个组件的原因,我想我也很难去主动钻研OCL的那有些晦涩的Expression。虽然在UML2中,其已经成为一个用于准确描述模型的关键特性。
 
       其实,使用EMF OCL非常简单,使用QueryFactory构造一个Query对象,设置表达式(Express),以及表达式所依赖的Context(在EMF OCL中,一般是Classifier)。然后对给定eObject对象进行检查和计算。——就这么简单。
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
"In this thoroughly revised edition, Jos and Anneke offer a concise, pragmatic, and pedagogic explanation of the Object Constraint Language (OCL) and its different applications. Their discussion of OCL's potential role in Model Driven Architecture (MDA) is timely and offers great insight into the way that UML can be taken to the next level of automated software development practice. I highly recommend this book to anyone who is looking to get the most out of UML" -Shane Sendall, Ph.D.Senior ResearcherSwiss Federal Institute of Technology in Lausanne The release of Unified Modeling Language (UML) 2.0 places renewed emphasis on the Object Constraint Language (OCL). Within UML, OCL is the standard for specifying expressions that add vital information to object-oriented models and other object-modeling artifacts. Model-Driven Architecture (MDA) relies on OCL to add the level of programming detail necessary to enable Platform-Specific Models (PSM) to communicate with Platform-Independent Models (PIM). This book is a practical, accessible guide to OCL for software architects, designers, and developers. Much care has been taken during the redesign of OCL to ensure that the syntax remains readable and writable by the average software modeler. The Object Constraint Language, Second Edition, utilizes a case study to show how to exercise these compact but powerful expressions for maximum effect. This newly updated edition also Explains why OCL is critical to MDA-and why UML alone is not enough Introduces an SQL-like syntax to OCL Defines the new language constructs of OCL 2.0 Demonstrates how OCL can be incorporated into code Using a combination of UML and OCL allows developers to realize the effective, consistent, and coherent models that are critical to working with MDA. The authors' pragmatic approach and illustrative use of examples will help application developers come quickly up to speed with this important object-modeling method--and will serve as a ready reference thereafter.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值