OCL Interpreter Example

Introduction

This example describes the usage of OCL expressions used to implement OCL queries and constraints within the SDK. It demonstrates how to author OCL expressions and evaluate them against the library model elements.

References

Please refer to the document Eclipse Modeling Framework Technology Examples Overview for reviewing the library meta-model used as the basis for demonstrating the capabilities in this example.

Description

This example plug-in is named org.eclipse.emf.ocl.examples.interpreter. This plug-in contributes the OCL Interpreter menu to the library editor's main menu and context menu. The menu has one item:

  1. Show Console: Opens the interactive OCL console.

Please refer to the tutorial OCL Interpreter Tutorial for reviewing the code samples within this example.

OCL Interpreter Example Contributions

The bottom field in the console accepts OCL expressions (comments supported). You can press Enter to evaluate on the currently selected element. You can press Ctrl+Enter or Shift+Enter to insert a newline. The top field shows the output and errors. The console can be cleared by the Eraser button and closed by the X button.

OCL Interactive Console

Usage

Refer to this example if you need:

  1. To construct, validate and evaluate OCL queries and constraints on EMF model elements.


Copyright (c) 2000,2005 IBM Corporation and others. All Rights Reserved.