A free web tool that helps you create opaque expressions for Cameo Systems Modeler (MagicDraw) by simply describing what you want to achieve in plain English.
Try it live: https://opaueexpressionchatbot.netlify.app/
If you work with Cameo Systems Modeler (formerly MagicDraw) and need to create complex queries or expressions to navigate your model, this tool can help! Instead of manually figuring out how to write OCL expressions or configure Cameo's expression builder, you can describe what you want in natural language and get step-by-step instructions.
Opaque expressions in Cameo are powerful ways to:
- Navigate through model elements (metachains)
- Filter collections based on conditions
- Find specific elements with stereotypes
- Create complex queries across your model
These expressions can be written in languages like OCL, Groovy, JavaScript, and more.
- Natural Language Input - Describe what you want in plain English
- Structured Output - Get organized instructions with:
- Intent - What the expression does
- Starting Context - Where
selfrefers to - Metachain - The navigation path through your model
- Filters - How to filter elements
- Final Expression Template - Ready-to-use template with placeholders
- Notes - Additional guidance
- Visual Expression Tree - See the hierarchical structure of your expression
- Copy to Clipboard - Easily copy any section
- Beautiful Dark Theme - Easy on the eyes
- Responsive Design - Works on desktop, tablet, and mobile
Go to https://opaueexpressionchatbot.netlify.app/
In the text area, describe what you want to achieve in Cameo. For example:
- "Find all classes that have a property named status"
- "Get all operations from classes that extend a specific base class"
- "Return all interface blocks on the type of an input pin"
- "Select all elements with the «InterfaceBlock» stereotype"
Click the "Generate Expression" button (or press Ctrl+Enter).
The tool will provide you with:
-
Intent - A plain-language description of what the expression does
-
Starting Context - What
selfrefers to in your expression (e.g., an Action, Block, Pin, or Capability) -
Metachain - The navigation path through model elements you need to follow
-
Filters - Where and how to filter elements (e.g., stereotype checks, conditions)
-
Final Expression Template - A template with placeholders like
[STEREOTYPE NAME]that you can fill in with your actual model values -
Notes - Additional guidance and validation constraints
-
Expression View - A visual tree structure showing how the expression is organized
Copy the relevant sections and use them to build your expression in Cameo's Expression Editor. Replace the placeholders (like [STEREOTYPE NAME]) with your actual model element names.
This explains in plain language what your expression will do. Use this to verify the tool understood your request correctly.
This tells you what self represents in your expression. For example:
- "self is the Action that owns the InputPin"
- "self refers to the Block element"
A metachain is the navigation path through your model. It shows how to traverse from one element to another. For example:
self.input.type.ownedElement- Navigate from self to input, to its type, to owned elements
Filters show you how to narrow down collections. Common patterns include:
- Checking stereotypes:
appliedStereotype->exists(s | s.name = '[STEREOTYPE NAME]') - Property conditions:
->select(e | e.name = '[PROPERTY NAME]')
This is the actual expression code you'll use in Cameo. It uses placeholders (in brackets) that you replace with your model-specific values. For example:
self.input->collect(p |
p.type.ownedElement
->select(e | e.appliedStereotype->exists(s | s.name = '[STEREOTYPE NAME]'))
)
Replace [STEREOTYPE NAME] with your actual stereotype name like InterfaceBlock.
This shows the hierarchical structure of your expression, similar to how Cameo's Expression Editor displays it. It helps you understand how the operations are nested.
-
Be Specific - Describe exactly what you want to find or filter
- Good: "Find all classes that have the «InterfaceBlock» stereotype"
- Less clear: "Find some classes"
-
Mention Stereotypes - If you're looking for elements with specific stereotypes, mention them
- Good: "Get all elements with the «Capability» stereotype"
- Less clear: "Get some elements"
-
Describe the Context - If your expression starts from a specific element type, mention it
- Good: "From an Action, get all input pins that have types"
- Less clear: "Get pins"
-
Use Model Terms - Use Cameo/MagicDraw terminology when possible
- Classes, Blocks, Actions, Pins, Properties, Operations, Stereotypes, etc.
This tool is based on the official Cameo documentation:
Found a bug or have a feature request? Feel free to contribute! This is an open-source project.