Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "MDT/New and Noteworthy/1.0"
(OCL Document Parsing API) |
m (Minor formatting fixes) |
||
Line 72: | Line 72: | ||
For example: | For example: | ||
− | package ocltest | + | '''package''' ocltest |
− | context Fruit | + | '''context''' Fruit |
− | inv not_black: self.color <> Color::black | + | '''inv''' ''not_black'': self.color <> Color::black |
− | def property_helper: | + | '''def''' ''property_helper'': |
otherFruits : Set(Fruit) = Fruit.allInstances()->excluding(self) | otherFruits : Set(Fruit) = Fruit.allInstances()->excluding(self) | ||
− | def operation_helper: | + | '''def''' ''operation_helper'': |
getOtherFruits1(fruit : Fruit) : Set(Fruit) = Fruit.allInstances()->excluding(fruit) | getOtherFruits1(fruit : Fruit) : Set(Fruit) = Fruit.allInstances()->excluding(fruit) | ||
− | context Apple::preferredLabel(text : String) : String | + | '''context''' Apple::preferredLabel(text : String) : String |
− | pre text_not_null: not text.oclIsUndefined() | + | '''pre''' ''text_not_null'': not text.oclIsUndefined() |
− | pre text_not_label: text <> label | + | '''pre''' ''text_not_label'': text <> label |
− | body compute_label: result = if text = label then '' else text endif | + | '''body''' ''compute_label'': result = if text = label then <nowiki>''</nowiki> else text endif |
− | post label_is_changed: label = label@pre | + | '''post''' ''label_is_changed'': label = label@pre |
− | post label_is_set: label = text | + | '''post''' ''label_is_set'': label = text |
− | context Apple::name : String | + | '''context''' Apple::name : String |
− | init: '' | + | '''init''': <nowiki>''</nowiki> |
− | derive: if label.oclIsUndefined() then '' else label endif | + | '''derive''': if label.oclIsUndefined() then <nowiki>''</nowiki> else label endif |
− | endpackage | + | '''endpackage''' |
==== Other Bug Fixes ==== | ==== Other Bug Fixes ==== |
Revision as of 14:25, 23 February 2007
Model Development Tools Release 1.0 New and Noteworthy Items.
For more details about the development plan, see the MDT 1.0 draft plan.
Back to Modeling Development Tools.
Contents
EMF Ontology Definition Metamodel (EODM) Component
Object Constraint Language (OCL) Component
Release 1.1 M4
LPG Java Runtime Restructuring
In the OCL 1.0 release, the SourceForge LPG Java Runtime library was embedded in the OCL bundle JAR. It has now been contributed to Orbit as a distinct bundle net.sourceforge.lpg.lpgjavaruntime.
Stand-alone Deployment Support
The OCL Downloads page now includes a stand-alone ZIP containing just the JARs required for deployment in a non-Eclipse environment. The EMF stand-alone deployment that is also required is available separately.
Other Bug Fixes
For other bug fixes, see the 1.1 M4 release notes.
Release 1.1 M5
EMF 2.3 Adoption and Generics
This milestone introduces a significant refactoring of the OCL Parser/Interpreter API, with the adoption of EMF 2.3 and its support for generic types. Using Ecore's generics, a new generic Abstract Syntax model for OCL is defined in the org.eclipse.ocl plug-in:
This new model, and the OCL Parser/Interpreter core API, are thus freed from the dependency on the Ecore metamodel. The org.eclipse.emf.ocl plug-in is now deprecated and is supplanted by an Ecore binding (and environment implementation) of the generic model in the org.eclipse.ocl.ecore plug-in. The deprecated API delegates to the new Ecore binding for parsing of constraints, translating the resulting ASTs to the old Ecore-centric model. Utilities are also provided to convert existing ASTs in the old model to the new. The org.eclipse.emf.ocl API remains fully supported.
OCL Document Parsing API
The new org.eclipse.ocl.OCL
generic class is the focal point
of OCL parsing and evaluation. Besides creating org.eclipse.ocl.helper.OCLHelper
s
for parsing embedded constraints and org.eclipse.ocl.Query
s
for evaluating constraints, it can also parse OCL documents (text files external to the model). The
content of an OCL document is encapsulated by the org.eclipse.ocl.OCLInput
class:
The parser supports the package and classifier context declarations, as well as all of the
kinds of constraints supported by the OCLHelper
for
embedded constraints:
- classifier invariants
- operation pre-, post-, and body conditions
- attribute initial and derived values
- def: expressions for additional attributes and properties
For example:
package ocltest context Fruit inv not_black: self.color <> Color::black def property_helper: otherFruits : Set(Fruit) = Fruit.allInstances()->excluding(self) def operation_helper: getOtherFruits1(fruit : Fruit) : Set(Fruit) = Fruit.allInstances()->excluding(fruit) context Apple::preferredLabel(text : String) : String pre text_not_null: not text.oclIsUndefined() pre text_not_label: text <> label body compute_label: result = if text = label then '' else text endif post label_is_changed: label = label@pre post label_is_set: label = text context Apple::name : String init: '' derive: if label.oclIsUndefined() then '' else label endif endpackage
Other Bug Fixes
For other bug fixes, see the 1.1 M5 release notes.
In particular, attitional operations and attributes defined by def: expressions (parsed from OCL documents or via the helper) are no longer "global" (attached to the model context classifier). They are now local to the org.eclipse.ocl.OCL environment in which they were parsed.